Developing Amica
Once you've set up your developer environment, you're ready to hack on Amica!
Tests
Unit tests are run using jest
via npm run test
from the __tests__
directory. To run a specific test, you can pass the path of the test:
ARM64 compatibility
On ARM64 platforms (like Mac machines with M1 chips) the npm run test
command may fail with the following error:
In order to fix it, the terminal must be running in the Rosetta mode, the detailed instructions can be found in this SO answer.
The Development Workflow for Translations
The translation uses the react-i18next framework.
Apply Text to Translate
In React Component/Page
useTranslation (react hook):
In Common Function
Updating Language Files with New Translations
Execute the npm run i18n
command in order to incorporate updated translations into the language files.
The language JSON files are located within the src/i18n/locales/
directory.
Add a new language
If you wish to add a new language:
First include its corresponding ISO 639-1 language code within the
i18next-parser.config.mjs
file:locales: ['en', 'zh', 'de']
.Add the new language into the
src/i18n/langs.ts
file.Run
npm run i18n
, the corresponding language files will be automatically created in the 'src/i8n/locales/
' directory.
Last updated