Skip to content

Repository files navigation

PO Lengthier Text Author


PO Lengthier Text Author (POLenTA) is a tool for creating a new `.po` file for a fake language that includes the longest translation of each text from a set of `.po` files.

The aim is to help the UI/UX and QA departments of companies who use .po files in their localization pipeline, especially videogame developers using Unreal Engine.

Since longer translations take up more space, you can then import this fake language into your application to test the worst case for your UI/UX in a single run, without the need to constantly change the language from the settings.

Please note that the generated scenario may be worse than the real ones. If your UI can handle this well, you're good to go.

If used in FontBased mode, POLenTA will also find characters that aren't supported by the specified font files.

POLenTA takes its name from a food of Northern Italy, its developer's homeland. https://en.wikipedia.org/wiki/Polenta

Table of Contents


How to

POLenTA is a C# console application for Windows that requires .NET 6.0 or higher.

  1. Go to https://dotnet.microsoft.com/en-us/download/dotnet/6.0
  2. Find section .NET Desktop Runtime
  3. Download x64 Windows installer
  4. Run the installer

C# is not the developer's primary language, so code style and architectural choices may be less than ideal.

How to use POLenTA:

  1. (Only once) Get and unzip the latest version of the tool from the Releases folder.
  2. (Only once) Configure the Localization Dashboard (instructions below)
  3. Configure the Settings.ini (instructions below)
  4. Run POLenTA.exe
  5. (Optional) Check the log file in the Logs folder
  6. Import the generated .po file(s) into your project
  7. Test the generated localization

Configure the Localization Dashboard in Unreal Engine

  1. Open the Localization Dashboard (under Window in UE4, under Tools in UE5)
  2. Select the target(s), scroll all the way down
  3. Press Add new culture and select your output culture
  4. Restart the editor

Add new culture

Import the generated translation in Unreal Engine

In the Localization Dashboard, press Import Text, select the localization folder, wait for the end of the process. It will take some time, the .archive file will be created.

Import Text

Now the output culture's word count should be at 100%.

Press Compile Text, so the .locres file will be created. The new culture is ready to be used.

Compile Text

Testing

QA: launch the game, select the output culture language from the settings, play the game.

UI: Open a widget blueprint, use the button next to the world globe icon to select the localization preview language

English:

English

Italian:

Italian

Japanese:

Japanese

Output culture:

Output culture

Lifecycle

POLenTA's lifecycle is made up of these step:

  1. Read the settings from the ini file
  2. Eventually load the requested fonts.
  3. For each target
    1. Parse the .po files of the specified cultures
    2. Get the longest translation of each text
    3. Generate the .po file with those long translations

A log file will be created for each run. Contains info about the scanned files, problems or errors that may occur and some statistics.
Most of the information will also appear in the application window.

To avoid showing the application window or creating the log file, see the Console arguments section.


Setting.ini configuration

POLenTA uses Settings.ini to know what to do.

Project section

In Unreal Engine, the localization folder path is usually
LocalizationFolder = C:\{My game folder path}\Content\Localization


In Unreal Engine, you can find the game localization targets in the Localization Dashboard.

Targets

Add a comma (and optionally also a space character) between each item of LocalizationTargets.
LocalizationTargets = Game,Dialogues

Cultures section

You must specify the default and output culture and at least one language to compare against, using culture codes.

Here you can find the list of all culture codes.

The OutputCulture is the culture code of the fake language that POLenTA will create.
I recommend to use Afar, an African culture uncommonly used in games which code is aa.
In this way, the generated output folder will be the first in alphabetical order.

Add a comma (and optionally also a space character) between each item of CompareCultures.

DefaultCulture = en

OutputCulture = aa

CompareCultures = cs,de,es-ES,fr,it,ja,ko,pt-BR,ru,zh-Hans,zh-Hant

POLenTA will use the culture codes to generate working folder paths in this way:
{LocalizationFolder}\{LocalizationTarget}\{CultureCode}\

