Natural sounding language localization with Mozilla Fluent 1.0
Localization comes with a host of translation issues, since grammar is rarely natural sounding with one-to-one translation. Mozilla’s project Fluent focuses on creating more natural sounding localization for software UI. Fluent 1.0 is here. Learn the syntax and test out the playground.
Mozilla announced the first stable release of Fluent on April 17, 2019. In the announcement post by Staś Małolepszy, Mozilla outlines how Fluent works towards natural-sounding translations and the challenges it addresses.
According to Mozilla, the Firefox browser supports over 100 languages. This large amount of languages creates unique localization and grammar challenges that a one-to-one translation from English cannot fix.
For instance: languages with grammatical genders must also have adjectives and past participles that agree with the noun’s gender. Some languages use different plural forms, and some use different words for difference contexts. (Take the example of Japanese: It uses a different writing system for computer-related terms, since they are borrowed words.) Localization simply can’t always be as simple as one-to-one. That’s where Fluent comes in.
The Fluent Syntax Guide explains more about its syntax and how to read and write Fluent. The basic unit of translation is a message, which is a container for information. Developers can bind the message into software using its identifier.
Variables set by the app developer can change dynamically during the app’s usage. For instance, developers can set dynamic variables for unread messages, receiving likes on photos, etc.
Fluent files can be opened in any text editor, keeping the bar for entry low and simple to access. It allows for developers to write language agnostic source code for interfaces that can then translate into a wide variety of languages.
According to the Design Principles on GitHub, Fluent uses five key considerations: control and isolation, simplicity, tolerance, modularity and composability, and the principle of least power. These principles maintain that Fluent’s syntax should be declarative and easy to parse, with a simple API, a toolbox consisting of small independent modules, and good error recovery.
By keeping it simple and limiting complexities, Fluent’s syntax is easy to use and implement, while still remaining versatile.
Test it out for yourself in the playground or the interactive examples on its website. In the playground, you can edit the translations and set new variables under the config tab and get a shareable snippet link.
Find the project on GitHub here. The repo includes the specification, reference implementation of the parser, and the documentation.
How is Mozilla using this project? Keep tabs on Firefox’s implementation. Currently, according to the Mozilla Hacks blog, there are over 3,000 messages powered by Fluent in Firefox. These include the UI in Firefox Preferences and several Mozilla sites.
For community help, improvement ideas, and conversation, head to Mozilla Discourse and discuss it with fellow developers.