days
-9
-7
hours
0
-1
minutes
-1
-4
seconds
-3
-6
search
Sounding like a native speaker

Natural sounding language localization with Mozilla Fluent 1.0

Sarah Schlothauer
fluent
© Shutterstock / meeting

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.

Any bilingual Internet user knows that interfaces often struggle when it comes to localization. Languages with dissimilar grammar or gendered nouns are often impossible to translate word by word and one-to-one. Mozilla’s Fluent project focuses on overcoming the challenges of localization using JavaScript, Python, and Rust.

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.

Localization 1.0

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.

SEE ALSO: Mozilla combines Python and JavaScript to create interactive data science in your browser

Fluent allows for more natural sounding translation. It is “a formal specification of the file format for storing translations, accompanied by beta releases of parser implementations of JavaScript, Python, and Rust”.

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.

Using Fluent to translate Czech. Source.

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.

Becoming Fluent

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.

fluent

An example of input

SEE ALSO: Take your JavaScript learning beyond the classroom with these fun tools!

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.

Author
Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is an assistant editor for JAXenter.com. She received her Bachelor's degree from Monmouth University and is currently enrolled at Goethe University in Frankfurt, Germany where she is working on her Masters. She lives in Frankfurt with her husband and cat.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of