Changes between Version 5 and Version 6 of Internationalization


Ignore:
Timestamp:
Apr 13, 2014, 1:32:09 PM (10 years ago)
Author:
Adrián Chaves
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Internationalization

    v5 v6  
    1 [[TOC]]
     1[[PageOutline(1-100, Table of Contents)]]
    22
    33= Internationalizing GUI Files =
     
    55To internationalize a caption or tooltip (or any other XML attribute) of a GUI XML `object` element, remove the attribute from the `object` element that contains it, and add a new `translatableAttribute` element within the `object` element that used to contain the old attribute, with the name of the old attribute as the value of the `id` attribute of this new element, and the value of the old attribute as the content of this new element.
    66
    7   ''' Note:'''  Use "caption" as id of translatableAttribute to translate the caption of an object element.
     7  '''  Note:'''   Use "caption" as id of translatableAttribute to translate the caption of an object element.
    88
    99|| '''Original''' || `<object type="button" tooltip="Adjust game settings.">Options</object>` ||
     
    2525Move 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:
    2626
    27 || '''Original''' || XML file:[[BR]]`<action on="Load">    this.caption = "Build:" + ``Engine.GetBuildTime();</action>` ||
    28 || '''Wrong''' || XML file:[[BR]]`<action on="Load">    this.caption = sprintf(translate("Build: %(buildTime)s"), { buildTime: Engine.GetBuildTime() });</action>` ||
    29 || '''Internationalized''' || XML file:[[BR]]`<action on="Load">    this.caption = getBuildTimeString()</action>`[[BR]][[BR]]!JavaScript file included by the GUI file:[[BR]]`function getBuildTimeString(){    return sprintf(translate("Build: %(buildTime)s"), { buildTime: Engine.!GetBuildTime() });}` ||
     27|| '''Original''' || XML file:[[BR]]`<action on="Load">    this.caption = "Build:" + ``Engine.GetBuildTime();</action>` ||
     28|| '''Wrong''' || XML file:[[BR]]`<action on="Load">    this.caption = sprintf(translate("Build: %(buildTime)s"), { buildTime: Engine.GetBuildTime() });</action>` ||
     29|| '''Internationalized''' || XML file:[[BR]]`<action on="Load">    this.caption = getBuildTimeString()</action>`[[BR]][[BR]]!JavaScript file included by the GUI file:[[BR]]`function getBuildTimeString(){    return sprintf(translate("Build: %(buildTime)s"), { buildTime: Engine.!GetBuildTime() });}` ||
    3030
    3131= Internationalizing !JavaScript Files =