Synchronous and asynchronous loading
Add a language to a built Player
Add a language to a shipped build by dropping in a new table file.
When a data-file source serves a collection, each locale is one file in the build. The source discovers locales from the files present when localization initializes. A correctly named file adds the language, so you don’t need to rebuild or change any code.
This workflow applies to desktop platforms. On Android and Web, StreamingAssets is a URL, so Localization can’t discover files and this workflow doesn’t apply.
Prerequisites
Before you start, make sure you have the following:
- A collection assigned to a data-file source, for example Data files (JSON). Refer to Data file tables.
- A Player build for a desktop platform.
Add the language
To add a language to a shipped build:
- In the build’s files, open the table folder (
StreamingAssets/LocalizationTables by default, or the source’s configured subfolder). On Windows, the folder is [game-name]_Data\StreamingAssets\LocalizationTables.
- Copy an existing file for the collection as a template, for example
Menus_en.json.
- Name the copy
[collection-name]_[locale-code].[extension] with the new language’s code. For example, Menus_pl.json for Polish.
- Translate the values in the file. Leave keys and IDs unchanged.
- Launch the Player.
During initialization, the source finds the file, adds the locale, and makes it available wherever locales appear, including the built-in language selection controls.
Note the following behavior and constraints:
- Localization initializes and discovers the available locales once when the Player starts, so a file added while the Player is running only appears the next time the Player launches.
- The file name’s collection part must match a collection the source serves. The source ignores a file for an unknown collection.
- Missing keys in the new locale fall back to the project locale, so they resolve to your authoring language rather than nothing.
- Entries that hold object references ship inside the build’s baked table asset. A new language’s file provides text and plain data, not new assets. To provide localized assets for a new language, assign them to the collection in the Resource Tables window before you build the Player.
Additional resources
Synchronous and asynchronous loading