CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/locales/README.md
Views: 791

This is a more crude i18n functionality than what we have in the frontend. To work on that, look at the lang/[locale]/index.tsx file. It uses the useTranslation hook with the "index" namespace – as of writing this, we only have one namespace.

To add messages, open the locales/en/index.json file and add more key/values.

Then, reference the key using the t('key') function in your component. To make formatted text work, use the <Trans ...> component, and prefix index: to the key for its namespcae.

Then, call the pnpm i18n:upload command, trigger the translations in simplelocalize, and once done, call pnpm i18n:download.

If strings need to be modified, delete them online to translate them fresh or call them differently.