# Page History

## Key

• This line was removed.
• Formatting was changed.

...

## Overview

CryENGINE CRYENGINE comes with a localization system that allows text localization for the UI.
http://doc.mycryengine.com/display/SDKDOC3/LocalizationThe 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.

...

maxLevel

...

 3

...

minLevel

...

 2

...

exclude

...

 Overview

...

# Basic folder structure

...

## Basic Folder Structure

Folder

Packaged location

Description

GameSDK\Libs\

...

 *.gfx

...

 GameSDK\GameData.pak Flash assets Localization\\HUD_Font_LocFont.gfx Localization\_XML.pak Font lib for each language  Localization\\text_ui_*.xml Localization\_XML.pak Translated strings

## String Localization

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

## Translation table

The UI translation tables are located under Game\Languages\.xml*. The system loads all xml files in this folder on startup or on language change.
Translation tables for each language must be stored underGame: Localization\Localized\<Language>.pak\Languages\.xml*<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".

...

## Localized String at Run-time

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

Code Block
borderStyle
 title uielements.xml none
  <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>

Code Block
title cpp none
IFlashUIPtr pFlashUI = GetIFlashUIPtr();
If (pFlashUIif( NULL != pFlashUI )
{
IUIElement* pElement = pFlashUI->GetUIElement("MyElement");
if( NULL If!= (pElement)
{
pUIElement->SetVariable("MyTextbox", SUIArguments("@somelabel"));
}
}


...

## Font libraries 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 one file per language to switch the font for the whole UI.

### Setup

...

There are two files that are needed:

...

...

### library

...

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.

Image Removed

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

Image Removed

Export the gfxfontlib_glyphs.swf file with the following command:

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

h3. Setup gfxfontlib.gfx

...

### Import fonts to any flash asset

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

Image Removed

You need to set up a font in the flash file's library, and mark it for import as seen here.
Enter the same Identifier for the font you exported in the font library GFX file, and set the import URL to the GFX file.

While authoring the flash file, you can use the imported font symbol in the library instead of referring to an OS font.
At runtime, this font will be loaded from the font library.

Export your flash assets with the following command:

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

Code Block

To use the fonts on your textboxes just choose them in the font dropdown list.
Note, the * on the font means that the font resides in the font library.

Image ModifiedNOTE:

Info

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:

Game\Localized\<language>.pak\Libs\UI\

NOTE: you have to reload the UI elements after switch to a different language.