Skip to content

Instantly share code, notes, and snippets.

@angad-k
Created August 15, 2021 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angad-k/60a0d39882c5dff00e8b14183c96effb to your computer and use it in GitHub Desktop.
Save angad-k/60a0d39882c5dff00e8b14183c96effb to your computer and use it in GitHub Desktop.

Adding Pseudolocalization to Godot - Angad Kambli - GSoC'21 - Godot Engine

Project Name: Adding Pseudolocalization to Godot

Student: Angad Kambli (@angad-k)

Mentors: Rémi Verschelde (Akien), Michael Alexsander (Yeldham)

Pull Requests:

Issue : Add pseudo-localization to better spot untranslated strings and unexpected layout changes caused by long strings

What is Pseudolocalization?

Pseudolocalization, as the name suggests, simulates localization to ease the internationalization flow in projects aiming to support multiple languages. Following shows what an input and output to pseudolocalization looks like :

Input :

The quick brown fox jumped over the lazy dog.

Output :

[Ŧh̀éé q́üüííćḱ ḅŕôôŵή f́ôôx́ ǰüüm̀ṕééd́ ôôṽééŕ ŧh̀éé łááźý d́ôôǵ.]

So, what does this achieve? How would transforming text into this cursed looking output be beneficial?

Well, this is pretty useful in improving the internationalization workflow for big projects. For projects catering to people from various backgrounds, supporting multiple languages might be important, and with that, comes the need for the project to be robust enough to not break when using different locales.

Now, translations for the project might not be available during development leading to problems in internationalization not being detected until very late. This is where pseudolocalization comes in: it simulates localization so that the project's robustness when it comes to changes in locale can be checked regularly during development and any problem regarding that can be detected early on.

Following are the pseudolocalization features implemented as a part of this project :

  • Accents: Replacing the normal character with accented variants helps in simulating the various characters that might be introduced during localization and also helps to check whether the selected font can support such special characters.
  • Text Expansion: The text might expand during localization and to simulate that, I have included two options, one is to simply double the vowels and that sufficiently simulates text expansion. The other option is to expand the keys by a given percentage using underscores.
  • Fake Bidi: Some writing systems like the Arabic script use a Right-To-Left system. This can be simulated by forcing RTL text by wrapping the text in some specific Unicode characters, to support bi-directional text.
  • Override: Now, turning on pseudolocalization and going through the project can already help you find strings that are untranslatable. However, the override option, when enabled, replaces every character in translatable strings with a '*' thus making it very easy to find strings that are not getting localized.
  • Skipping placeholders: People might want to know places where, due to insufficient arguments, placeholders like %s are being rendered without being replaced. This option enables them to skip pseudolocalizing string formatting placeholders like %s.
  • Prefix and suffix: Strings are wrapped in a prefix (default: [) and suffix (default: ]) to clearly see where a key starts and ends. This is important to see if any keys are getting wrongly clubbed together.

Work Done

  • Implemented pseudolocalization including all the features listed in the above section.
  • Backported pseudolocalization to Godot 3.x.
  • Wrote a tutorial for pseudolocalization for Godot-docs.
  • Also, created a demo project that showcases all the pseudolocalization features.

To-do in near future

I have added the pseudolocalization feature for the master branch of Godot which is currently the Godot 4.0 branch which was merged. Will now try and get the rest of the PRs merged as soon as possible by resolving all suggestions as they come up.

Conclusion

Working on this project introduced me to pseudolocalization, a kinda esoteric yet pretty useful feature for internationalization. The research for this project also introduced me to the localization and internationalization flow. I have been able to achieve all the things pertaining to pseudolocalization that I was initially aiming to. Working on Godot as a part of GSoC has been a delightful experience. The community is lively and has been always ready to help from day 1 when I decided to get involved with Godot for GSoC. Speaking of the future, I plan on continuing to contribute to Godot. Special thanks to Akien and Yeldham, my GSoC mentors and also to Calinou for helping me in understanding the project while preparing my proposal for it. Finally, thanks to Google for organizing GSoC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment