Interface Translations
Add a New Language to Remark42
Translation files are stored in the /backend/app/webassets/assets
directory, one <code>.json file per language, with content like the following. The server embeds them and serves them under /web/, and the widget fetches the one for its locale:
{
"auth.back": "Back",
"auth.email-address": "Email address",
"auth.loading": "Loading...",
<...>
}
en.json is different from the other files: the widget never loads it. The English text lives in
the widget's code, and node ./tasks/generateDictionary.js copies it into en.json, which serves as the
reference that every other file translates. To change an English message, change it in the code
and run the extraction and generation steps below; an edit made only in en.json
does not reach the page, and CI fails until the file and the code agree again.
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.
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 pushAdd the code of the language you want to translate into, normally its two-letter ISO 639-1 code, to the list in frontend/apps/remark42/tasks/supportedLocales.json
Run
node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON ./tasks/extract-messages.tsin thefrontend/apps/remark42folder. It needs Node 26 or newer and no installed packages. It stops when a message inen.jsonis no longer in the code; if you removed that message on purpose, add--allow-removalRun
node ./tasks/generateDictionary.jsin thefrontend/apps/remark42folderTranslate all values in the newly created JSON file in
backend/app/webassets/assets/Run
node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON ./tasks/extract-messages.ts && node ./tasks/checkTranslation.jsinfrontend/apps/remark42to validate the translation keys, tags and placeholdersUpdate the documented locale list with the language name and code
Commit all changes above in your fork
Test your changes in the interface:
Uncomment
locale: "ru"line in backend/app/webassets/assets/index.html
and replaceruwith your translation language code. That single change is enough for
both the translated text and, if you added the code toRTL_LOCALESabove, the mirrored
layout — the widget determines left-to-right or right-to-left automatically from the
locale, so nothing else needs configuring to preview either.Start the backend from the root directory of your fork:
docker compose -f compose-dev-frontend.yml up --buildStart the frontend in another terminal:
cd frontend/apps/remark42 go -C ../../build run . -serveOpen http://127.0.0.1:9000/web/, log in, make a comment, make a reply to a comment, and check your translation
Take a screenshot of that page with your translation in place
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