This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Режимы вывода изображения
Физика
Браузер SDK 2
Лицензирование и типы лицензий
Дополнения (Add-Ons)
Демонстрационные проекты
API Samples
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
Унифицированный язык шейдеров UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Localization

The current article describes how to localize the GUI of your project.

See Also#

Fonts#

Fonts files are used to correctly display characters of local languages in the Unigine-based project. The font file has a True Type font format and contains all of the local language characters.

To avoid incorrect display of language characters, you should add all of the required font files to your project folder and use the engine.gui.setFontPath() function when it is necessary to change the font. For example, to translate into Chinese, you should load your English-Chinesedictionary and set the corresponding font as follows:

Source code (UnigineScript)
engine.gui.setFontPath("my_project/gui/font_ch.ttf");

If the project supports your local language only, you can simply replace 2 font files font.ttf (for GUI widgets) and console.ttf (for console) in the data/core/gui directory with the font files containing the local language characters. The names of Unigine files should be preserved.

Character Encoding#

All of the project files should be saved in UTF-8 encoding.

Notice
The encoding must be UTF-8 without BOM (Byte Order Mark).

Translation Dictionaries#

To support several languages in your project, you need to use dictionaries, which are stored in the XML format. They are used to translate the GUI from one language into another.

Notice
You can store a separate dictionary for each language or you can create a single dictionary for all supported languages.

File Formats#

Depending on the storage method of dictionaries, you should use the corresponding dictionary file format.

Dictionaries Stored in Separate Files#

Source code (XML)
<?xml version="1.0" encoding="utf-8"?>
<dictionary version="1.00">
	<msg>
		<src>Source string</src>
		<tr>Translated string</tr>
	</msg>
</dictionary>

The root tag dictionary contains the msg child tag, which is used to define a word or phrase to be translated and has the following children:

  • src - a source string to be translated.
    Notice
    The punctuation marks should be included to the string; otherwise the string won't be translated.
  • tr - a translation string.

Single Dictionary for All Languages#

Source code (XML)
<?xml version="1.0" encoding="utf-8"?>
<dictionary version="1.00">
	<msg>
		<src>Source string</src>
		<en>String translated to English</en>
		<ch>String translated to Chinese</ch>
		<ru>String translated to Russian</ru>
	</msg>
</dictionary>

The root tag dictionary contains the msg child tag, which is used to define a word or phrase to be translated and has the following children:

  • src - a source string to be translated.
    Notice
    The punctuation marks should be included to the string; otherwise the string won't be translated.
  • en, ch, ru or any other tag that contains a translation string.
    Notice
    You can use any tag to store the translation. You just have to specify the tag name as the second argument of the engine.gui.addDictionary() function to load the proper translation.

Managing Locale#

To add the dictionary, use the engine.gui.addDictionary() function. To save the last loaded dictionary, use the engine.gui.saveDictionary() function. This function also allows you to save the currently loaded dictionary into another file. If you want to modify the dictionary, you can edit the XML file manually or by using the Xml class functions and then load it.

Notice
Dictionaries cannot be changed in run-time.

If you use a separate dictionary for each language, you should get access to translation as follows:

Source code (UnigineScript)
engine.gui.addDictionary("my_project/locale/my_project.ch"); // load English-Chinese dictionary
ui.updateWidgets();
Otherwise, you should specify a tag that contains the required translation as the second argument of the engine.gui.addDictionary() function:
Source code (UnigineScript)
engine.gui.addDictionary("my_project/locale/my_project.locale","ch"); // load the Chinese translation
ui.updateWidgets();
The updateWidgets() function is called to change the language after the required dictionary is added.

Input Methods#

Unigine supports IMEs (Input Method Editors) that allow entering Chinese, Japanese and Korean characters by using the Latin keyboard.

Notice
Unigine doesn't support right-to-left and top-to-bottom languages.

To enter Chinese, Japanese or Korean characters, simply change your keyboard layout and start typing.

Last update: 16.08.2024
Build: ()