To allow you fully automatize the localization of your mobile, desktop or web app, Localazy can generate useful metadata files.

It contains basic information about the project and the list of languages, their English and localized names, information about language, region and script. For selected formats, expressions for calculating correct plural types are included.

You can use metadata files to:

  • show language selector for users
  • automatically determine the best language to use
  • navigate uses to your project on Localazy to help you with translating it
  • use correct plural forms without including 3rd party libraries
  • and more…

Generating metadata file #️⃣

You can generate metadata file by including metadataFileJson, metadataFileJs and/or metadataFileTs in the download section of your localazy.json file.

{
    "download": {
      "metadataFileJson": "languages.json",
      "metadataFileJs": "languages.js",
      "metadataFileTs": "languages.ts"
    }
}

You can include all of the above to generate all variants.

JSON format #️⃣

The metadata file in JSON format is generated to the file specified by metadataFileJson. This format doesn’t include plural type expression.

{
    "projectUrl": "https://localazy.com/p/...",
    "baseLocale": "en",
    "languages": [
        {
            "language": "ko",
            "region": "",
            "script": "",
            "isRtl": false,
            "name": "Korean",
            "localizedName": "한국어"
        },
        {
            "language": "de",
            "region": "",
            "script": "",
            "isRtl": false,
            "name": "German",
            "localizedName": "Deutsch"
        },
        {
            "language": "sk",
            "region": "",
            "script": "",
            "isRtl": false,
            "name": "Slovak",
            "localizedName": "Slovenčina"
        },

        // ...

    ],
    "files": [
      {
        "cdnHash": "14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7",
        "file": "idioms.json",
        "path": "",
        "library": "",
        "module": "",
        "buildType": "",
        "productFlavors": [],
        "cdnFiles": {
          "ar": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/ar/idioms.json",
          "cs": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/cs/idioms.json",
          "de": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/de/idioms.json",
          "en": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/en/idioms.json",
          "es": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/es/idioms.json",
          "fi": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/fi/idioms.json",
          "it": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/it/idioms.json",
          "ko": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/ko/idioms.json",
          "pl": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/pl/idioms.json",
          "ru": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/ru/idioms.json"
        }
      },
      // ...
    ]
}

Javascript format #️⃣

The metadata file in Javascript format is generated to the file specified by metadataFileJs. It’s a Javascript module, and you can include it out-of-the-box to your code.

It comes with an expression for determining the correct plural type.

const localazyMetadata = {
  projectUrl: "http://localhost:9091/p/floating-apps-2",
  baseLocale: "en",
  languages: [
    {
      language: "ko",
      region: "",
      script: "",
      isRtl: false,
      name: "Korean",
      localizedName: "한국어",
      pluralType: (n) => { return "other"; }
    },
    {
      language: "de",
      region: "",
      script: "",
      isRtl: false,
      name: "German",
      localizedName: "Deutsch",
      pluralType: (n) => { return (n===1) ? "one" : "other"; }
    },
    {
      language: "sk",
      region: "",
      script: "",
      isRtl: false,
      name: "Slovak",
      localizedName: "Slovenčina",
      pluralType: (n) => { return (n===1) ? "one" : (n>=2 && n<=4) ? "few" : "other"; }
    }
  ],
  "files": [
    {
      cdnHash: "14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7",
      file: "idioms.json",
      path: "",
      library: "",
      module: "",
      buildType: "",
      productFlavors: [],
      cdnFiles: {
        "ar": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/ar/idioms.json",
        "cs": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/cs/idioms.json",
        "de": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/de/idioms.json",
        "en": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/en/idioms.json",
        "es": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/es/idioms.json",
        "fi": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/fi/idioms.json",
        "it": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/it/idioms.json",
        "ko": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/ko/idioms.json",
        "pl": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/pl/idioms.json",
        "ru": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/ru/idioms.json"
      }
    },
    // ...
  ]  
};

export default localazyMetadata;

Typescript format #️⃣

The metadata file in Typescript format is generated to the file specified by metadataFileTs. It’s a Typescript module, and you can include it out-of-the-box to your code.

It contains information about types and comes with an expression for determining the correct plural type.

export type LocalazyLanguage = {
    language: string;
    region: string;
    script: string;
    isRtl: boolean;
    localizedName: string;
    name: string;
    pluralType: (n: number) => "zero" | "one" | "two" | "many" | "few" | "other";
};
 
export type LocalazyFile = {
    cdnHash: string;
    file: string;
    path: string;
    library: string;
    module: string;
    buildType: string;
    productFlavors: string[];
    cdnFiles: { [lang:string]: string };
};
 
export type LocalazyMetadata = {
    projectUrl: string;
    baseLocale: string;
    languages: LocalazyLanguage[];
    files: LocalazyFile[];
};
     
const localazyMetadata: LocalazyMetadata = {
  projectUrl: "http://localhost:9091/p/floating-apps-2",
  baseLocale: "en",
  languages: [
    {
      language: "ko",
      region: "",
      script: "",
      isRtl: false,
      name: "Korean",
      localizedName: "한국어",
      pluralType: (n) => { return "other"; }
    },
    {
      language: "de",
      region: "",
      script: "",
      isRtl: false,
      name: "German",
      localizedName: "Deutsch",
      pluralType: (n) => { return (n===1) ? "one" : "other"; }
    },
    {
      language: "sk",
      region: "",
      script: "",
      isRtl: false,
      name: "Slovak",
      localizedName: "Slovenčina",
      pluralType: (n) => { return (n===1) ? "one" : (n>=2 && n<=4) ? "few" : "other"; }
    }
  ],
  "files": [
    {
      cdnHash: "14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7",
      file: "idioms.json",
      path: "",
      library: "",
      module: "",
      buildType: "",
      productFlavors: [],
      cdnFiles: {
        "ar": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/ar/idioms.json",
        "cs": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/cs/idioms.json",
        "de": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/de/idioms.json",
        "en": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/en/idioms.json",
        "es": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/es/idioms.json",
        "fi": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/fi/idioms.json",
        "it": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/it/idioms.json",
        "ko": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/ko/idioms.json",
        "pl": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/pl/idioms.json",
        "ru": "https://delivery.localazy.com/_a823899401821771352260639a85/_e0/14d4ba1asdf45df4c48cc3cb140bb64dd20a3271338a7/ru/idioms.json"
      }
    },    
  ]    
};
 
export default localazyMetadata;