Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

CryENGINE CRYENGINE comes with a localization system that allows text localization for the UI. The Localization (moved to DOC2) System is documented within the Asset Creation Manual.

...

Table of Contents
maxLevel23
minLevel2
excludeOverview

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

...

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.

Code Block
titleuielements.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>
Code Block
titlecpp
IFlashUIPtr pFlashUI = GetIFlashUIPtr();
If (pFlashUIif( NULL != pFlashUI )
{
   IUIElement* pElement = pFlashUI->GetUIElement("MyElement");
   If (if( NULL != 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.

...

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 Modified

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

Image Modified

Export the gfxfontlib_glyphs.swf file with the following command:

...

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".

Image Modified

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.

Image Modified

Export the gfxfontlib.swf file with the following command:

...

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

Image Modified

Export your flash assets with the following command:

...

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

Image Modified

Note
Info
title

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
Info
title

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