Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 8d9af5e

Browse files
committed
feat: add translation section to README
1 parent bb8c6e6 commit 8d9af5e

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,58 @@ openssl base64 < <my-release-key.keystore> | tr -d '\n' | tee some_signing_key.j
118118
- `SIGNING_KEY` <- the data from `<my-release-key.keystore>`
119119
3. Change the `versionCode` and `versionName` on `app/build.gradle`
120120
4. Commit and push.
121+
122+
## Translating
123+
124+
### Adding new languages or keys
125+
126+
1. In `src/i18n/` locate your desired language folder or create one if one does not exist
127+
- When creating a new language dir ensure it follows the ISO 639 2-letter standard
128+
129+
2. In this folder create a file called `translations.ts`, this is where the translation keys for your desired language will be located
130+
131+
3. Populate your translation file with a translation object where all of the keys will be located
132+
133+
If you want to add Persian/Farsi you will create a file `/src/i18n/fa/translations.ts` and poulate it with keys like so:
134+
```
135+
/src/i18n/fa/translations.ts
136+
137+
export default {
138+
Common: {
139+
continue: "ادامه"
140+
}...
141+
}
142+
```
143+
(You should compare your translations against the English language as all other languages are not the master and are likely deprecated)
144+
145+
4. Add your new translation file to the `/src/i18n/config.ts` so you can begin to see them in the app
146+
147+
```
148+
import fa from "~/i18n/fa/translations.ts"
149+
150+
export const resources: {
151+
...
152+
fa: {
153+
translations: fa
154+
}
155+
}
156+
```
157+
158+
5. Add your language to the `Language` object in `/src/utils/languages.ts`. This will allow you to select the language via the language selector in the UI. If your desired language is set as your primary language in your browser it will be selectedd automatically
159+
```
160+
export const LANGUAGE_OPTIONS: Language[] = [
161+
{
162+
value: "فارسی",
163+
shortName: "fa"
164+
},
165+
```
166+
167+
6. That's it! You should now be able to see your translation keys populating the app in your desired language. When youre ready go ahead and open a PR to have you language merged for others!
168+
169+
### Testing language keys
170+
171+
To check what keys are missing from your desired language:
172+
173+
```
174+
just i18n $lang
175+
```

0 commit comments

Comments
 (0)