Localization Guide

Localization of Gameface resources in Unreal Engine

The purpose of this tutorial is to show you how to use the built-in localization feature of UE4 with Gameface in a few simple steps. For a localization-ready sample, you can check our localized menu map - MenuLocalization, located in the CoherentSample sample project. At the end of this tutorial, you will know everything you need to create a localized UI with Gameface.

The localization workflow is the following:

  1. In the UI HTML page, declare the text that will be translated.
  2. Generate Translation manifest and archive files.
  3. Enter the translation strings for texts that will be translated.
  4. Generate the translation manifest and archive files again to rebuild the binary localization file.
  5. Change the engine’s current culture and do the C++/HTML binding.
  6. Enable Gameface’s localization facility.

Step 1: Declaring strings that will be translated

In this step, we will tag the buttons that will have their text translated in HTML and declare that we want a translation for a text entry.

The Menu map loads the coui://UIResources/LocalizedMenu/menu.html page, which will be our starting point. On the page you can find some CSS includes, JavaScript includes and most importantly – the 3 menu buttons. In the button tag of the start button, we will add a property called data-l10n-id and set its key to MenuNamespace.NewGameButton e.g.

<button id="play" class="btn btn-large btn-primary" type="button"data-l10n-id="MenuNamespace.NewGameButton">Play</button>

Now we have to declare that we want a translation for the “NewGameButton” key. In the menu.html file we will add a comment containing the following declaration:

<!--NSLOCTEXT("MenuNamespace", "NewGameButton", "NewGameButton translation in every language")-->

It doesn’t matter where on the HTML page the comment is located. Now, what is this C++-like declaration and why do we need it? NSLOCTEXT is a C++ macro, used by Unreal that declares a new localization text. It takes 3 parameters:

  1. Localization Namespace – it allows localization texts to be grouped together, and thus allows for easier bookkeeping – e.g. all button names can be in the “MenuNamespace”.
  2. Key – a unique identifier for a namespace, used together with a namespace to identify a localized text entry.
  3. Text Literal – the text literal is a sample text that is used to describe the key. If a translation for the current Culture is not found, the Text Literal will be used instead.

Step 2: Generate translation manifest and archive files

The Unreal Engine localization system works with three types of files:

  • .manifest - contains JSON code describing namespaces, keys, text literals and the file/line where the localized text is. Most probably they are used to generate .archive files.
  • .archive - it has a very similar structure to the .manifest file, but instead of the location of the localized text, it contains the translation of the localized text for a specific language.
  • .po - it does the same job as the .archive files but in another well-known localization format. It also contains the translation of the localized text for a specific language.
  • .locres - a binary file that contains the binary representation of the localized texts for a specific language. The Unreal localization system can only read from .locres files.

Now, back to the practical part. The generation of the manifest, archive and locres files happens with the help of an Unreal Engine commandlet called GatherText. Commandlets are mini-programs with a specific purpose. In this case, the commandlet reads a configuration file and executes the steps defined in it. The commandlet is called with:

PathToEditor\UE4Editor.exe FullPathToYourGame\YourGame.uproject -run=GatherText -config=FullPathToYourGame\Config\Localization\YourGame.ini

or in our case:

E:\unreal\Engine\UE4\Engine\Binaries\Win64\UE4Editor.exe E:\unreal\CoherentSample\CoherentSample.uproject -run=GatherText -config="E:\unreal\CoherentSample\Config\Localization\CoherentSample.ini" -log=localization.log

The configuration Localization/CoherentSample.ini file contains a list of settings and series of steps that will be executed by the GatherText commandlet. The configuration that I have used is the following:


;Get all FTexts from source code
;File extensions that will be parsed

;Gather text from assets in content.

;Create manifest with all gathered source text.

;Generate Archives

;Export new source from existing archives into PO (portable object) files.

;Import new translations from PO (portable object) files into existing archives.

;Compile source text and translations into binary form for use by the application.

