Interface Translations

Add a New Language to Remark42

Translation files are stored in /frontend/apps/remark42/app/locales
directory with .json extension and content like following:

{
  "anonymousLoginForm.length-limit": "Username must be at least 3 characters long",
  "anonymousLoginForm.log-in": "Log in",
  "anonymousLoginForm.symbol-limit": "Username must start from the letter and contain only Latin letters, numbers, underscores, and spaces",
  <...>
}

Add a new translation

We truly appreciate people spending time contributing their translations to remark42. Please go through the steps
below to have your translation available to all remark42 users and included in the next release.

  1. Create a fork of umputun/remark42 repo, and if you already have one, please pull the latest changes from the upstream master branch. It could be done like that:

    git remote add upstream https://github.com/umputun/remark42.git
    git fetch upstream
    git rebase upstream/master
    git push
    
  2. Add a new locale with a two-letter code of the language you want to do the translation into to list in frontend/apps/remark42/tasks/supportedLocales.json

  3. Run pnpm i in the frontend/apps/remark42 folder

  4. Run pnpm translation:extract in the frontend/apps/remark42 folder

  5. Run pnpm translation:generate in the frontend/apps/remark42 folder

  6. Translate all values in the newly created JSON file in
    frontend/apps/remark42/app/locales/

  7. Run pnpm translation-check in frontend/apps/remark42 to validate the translation keys, tags and placeholders

  8. Update the documented locale list with the language name and code

  9. Commit all changes above in your fork, including the generated app/utils/loadLocale.ts

  10. Test your changes in the interface:

    1. Uncomment locale: "ru" line in frontend/apps/remark42/templates/demo.ejs and replace ru with your translation language code

    2. Start the backend from the root directory of your fork:

      docker compose -f compose-dev-frontend.yml up --build
      
    3. Start the frontend in another terminal:

      cd frontend/apps/remark42
      pnpm dev
      
    4. Open http://127.0.0.1:9000/web/, log in, make a comment, make a reply to a comment, and check your translation

    5. Take a screenshot of that page with your translation in place

  11. after all previous steps are done, create a Pull Request to umputun/remark42 repo with your changes, attaching a screenshot or two from your local test instance to it