##### Page tree
Go to start of banner

# UI Localization

Go to start of metadata

You are viewing an old version of this page. View the current version.

Version 16

## Overview

CryENGINE comes with a localization system that allows text localization for the UI. The Localization System is documented within the Asset Creation Manual.

Besides string localization it is also possible to use different font and glyph sets for each language.

## Basic folder structure

Folder

Packaged location

Description

GameSDK\Libs\*.gfx

GameSDK\GameData.pak

Flash assets

Localization\<language>\HUD_Font_LocFont.gfx

Localization\<language>_XML.pak

Font lib for each language

Localization\<language>\HUD_Font_LocFont_glyphs.gfx

Localization\<language>_XML.pak

Glyph set for each language

  Localization\<language>\text_ui_*.xml
Localization\<language>_XML.pak

Translated strings

## String Localization

UI string translations are stored in .xml Excel sheets. It simply stores labels (keys) and translation.

## Translation table

Translation tables for each language must be stored under: Localization\<Language>\text_ui*.xml for it to be processed to the default locations used by the engine.

For UI translation the tables must have a column "KEY", "ORIGINAL TEXT" and "TRANSLATED TEXT".

## Pass localized string at run-time

A label is also translated if it is passed as string to a dynamic textfield via Code\FlowGraph\LUA.

uielements.xml
  <UIElement name="MyElement">

<GFx file=" MyElement.gfx" layer="2" alpha="1" >
<Constraints>
<Align mode="fullscreen" />
</Constraints>
</GFx>

<variables>
<variable name=" MyTextbox " varname="_root.TextLayer.TextBox.text"/>
</variables>

</UIElement>

cpp
IFlashUIPtr pFlashUI = GetIFlashUIPtr();
If (pFlashUI)
{
IUIElement* pElement = pFlashUI->GetUIElement("MyElement");
If (pElement)
pUIElement->SetVariable("MyTextbox", SUIArguments("@somelabel"));
}


## Fontlibs and glyph sets

It is recommended to use one font library and glyph set for all flash assets. One reason is to save memory since you don't want to embed every font in every flash file. This technique also allows embedding different glyph sets for different languages.

It also makes sure that your corporate design is consistent over all UI assets and changes are even easier since it is only necessary to change two files to switch the font for the whole UI.

### Setup gfxfontlib and gfxfontlib_glyphs

There are two files that are needed:

• gfxfontlib.gfx - Font library.
• gfxfontlib_glyphs.gfx - Glyph set.

The gfxfontlib.gfx defines all your fonts that are used in your UI.

Since exported fonts in flash always hold every glyph for the chosen font it is necessary to create a gfxfontlib_glyphs.gfx file that allows embedding only the glyphs you want.

### Setup gfxfontlib_glyphs.gfx

This file holds every glyph for every font that is used in the UI.
Create a new flash file and name it gfxfontlib_glyphs.fla.
Create Dynamic Textboxes on the stage for each font and font-style and embed the needed characters.

Create an empty dummy MovieClip and mark it for "Export for runtime sharing".

Export the gfxfontlib_glyphs.swf file with the following command:

gfxexport.exe -c -i DDS -share_images -rescale hi gfxfontlib_glyphs.swf


### Setup gfxfontlib.gfx

This file defines all fonts and font-styles for the UI.
Create a new flash file and name it gfxfontlib.fla. Create new font symbols for each font and font-style in the library (Right-Click -> New font)
Choose font and style, give it a name and mark "Export for runtime sharing"

Create an empty MovieClip and mark it as "import for runtime sharing" (or just copy and paste the dummy MovieClip from the gfxfontlib_glyphs.fla). This step is necessary to create a dependency to the glyph file.

Export the gfxfontlib.swf file with the following command:

gfxexport.exe -c -i DDS -share_images -rescale hi -strip_font_shapes gfxfontlib.swf


### Import fonts to any flash asset

Finally you need to import the exported fonts from gfxfontlib.gfx to your flash assets. You can just copy and paste them.

Export your flash assets with the following command:

gfxexport.exe -c -i DDS -share_images -rescale hi -strip_font_shapes *.swf


To use the fonts on your textboxes just choose them in the font dropdown list.

Note

If you use translation labels for static textboxes you have to make them dynamic! Otherwise the translation doesn't work.

## Different font libraries and glyph sets for different languages

Just create gfxfontlib.gfx and gfxfontlib_glyphs.gfx files for each language and place them under:

Localization\<language>\*.gfx

Note

You have to reload the UI elements after switching to a different language.

• No labels