DevBlog #40 | Foundry Fridays: Localization System
Author: Pdx_Tauriel,
published 1 year ago,
[h2]Hello! Hallo! ¡Hola! こんにちは! 안녕하세요![/h2]
Greetings, everyone! I'm Roman, also known as Zirus, and I've joined the FOUNDRY team back in April. Though I'm new to Foundry Fridays, I'm eager to share some exciting improvements we've been making to our Localization System.
[h2]Why the Upgrade to our Localization System?[/h2]
Previously, our Localization was based on simple key-value pairs. But, as we and FOUNDRY's codebase have grown, we've seen the need for a more robust system - especially when a tiny typo could lead to a big headache:
[table]
[tr]
[th]Key[/th]
[th]Value[/th]
[/tr]
[tr]
[td]Welcme to Foundry![/td]
[td]Willkommen in Foundry![/td]
[/tr]
[/table]
Noticed the typo in "Welcome"? Fixing it leads to a lost translation as it ends up being a new key:
[table]
[tr]
[th]Key[/th]
[th]Value[/th]
[/tr]
[tr]
[td]Welcome to Foundry![/td]
[td][/td]
[/tr]
[/table]
To address this, we have implemented improvements to the System using unique identifiers for each phrase, which ensures consistency of translations across all languages. We'll look into this more in depth a bit later, but let's take a look at the things that actually need Localization first.
[h2]The Three Pillars of Localization in FOUNDRY[/h2]
Localization in Foundry stands on three pillars:
[h3]Static Localization[/h3]
Upon starting the game, static elements like information messages and headers are set in your chosen language. This content remains constant throughout your experience.
[img]https://clan.cloudflare.steamstatic.com/images//38913947/f46b891759b465bd3bfc6ecc791b72f723a16f0f.png[/img]
[h3]Dynamic Localization[/h3]
Your in-game actions prompt real-time Localization changes. For instance, the plumber tool adjusts its messages based on singular or plural contexts, ensuring an immersive and accurate gaming experience.
[table]
[tr]
[th]Singular[/th]
[th]Plural[/th]
[/tr]
[tr]
[td]
[img]https://clan.cloudflare.steamstatic.com/images//38913947/e63c253c61930973f88b376947a92ec01df43770.png[/img]
[/td]
[td]
[img]https://clan.cloudflare.steamstatic.com/images//38913947/d65ff9f82c4a841f6a5c4f89dc3afef27b5a958a.png[/img]
[/td]
[/tr]
[/table]
[h3]Templates[/h3]
Templates are the backbone of FOUNDRY's content - every machine, crafting recipe or item has its own template. Such templates may have translate-able variables, for instance their display name.
[img]https://clan.cloudflare.steamstatic.com/images//38913947/5750019d50cc92e63ff61fff9ebc59ba122bd753.png[/img]
[h2]Enhancing Consistency by Introducing Unique IDs[/h2]
To bolster the integrity and consistency of our Localization System, we've introduced a unique identifier for each translatable phrase. Picture these identifiers as serial numbers assigned to each snippet of text, ensuring that every translation is anchored to a stable reference point. This means that even when the English source text is altered - whether to correct a typo or to update a phrase - the corresponding translations remain reliably linked.
Here's a practical illustration of this system at work:
[table]
[tr]
[th]ID[/th]
[th]English[/th]
[th]Translation[/th]
[/tr]
[tr]
[td]WELCOME_MESSAGE [/td]
[td]Welcome to Foundry![/td]
[td] Willkommen in Foundry![/td]
[/tr]
[/table]
With this structure, we can address any textual errors without disrupting the existing translations across different languages. This new approach provides a safeguard against the common issue of 'lost' translations that occurred under our previous system when making corrections or updates to the source text.
Certain scenarios may still necessitate a reevaluation of the translation themselves though. For example, if the original English text is updated to the extent that it alters the context or meaning, the translations would need to be revisited to ensure they still convey the intended message accurately.
[h2]The Big Export: Optimizing the Translation Workflow[/h2]
In our pursuit to optimize the translation process, we have developed a specialized parser. This tool is designed to automatically generate Localization files in a format called [url=https://localizely.com/po-file/]"portable object"[/url]. This change streamlines our workflow, making it easier to update our project on [url=https://crowdin.com/project/foundry]CrowdIn[/url].
[h2]Validation: Ensuring Precision in Localization[/h2]
In the complex landscape of Localization, maintaining a clear overview of existing unique identifiers is crucial. To manage this, we've integrated a robust Validation System, designed to be a steadfast ally in the Localization process. This system automatically flags any discrepancies such as overlapping IDs or absent context comments. Here's a glimpse into the kinds of issues it helps us avoid:
[h2]Preventing Duplicate IDs from Causing Confusion[/h2]
[table]
[tr]
[th]ID[/th]
[th]Value[/th]
[/tr]
[tr]
[td]MACHINE_EMPTY[/td]
[td]Machine is empty[/td]
[/tr]
[tr]
[td]MACHINE_EMPTY[/td]
[td]Machine is currently empty[/td]
[/tr]
[/table]
Encountering duplicate IDs with different assigned values can create conflicts within the Localization System, as it relies on IDs to determine the correct text to display in-game. This scenario can lead to inconsistencies, which our Validation System is adept at identifying.
[h2]Avoiding Redundancy with Different IDs for Identical Values[/h2]
[table]
[tr]
[th]ID[/th]
[th]Value[/th]
[/tr]
[tr]
[td]MACHINE_EMPTY[/td]
[td]Machine is empty[/td]
[/tr]
[tr]
[td]SELECTED_MACHINE_EMPTY[/td]
[td]Machine is empty[/td]
[/tr]
[/table]
It's possible to inadvertently create different IDs for the same value. Our system detects such redundancies, alerting us to streamline our Localizations and prevent unnecessary complexity.
[h2]Context Comments for Clear Translation[/h2]
Context is king in translation. To aid our translators, we embed comments within each Localization call, providing them with the necessary background to deliver accurate translations. These comments are essential, especially when viewed in tools such as CrowdIn, where they guide the translation process. This is why the Validation System informs us about calls where these context comments are missing. Here is an example how these comments look in CrowdIn:
[img]https://clan.cloudflare.steamstatic.com/images//38913947/1e020e8441f01bcb4ffff0f35c91fecc22b5ef5a.png[/img]
[h2]Modding: Empowering Community Creativity[/h2]
Our new Localization System is crafted with the modding community at heart, streamlining the way modders integrate translations into their creations. This modder-centric design allows for seamless utilization of the existing Localization framework during the development phase, ensuring that mods are as language-accessible as the core game itself.
From the initial coding stages to the final touches, modders should be able to:
[list]
[*]Employ the system to handle in-game text, providing a consistent experience for mod
users.
[*]Export their content into "portable object" files, which are standardized for easy
translation management.
[*]Utilize the Validation System to preemptively catch and correct any potential issues
with duplicate IDs or missing context, which is crucial for maintaining the integrity of
the mod's Localization.
[*]Load these translations during the game's startup, making sure that no matter where a
player is from, they can enjoy mods in their native tongue.
[/list]
Our goal is a robust and accessible environment that empowers modders to share their work with a global audience, removing language barriers that could previously hinder the full enjoyment and reach their creative efforts.
[h2]In Closing[/h2]
We strive to make Localization intuitive for everyone involved - gamers, translators, and modders. Should you have any feedback or suggestions, please feel free to reach out to us on Discord.
I hope you enjoyed this little sneak peek into how we handle Localization. Thanks for
reading!
Cheers, Zirus
Follow us on socials:
[list]
[*] [url=https://discord.com/invite/eqvCtNH]Discord[/url]
[*] [url=https://twitter.com/foundry_game]Twitter [/url]
[*] [url=https://www.reddit.com/r/foundry_game/ ]Reddit [/url]
[*] [url=https://www.facebook.com/foundrygame/]Facebook [/url]
[*] [url=https://forum.paradoxplaza.com/forum/forums/foundry.1153/ ]Paradox Forum[/url]
[/list]
Stay tuned for more news!
https://store.steampowered.com/app/983870/FOUNDRY/