Over the past few weekends, I created Fluent AI. It’s a tool that lets you edit your Project Fluent localization files. It also uses OpenAI to translate language strings for you. This can save a lot of work and cost in a project, as translators are expensive and updating localization files can be a chore. You can translate your entire app to a new language in minutes with this tool.
Project Fluent
There are several file formats that you can use to write localization files. Project Fluent came out of Mozilla, and it’s a nice file format that is easy to work with. It offers a few useful features, such as the ability to use variables and conditional logic.
We chose Project Fluent a few years ago at FORMATION and built our own multiplatform Kotlin library to use it anywhere. So far, we like it. We now have over a thousand language strings, and the number grows every week. We only support a few languages, and our library falls back to English for missing translations. With Fluent AI, we can add more translations at a very low cost.
Here’s an example of a German translation that we have:
codescanning-connect-code-to = { $case ->
*[masculine] Verknüpfe einen QR-Code mit diesem {$objectType}
[feminine] Verknüpfe einen QR-Code mit dieser {$objectType}
[other] Verknüpfe einen QR-Code mit diesem {$objectType}
This makes use of the gender in the
case
variable to correctly produce
a German gender depending on the value of the
objectType
variable.
Usage
Using Fluent AI is very simple. It’s a web
application, so there is no installation
process. Open the app, go to the file manager,
and drag in some FTL files. It will edit
anything that has language IDs and strings
separated by an =
.
Once your files are loaded, it detects the
language based on the file name. It looks for a
master translation used for AI translations. You
can configure that in the settings. This
defaults to en-US
. This is also
where you set up your OpenAI API key. If you
haven’t got one yet, I recommend getting one.
Currently, the model is hardcoded to GPT-4, so
you may need a paid account for this.
After configuring and loading your files, you can browse and edit translation strings with the editor. This shows all the translations side by side for a given translation ID. It also groups things by prefix and shows you how many missing translations each ID has.
Then, you can either translate each of the missing translations one by one (with or without OpenAI), or you can go to the file manager and translate all missing strings in one go. You can also add new files here and then use OpenAI to add all the translations.
Organizing your Fluent files
This tool is a bit opinionated. Our manually edited localization files are a bit of a mess. And because they are so large it’s hard to find things.
Fluent AI fixes this by:
- sorting all your translations by id
- grouping them by prefix
- removing translations that are the same as the master language
- it will move and preserve comments along with the translation
Limitations:
- if the first language string gets sorted to below, any comments you had at the top move along
- same for groups of prefixes
This can’t be helped. Fix it manually after it’s been sorted and you should be fine.
Some things you can do
- Prepare for international Pirate Day by
adding
en-pirate.ftl
. Arrr! Of course Fluent AI already has that - Add Klingon, Elvish and other fictional languages.
Start localizing your app now
Go to Fluent-AI and add your ftl files. Fluent AI is free and open source and you can find it on Github. If you like Fluent AI, please star it.