completion

This commit is contained in:
2025-08-06 13:49:11 +08:00
commit c2d7317897
684 changed files with 92987 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
## Localization Rules
1. Files is separated by categories. __DO NOT__ just stuff everything in `common`. See below.
2. Include punctuations in the json. Duplicates are ok if necessary. For example:
```
{
"Friends": "Friends",
"friends": "friends",
"signOut?": "Sign out?",
"signout": "Sign out"
}
```
3. When creating files in `en`, create the same files in the other language also, even if its an empty object.
__DO NOT__ give an empty string, empty string does not fallback to `en`
4. __DO NOT__ have more that 1 first level key in the json file, because it is used in the script for importing the texts as filename.
5. __DO NOT__ fill other language files with english. Just leave the field blank, so that the translators know which one to translate.
6. Check if your text available or not before you add new text.
7. The key of your text should be related to the content, not to the component using it. This will help preventing duplicates.
8. __BE CAREFUL__ when changing the existing key, check for all occurrence of previous key.
### IMPORTANT
__NEVER__ do something like this:
```
i18n.t('common.friend').toLowerCase().concat('s')
```
Firstly, its the wrong category, should be `friends`.
Secondly, not all plural ends with `s` or `es`. For example, friend and friends:
- German: `Freund` and `Freunde`
- Chinese Simplified: `朋友` and `朋友们`
Thirdly, `toLowerCase` is tolerable, but better not, because same as the reason above, you cannot guarantee all language follow the same rules.
### Categories:
1. Common:
anything that you cannot guess the category when you read it
2. Users:
- first / last name
- email
- username
- password
- country
- accounts
- tnc / privacy
3. Contents:
- photo
- video
- item
- caption
- upload
- download
4. Albums
5. Playlists
6. Frames
7. Friends
#### Exception:
- Frame Settings
## Updating languages copy
`babel-node` is a command that comes with `@babel/node`
```
npm i -g @babel/core @babel/node
```
### Exporting
Output folder will be the folder where you run the command
```
babel-node src/locale/export-to-csv.js
```
### Importing
```
babel-node src/locale/import-from-csv.js ./path/to/csv/lang.csv ./path/to/locale/folder
# example: babel-node src/locale/import-from-csv.js language.csv src/locale/lang/
```