Skip to content

Commit

Permalink
Merge pull request #121 from mrf345/testing
Browse files Browse the repository at this point in the history
Add localization documentation.
  • Loading branch information
mrf345 authored Jun 4, 2020
2 parents d761b8d + 6b1672a commit 7f674f9
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ Since the `0.7` release we're able to migrate the data generated in previous rel
**Make sure the migration steps are performed prior to running the new release of the system**.

### Documentation:
You can find a useful and a very outdated 😓 user guide [here](https://fqms.github.io/images/user_guide.pdf).
- [Useful and very outdated 😓 user guide](https://fqms.github.io/images/user_guide.pdf).
- [How do i add support for my language ?](docs/localization.md)


<br />
Expand Down
125 changes: 125 additions & 0 deletions docs/localization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
## How do i add support for my language ?

#### User interface localization:
The localization texts are generated and cached within a large `.json` object, that can be modified manually
to add support to additional languages. Let's take an example of adding support to German language:

1. You'll have to get the short-code for your language, in this case it will be `de` for german. if you're not sure checkout this [list of codes](https://www.loc.gov/standards/iso639-2/php/code_list.php).
2. You'll add the short-code as a key and the translation as a value to every object in `gt_cached.json` [here](https://github.com/mrf345/FQM/blob/master/gt_cached.json). Let's take one translation object as an example:

> Before adding German translation
```json
"Administrators": {
"ar": "\u0627\u0644\u0645\u0633\u0624\u0648\u0644\u064a\u0646",
"en": "Administrators",
"es": "Administradores",
"fr": "Administrateurs",
"it": "Amministratori"
},
```

> After adding German translation
```json
"Administrators": {
"ar": "\u0627\u0644\u0645\u0633\u0624\u0648\u0644\u064a\u0646",
"en": "Administrators",
"es": "Administradores",
"fr": "Administrateurs",
"it": "Amministratori",
"de": "Administratoren"
},
```

3. The final step is to add it to the list of supported languages in `app/constants.py` [here](https://github.com/mrf345/FQM/blob/master/app/constants.py#L4-L11):

> Before adding German language
```python
SUPPORTED_LANGUAGES = {
# NOTE: The officially supported languages.
'en': 'English',
'ar': 'Arabic',
'fr': 'French',
'it': 'Italian',
'es': 'Spanish'
}
```

> After adding German language
```python
SUPPORTED_LANGUAGES = {
# NOTE: The officially supported languages.
'en': 'English',
'ar': 'Arabic',
'fr': 'French',
'it': 'Italian',
'es': 'Spanish',
'de': 'German',
}
```


#### Text-to-speech localization:
The text-to-speech supported languages and announcement messages are stored in `statics/tts.json` [here](https://github.com/mrf345/FQM/blob/master/static/tts.json).
Let's take adding support to German text-to-speech announcements as an example:

1. You'll have to get the short-code for your language, in this case it will be `de` for german. if you're not sure checkout this [list of codes](https://www.loc.gov/standards/iso639-2/php/code_list.php).
2. You'll add the short-code as a key in this case `de` and an object containing the language name and announcement message as a value. Example:

> Before adding german language announcement
```json
{
"en-us": {
"language": "English",
"message": " , please proceed to the {} number : "
},
"ar": {
"language": "Arabic",
"message": " : توجه إلى المكتب رقم "
},
"fr": {
"language": "French",
"message": ", s'il vous plaît procéder au numéro de bureau : "
},
"es": {
"language": "Spanish",
"message": " , por favor diríjase al número de la oficina : "
},
"it": {
"language": "Italian",
"message": " , si prega di procedere al numero dell'ufficio : "
}
}
```

> After adding german language announcement
```json
{
"en-us": {
"language": "English",
"message": " , please proceed to the {} number : "
},
"ar": {
"language": "Arabic",
"message": " : توجه إلى المكتب رقم "
},
"fr": {
"language": "French",
"message": ", s'il vous plaît procéder au numéro de bureau : "
},
"es": {
"language": "Spanish",
"message": " , por favor diríjase al número de la oficina : "
},
"it": {
"language": "Italian",
"message": " , si prega di procedere al numero dell'ufficio : "
},
"de": {
"language": "German",
"message": "Bitte fahren Sie mit der Büronummer fort"
},
}
```


#### TODO: Printer localization

0 comments on commit 7f674f9

Please sign in to comment.