Most of the options in the configuration file are self-explanatory, but there are some things that should be pointed out:

  • CulturesToGenerate=en, CulturesToGenerate=fr and CulturesToGenerate=bg – used to generate English and French localizations. For every language/locale you want to have localization for, you must add a row in the config file with the language/region code.
  • SourceFileSearchFilters=*.html – used to tell the parser to look inside .html files.
  • SourcePath and DestinationPath pointing to ProjectName/Content/Localization/CoherentSample – this is a default path used to find .locres files by the engine. If your files are in it, they should be automatically loaded by the engine.
  • The search filters for this samples are set to .h, .cpp, .html.

Step 3: Enter the translation strings for texts that will be translated

After you have run the commandlet, in


In order for these translations to take effect in your game, in DefaultGame.ini you should add:

+LocalizationPaths  /Content/Localization/CoherentSample


Now we would like to translate the key for NewGameButton (from section 1) into French. In order to do so, navigate to ProjectName/Content/Localization/CoherentSample/fr and open CoherentSample.archive. In the Translation field, you should enter the translation of Start Button in French.

"Subnamespaces": [
        "Namespace": "MenuNamespace",
        "Children": [
                        "Text": "Start new game"
                        "Text": "Commencer une nouvelle partie"
                    "Key": "NewGameButton"

Step 4: Generate translation manifest and archive files again

After we have filled the empty translation fields, we have to run the same commandlet again:

E:\unreal\Engine\UE4\Engine\Binaries\Win64\UE4Editor.exe E:\unreal\CoherentSample\CoherentSample.uproject -run=GatherText -config="E:\unreal\CoherentSample\Config\Localization\CoherentSample.ini" -log=loc.log

Once the translation strings are filled, re-running the commandlet will not erase the existing translation entries and will re-generate the binary .locres file. If you are not sure if the French translation made it to the .locres file, you can open the ProjectName/Content/Localization/CoherentSample/fr/CoherentSample.locres file with a hex editor and inspect its contents.

Step 5: Change the engine’s current culture and do the C++/HTML binding.

After we have generated the .locres files with the localized tests, it is time to head to the UI again and bind it to the game.


Gameface will automatically translate the elements tagged with data-l10n-id using the default locale. To dynamically change the language, we need to create a few buttons:

// buttons for changing localization in menu.html
<input type="button" id="en" class="btn language-menu-item selected-language" value ="English">
<input type="button" id="fr" class="btn language-menu-item" value="Francais (French)">

And then add JS code to add binding and localization reloading:

// js for changing localization in menu.html
var changeLanguage = function (language) {
    engine.call('ChangeLanguage', language).then(function () {

// Attach click handlers
var onLanguageChanged = function (eventArgs) {
    var button = eventArgs.target;
    // Change the current language to the value of the data-language of the current button
    // Move the selected-language class to the current button

    var buttons = document.getElementsByClassName('selected-language');
    for (var i = 0; i < buttons.length; i++) {
        var prevbutton = buttons.item(i);


var localizationChangers = document.getElementsByClassName('language-menu-item');
for (var i = 0; i < localizationChangers.length; i++) {
    var button = localizationChangers.item(i);
    button.addEventListener('click', onLanguageChanged);


  • Setup methods for changing the current culture. You can find them in CoherentSampleLocalizationHUD
    void ACoherentSampleLocalizationHUD::ChangeLanguage(FString Language)
  • Bind these methods to the UI
    // In the HUD's constructor

    void ACoUIGTTestFPSMenuHUD::BindUI()
            cohtml::MakeHandler(this, &ACoherentSampleLocalizationHUD::ChangeLanguage));

Step 6: Enable Gameface’s localization facility.

Localization is disabled by default in Gameface. To enable it, navigate to Gameface -> Options inside the Unreal Engine Editor and check Enable Localization. By doing this, Gameface will automatically translate any elements tagged with the data-l10n-id attribute.