This is the expected folder tree for the localization in Unreal Engine

├── Localization
│   ├── TargetA
│   │   ├── en
│   │   │   ├── TargetA.po
│   │   ├── it
│   │   │   │── TargetA.po  
│   │   ├── ja
│   │   │   ├── TargetA.po
│   ├── TargetB
│   │   ├── en
│   │   │   ├── TargetB.po
│   │   ├── it
│   │   │   ├── TargetB.po
│   │   ├── ja
│   │   │   ├── TargetB.po

The output folder will be automatically created, if missing.

POLenTA section

POLenTA provides two ways to calculate to the length of a translation:

  • NumChars simply counts the number of the characters in the string
  • FontBased sums the rendered glyph size of each character, so you need to provide at least one font file. It requires more memory and longer execution time

Testing a real case with 2 targets and a total of ~6000 entries, it takes:

  • Less than 1 second using NumChars
  • Less than 3 seconds using FontBased

Set the chosen mode into the TextLengthCalculatorType property.
TextLengthCalculatorType = NumChars


`DefaultFont` is an optional property used only for font based length calculator.

It allows you to specify the default font used in the project. The value of the property is the font file path.
Like in Unreal Engine, it makes no sense to specify a scaling factor for the default font, it will always be 1.0.
DefaultFont = C:\Windows\Fonts\Arial\arial.ttf


`DoExitCountdown` is an optional property.

By default, POLenTA does a 3 seconds countdown at the end of the task, before closing itself.

You can avoid it using
DoExitCountdown = false

Fallback fonts section (FontBased only)

It allows you to specify the fallback fonts to look for if a character glyph cannot be found in default and culture specific fonts.

The name of the property is not important.
The value is the font file path, optionally followed by its scaling factor (default is 1.0).

E.g. for CJK characters fallback with scaling factor of 1.5 is
FF_CJK = C:\{My folder path}\Fonts\Noto\SimplifiedChinese\NotoSansSC-Medium.otf, 1.5

Don't forget the comma between the file path and the scaling factor!

Culture specific fonts section (FontBased only)

It allows you to specify the font used for a culture and (optionally) its scaling factor.
You can't specify a specific font only for a characters subset, like in Unreal Engine.

The name of the property is the culture code.
The value is the font file path, optionally followed by its scaling factor (default is 1.0).

E.g. for Japanese with scaling factor of 1.5 is
ja = C:\{My folder path}\Fonts\Noto\Japanese\NotoSansJP-Medium.otf, 1.5

Don't forget the comma between the file path and the scaling factor!


Console arguments

POLenTA supports some console arguments to better fit your pipeline:

  • -NoLogFile will skip the creation of the log file (you can still read part of the log output in the console window)
  • -HideWindow will hide the console window

The case of the characters of the console argument is not important.

To apply the one or more console arguments:

  • If you like the command prompt, just invoke POLenTA.exe followed by the args
  • Or create a custom shortcut
    • Right click on POLenTA.exe and select Create shortcut
    • Right click on the just created shortcut, select Properties, then select the Shortcut tab
    • Add the args after POLenTA.exe in Target.

In both cases, you will obtain
{POLenTA folder path}\POLenTA.exe -NoLogFile -HideWindow

Applying both -NoLogFile and -HideWindow won't give any information of the execution but will simply generate the output culture files.


Credits and licenses

POLenTA is licensed under the MIT NON-AI License (see LICENSE).

If you use POLenTA during the development of your software, I would be very pleased if you would add me in the credits with this line (or something similar)
This software uses POLenTA by Michele Caovilla

POLenTA uses the following libraries:

The respective licenses can be found in the Licenses folder.

POLenTA's icon is based on this free image.

A sincere thank you to their creators, without whom POLenTA would not have been possible.

About

PO Lengthier Texts Author is a tool for creating a new .po file that includes the longest translation of each texts from a set of .po files

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors