Creating Localizations

Localization Setup

Instead of reading you can watch a localization tutorial video!

Note

Before you start working on localizing Crea into your own language check out the official CreaLocale github repository. There you can help contribute to an existing localization or help start a new one that could eventually be included in the game officially.

Creating new localizations in Crea is easy. Start by copying the current en.locale and renaming the file with the correct language code such as Japanese would be ja.locale. Open this file in a text editor and update the locale’s name in setup(). You may also need to update the locale’s fonts.

Next open the settings file in the same directory as Crea.exe and change the localizer entry to be the path of your new locale file.

"localizer": "C:\\dev\\CreaLocale\\locale\\ja.locale",

Now you are ready to get started with the Localizer!

Localizer Basics

There is a localization tool built into Crea (load up a world and press P key) that makes the entire localization process much easier by allowing you to filter, edit and preview localization entries. This tool, “Localizer”, displays all localization keys by their category and allow for easy filtering.

_images/crea_localizer.png

New versions of Crea can contain changed locale entries or entirely new ones. These outdated entries are designated by a “!” and the overall progress for localizing a category is displayed next to the category. When starting a new localization all entries are considered outdated.

_images/crea_localizer_new.png

Localizer Filtering

Clicking on a category will filter all entries by that category. Filtering can be done manually by typing into the edit field on the top. There are just a few things to know about this. The entries will filter by their locale key. If the filter includes a : then the first part is the category name to filter by with the second part being the locale key. Finally you can filter to only show outdated entries by including a ! anywhere in the edit filter.

Localizer Editing

Clicking on an entry will bring up the edit and preview window. Through this window you can edit the locale entry. In the preview section you can see the original text along with a live preview of your localization. This preview reflects what it will look like in game including line width. To close this dialog simply click outside of it and your entry will be automatically updated. The localizations will be saved to file after every 10 edits or whenever you close the localizer.

_images/crea_localizer_edit.png

Language Font Characters

The default game fonts do not support all language characters which results in them not being rendered properly. This can be fixed by supplying your own fonts and specifying them in your localization file using font(). The Localizer will use your fonts when displaying localized text.

font("bitter_italic", "../ui/fonts/NotoSansMonoCJKjp-Regular.otf")

This will change all ‘bitter_italic’ text to use the font NotoSansMonoCJKjp-Regular.otf which supports Japanese characters.

Language Mod

In order to test out your localization in game or if you want to release your localization as a mod then you can download an example localization mod here.

Localization File

The locale file holds all of the game’s text. The first time this is created you will want to adjust the setup information but after that you generally you do not need to change this file directly.

setup(name, useWordWrap=False)

This initializes the locale file with some basic information.

Parameters:
  • name (str) – The name of the localization which is displayed in the Settings menu.
  • useWordWrap (bool) – Should this locale wrap only on word boundries such as spaces or wrap on any character.
font(key, path)

All of the game’s text use font keywords to determine which font it should use. This allows you to change which fonts to use when your localization is active.

Parameters:
  • key (str) – The font key to associate this font with.
  • path (str) – The path of the font to use. When using your own fonts it is recommend to place them in the mods/mymod/ui/fonts/ folder.
locale(key, value, category='', uid=0)

Adds a new entry to the localization.

Parameters:
  • key (str) – The key used to access this entry.
  • value (str) – The localized text for this entry.
  • category (str) – The category this entry is placed into. This is only used for the Localizer tool.
  • uid (str) – A unique id used to track the versioning of this locale entry so that Localizer can properly detect when this entry is outdated.
associate(key, existingKey, value, category='', uid=0)

Adds a new entry to the localization and connects it’s Description and Flavor entries to it.

Parameters:
  • key (str) – The key used to access this entry.
  • existingKey (str) – The existing key to associate this entry to.
  • value (str) – The localized text for this entry.
  • category (str) – The category this entry is placed into. This is only used for the Localizer tool.
  • uid (str) – A unique id used to track the versioning of this locale entry so that Localizer can properly detect when this entry is outdated.

Links a locale key to an existing entry to avoid duplication.

Parameters:
  • existingKey (str) – The existing key to link the new entry to.
  • key (str) – The new entry key.