Docs

Supported frameworks

Polygot is still in its early stages. New framework compatibilities will be added soon. However, it is possible to integrate Polygot into a wide variety of projects due to its compatibility with JSON.

If you need a particular integration or framework compatibility, please let us know!

JSON

In order to integrate Polygot to your product, you can use JSON locale files.

Each file must contain phrases from only one language (ex: en.json for english phrases, fr.json for french phrases, ...).

Example 1 (one file per locale):

en.json
{
  "title": "My application",
  "home": {
    "header": "The best app",
    "CTA": "Start now!"
  }
}
fr.json
{
  "title": "Mon application",
  "home": {
    "header": "La meilleure application",
    "CTA": "Commencez maintenant!"
  }
}

Example 2 (one directory per locale):

en/common.json
{
  "title": "My application"
}
en/home.json
{
  "header": "The best app",
  "CTA": "Start now!"
}
fr/common.json
{
  "title": "Mon application"
}
fr/home.json
{
  "header": "La meilleure application",
  "CTA": "Commencez maintenant!"
}

JavaScript

Polygot supports JavaScript locale files, if they follow a specific format. Using JavaScript files can be interesting in particular to be able to easily import them into another JavaScript file.

Using JavaScript files will also allow you to add comments to your phrases. These comments will be retained when pulling the source or translated files.

Polygot supports both CommonJS and ESM formats, provided that you use the format as shown below:

CommonJS
module.exports = {
  "title": "My application",
  "home": {
    // You can use comments within the exported object
    "header": "The best app",
    "CTA": "Start now!"
  }
}
ES modules
export default {
  "title": "My application",
  "home": {
    // You can use comments within the exported object
    "header": "The best app",
    "CTA": "Start now!"
  }
}

Frameworks

Here is a non-exhaustive list of frameworks and libraries compatible with Polygot. Generally speaking, Polygot will easily integrate with your programming language/library/custom tool if you use JSON files to store your locales.

Table of Contents