Skip to content

Latest commit

 

History

History
76 lines (56 loc) · 4.09 KB

README.md

File metadata and controls

76 lines (56 loc) · 4.09 KB
Readme last reviewed at ThinBasic v1.11.6.0

thinternational

Tool to speed up translation of thinBasic scripts

Table of content

Setup your script for translation
Build translation file without thinAir integration
thinAir integration (with bundling version)
thinAir integration (without bundling version)
Translation-file building
Limitations

Setup your script for translation

  1. Copy the file I18N_helper.tbasicu to the same path as your main script
  2. From I18N_helper.tbasicu copy the part of code that is at the top and paste it in your main script
  3. Uncomment it and make the adjustments you need (language selection).
  4. Anywhere you need a String translation, enclose it with i18nh("your string to translate") or i18nh("your string to translate","any comment to the translator")

Build translation file without thinAir integration

Or see thinAir integration below.

  1. Open your main script in thinAir
  2. Right click on the script TAB name
  3. From the context menu, copy file name to clipboard
  4. thinAir menu : Script\Command Line ...
  5. Right click in the input bar and paste the path, then click OK
  6. Run I18N.tbasic
  7. In your main script folder, edit your xml file (I use Notepad++) to complete it with translations.

see thinternational Sample folder fo example.

thinAir integration (with bundling version)

Or see thinAir integration without bundling below.

  1. Whithin thinAir build I18N.tbasic to I18N.exe
  2. Create folder %thinBasic_Installation_Folder%\thinAir\Tools\thinternational
  3. Move I18N.exe to _%thinBasic_Installation_Folder%\thinAir\Tools\thinternational_
  4. Edit %thinBasic_Installation_Folder%\thinAir\Tools\thinAir_Tools.ini and append the following section :
[thinI18N]
Menu=thinternational
CommandLine=%thinAirinstallpath%\Tools\thinternational\I18N.exe %sourcecodefullpathnameext%
SaveScriptBefore=true
  1. Restart thinAir

thinAir integration (without bundling version)

  1. Create folder %thinBasic_Installation_Folder%\thinAir\Tools\thinternational
  2. Move I18N.tbasic to _%thinBasic_Installation_Folder%\thinAir\Tools\thinternational_
  3. Edit %thinBasic_Installation_Folder%\thinAir\Tools\thinAir_Tools.ini and append the following section :
[thinI18N]
Menu=thinternational
CommandLine=%thinbasicinstallpath%\thinbasicc.exe "%thinAirinstallpath%\Tools\thinternational\i18N.tbasic " %sourcecodefullpathnameext%
SaveScriptBefore=true
  1. Restart thinAir

translation-file building

  1. Open your main script in thinAir, stay on this tab.
  2. thinAir menu : Tools\User Tools\thinternational
  3. In your main script folder, edit your xml file (I use Notepad++) to complete it with translations.

limitations

Due to an actual limitation from TB's gettext() that trims translated strings, beginning and ending spaces characters, if any, have to be hardcoded.

Due to another limitation from TB's gettext(), all source languages as well as later versions (mostly symbols) of unicode characters are not supported in the script's body. Tested working language are english, french, italian. One workaround is to declare the source language (the one in the script) with a fake name (example: $DEV_LOCAL = "Source_en-GB" ) and use the translation file to store any convenient character even for i18n.Setlocale("en-GB") .