Skip to content

Localizing Text

Brian Intile edited this page Jun 4, 2017 · 11 revisions

NitorInc. is actively being localized. The microgame commands and names are automatically handled by the game code, but if you need in-game text or an extra command then follow this guide:

How it works

  • Localized text is gotten using keys corresponding to a text value that varies by language.
  • All keys and their corresponding values are in the Localization Sheet, which includes multiple sub-sheets.
  • Keys for extra microgame text are formatted "microgame.[Microgame ID].[key]", all of which are found in the Microgame Text section of the sheet.
  • Notify me if you use text so I can add a new key to the localization sheet.

Getting localized text from a script

  • To get localized text from a script, call TextHelper.getLocalizedText(string, string) or TextHelper.getLocalizedMicrogameText(). The former will require you to enter the whole key, but the latter works only in microgames and will automatically prefix "microgame.[ID].", saving you from typing it.
  • The first string argument is the key for the text. The second is the default string to return if the key isn't found.

Localizing a text component

  • If you have a TextMesh or Text component, attach a LocalizedText instance to it. For microgames, it's recommended to set the Key Prefix to "Current Microgame" so you won't need to specify "microgame.[ID]." in the key.
  • LocalizedText will edit the text automatically and will do nothing if no string with that key is found.
  • LocalizedText.setKey() can be used to change the text from a new key value.

Localizing a second microgame command:

  • If you need to display an extra command mid-game, use MicrogameController.instance.displayLocalizedCommand(key, defaultValue). This function will also automaticaly add the "microgame.[ID]." so don't include that in your key string.

Updating localization files

  • for any of the above methods, the player will log a warning if the key isn't found, which is to be expected if the key hasn't been updated from the google sheet yet.
  • (Windows only as of right now) To update localization from the Google Sheet to test in your game, run the external program "Localization Updater/NitorIncLocalizationUpdater.exe" in the repo's base. Do NOT submit the updated localization strings in your PR.

Clone this wiki locally