Localazy CLI Tips: Automated language switcher

So, you have integrated Localazy CLI into your workflow, and now you can automatically upload and download localizable files. Everything is working like a charm, but you want to automate the language selector too? You can!

The metadata file 🔗

All you need to do is to tell Localazy CLI to export the so-called metadata file.

We’ve added support for metadata files in Localazy CLI 1.1.17, so be sure to keep your tools updated 😉

{
  "download": {
    "metadataFile": "languages.json",
    "files": "..."
  }
}

From that moment, when you invoke localazy download, the file languages.json will be generated with basic information about your project as well as a list of languages, including their English and localized name:

{
    "projectUrl": "<https://localazy.com/p/my-app>",
    "baseLocale": "en",
    "languages": [
        {
            "language": "ar",
            "region": "",
            "script": "",
            "isRtl": true,
            "name": "Arabic",
            "localizedName": "العربية"
        },
        {
            "language": "cs",
            "region": "",
            "script": "",
            "isRtl": false,
            "name": "Czech",
            "localizedName": "Čeština"
        },
        {
            "language": "en",
            "region": "",
            "script": "",
            "isRtl": false,
            "name": "English",
            "localizedName": "English"
        },
        {
            "language": "de",
            "region": "",
            "script": "",
            "isRtl": false,
            "name": "German",
            "localizedName": "Deutsch"
        }
    ]
}

Neat! You can load data for your language selector from this file and fully automate the localization. And you can control visible languages from Localazy! That’s the beauty of the single source of truth. 😁

You might also like 🔗

Read more Localazy CLI related articles!

Or, learn how to implement a language switcher into your Android app.

Read the article: How to create a custom language selector for Android apps

Join Localazy today

Translating apps has never been easier. Try Localazy for free.

Sign up