This document describes how i18n work in hpapp.
We support multiple languages (but mainly Japanese and English) and assets/translations.json
is a file that contains all language translations. The file represent key value pairs where the key is the English translation and the value is the translation in the target language.
{
"English content here": {
"ja": "日本語の翻訳をこちらに書く。"
}
}
Then you can use the translation supported string as follows.
import { t } from "@hpapp/i18n";
function MyComponent() {
return <Text>{t("English content here")}</Text>;
}
Note that our eslint rule (no-translation-entry) validates the translation key so that you can’t use a key that is not defined in the assets/translations.json
or you can add // eslint-disable-next-line local-rules/no-translation-entry
to the line to disable the validation.
There is no special support for timezone including daylight saving. Date
always use the system timezone so if you want to display a date in a specific timezone, you need to convert it manually.
There is no special support for currency. We expect everything is JPY.