Prismy allows you to configure which localization files to sync by simply adding a prismy.json file at the root of your repository. This configuration file lets you define the main branch, primary language, and the specific files you want to synchronize.

Example Configurations

Nested JSON Format with Alphabetical Sorting

{
  "mainBranch": "main",
  "mainLanguage": "en-US",
  "filesToSync": [
    {
      "sort": "alphabetical-order", // "alphabetical-order" | "not-sorted"
      "format": "nested-json", // "flat-json" | "nested-json"
      "i18nLib": "next-intl", // "i18next" | "polyglotjs" | any other i18n lib
      "files": {
        "en-US": ["lib/i18n/messages/en/*"],
        "fr-FR": ["lib/i18n/messages/fr/*"]
      }
    }
  ]
}

Flat JSON Format Without Sorting

{
  "mainBranch": "main",
  "mainLanguage": "en-US",
  "filesToSync": [
    {
      "sort": "not-sorted", // "alphabetical-order" | "not-sorted"
      "format": "flat-json", // "flat-json" | "nested-json"
      "files": {
        "en-US": ["lib/i18n/home/en.json", "lib/i18n/settings/en.json"],
        "fr-FR": ["lib/i18n/messages/fr.json", "lib/i18n/settings/fr.json"]
      }
    }
  ]
}

Configuration Options

  • mainBranch: The default branch for Prismy - can be your staging or preprod branch.
  • mainLanguage: The default source language for translations.
  • filesToSync: An array defining which files to sync, with options for sorting and format.
    • sort: Defines how keys within the files are organized (alphabetical-order or not-sorted).
    • format: Specifies whether the JSON files are flat-json (single-level key-value pairs) or nested-json (hierarchical structure).
    • i18nLib Defines the lib you are using, useful for Prismy to handle the pluralisation properly for instance. Should be “i18next”, “polyglotjs”, “react-intl” or any other lib you are using
    • files: A mapping of language codes to file paths that should be included in synchronization.