Changes between Version 17 and Version 18 of Internationalization


Ignore:
Timestamp:
Apr 19, 2014, 7:25:42 PM (10 years ago)
Author:
Adrián Chaves
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Internationalization

    v17 v18  
    4848Simply put: '''you cannot'''.
    4949
    50 You can call any of the global internationalization functions described below, however, strings passed to these functions are not parsed by the message extraction system, which means that translators won’t be able to actually translate the string.
    51 
    52 Move any !JavaScript code that requires internationalization of “hard-coded” strings into a function of a separate !JavaScript file. The message extraction system will successfully extract !JavaScript strings from !JavaScript files. You can then call that function from your GUI file. For example:
     50You can call any of the global internationalization functions described below, however, strings passed to these functions are not parsed by the [wiki:Message_Extraction message extraction tool], which means that translators won’t be able to actually translate the string.
     51
     52Move any !JavaScript code that requires internationalization of “hard-coded” strings into a function of a separate !JavaScript file. The message extraction tool will successfully extract !JavaScript strings from !JavaScript files. You can then call that function from your GUI file. For example:
    5353
    5454'''Original:'''
     
    151151= Internationalizing !JavaScript Simulation Files =
    152152
    153 Internationalizing js simulation files isn't easy, as the simulation is supposed to be deterministic, and completely equal between different players in a game (which may use different locales). That's why the simulation may only mark strings for translation (those strings will can found by the message extracting tool), and the actual translation has to happen in the unsynced GUI files.
     153Internationalizing js simulation files isn't easy, as the simulation is supposed to be deterministic, and completely equal between different players in a game (which may use different locales). That's why the simulation may only mark strings for translation (those strings will can found by the [wiki:Message_Extraction message extracting tool]), and the actual translation has to happen in the unsynced GUI files.
    154154
    155155Marking a string for translation is done with the {{{markForTranslation(message)}}} and {{{markForTranslationWithContext(context, message)}}} functions.
     
    172172Internationalizing strings from data files that are loaded by !JavaScript files is a two-step process. You must:
    173173
    174  1. Configure the [wiki:Implementation_of_Internationalization_and_Localization#MessageExtraction message extraction system] to extract the translatable strings from the data file.
     174 1. Configure the [wiki:Message_Extraction message extraction] to extract the translatable strings from the data file.
    175175 1. Use an internationalization function on the !JavaScript side after you load the data file.
    176176
    177177== Configuring the Message Extraction System for Data Files ==
    178 Our message extraction system currently supports extracting data strings from:
     178Our [wiki:Message_Extraction message extraction tool] currently supports extracting data strings from:
    179179
    180180 * '''Plain text files (.txt)'''. The content of plain text files can be extracted  line by line. Paragraphs in these plain text files should not contain  line breaks, otherwise each line is extracted as a separate message,  which is not translator-friendly.
     
    184184   * Strings from JSON data defined within an XML element.
    185185
    186 To configure the message extraction system to extract strings from a new data file, you must edit the `l10n/messages.json` file of the mod folder. In the `messages.json` file of the main mod, `public`, you can find examples of all the supported types of data extraction. For more information, see the [wiki:Implementation_of_Internationalization_and_Localization#MessageExtraction message extraction system documentation.]
     186To configure the message extraction system to extract strings from a new data file, you must edit the `l10n/messages.json` file of the mod folder. In the `messages.json` file of the main mod, `public`, you can find examples of all the supported types of data extraction. For more information, see [wiki:Message_Extraction Message Extraction].
    187187
    188188== Internationalizing Content that !JavaScript Files Load from Data Files ==
    189 Once the message extraction system is properly configured to extract the translatable strings from a data file, translators will be able to translate those strings. But for those translations to be actually used, you must internationalize the !JavaScript that loads or uses the data to translate the loaded data at run time.
     189Once the message extraction is properly configured to extract the translatable strings from a data file, translators will be able to translate those strings. But for those translations to be actually used, you must internationalize the !JavaScript that loads or uses the data to translate the loaded data at run time.
    190190
    191191If the !JavaScript file obtains the data as string that contains the complete message to translate, you can simply pass a variable that contains the translatable string to a global internationalization function such as `translate()` or `translateWithContext()`.
     
    223223}}}
    224224
    225 It will translate "translatedObject1" using a certain context, and every string in the list of "translatedObject2" also with the same context, after which the list will also be joined with a localised connector (", " in English). So the result could be
     225It will translate "translatedObject1" using a certain context, and every string in the list of "translatedObject2" also with the same context, after which the list will also be joined with a localized connector (", " in English). So the result could be
    226226
    227227{{{