Skip to content

Commit

Permalink
Translations instructions (#112)
Browse files Browse the repository at this point in the history
* Create pt-PT.yaml

* Update pt-PT.yaml

-Removed trailing space on L:137

* Added Portuguese label+value to config-field-values

* Update config.json

* Revert "Update config.json"

This reverts commit 9705072.

* Revert "Added Portuguese label+value to config-field-values"

This reverts commit 941b329.

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Moved translating instructions to doc/FEATURES.md

- Left a link in CONTRIBUTING.md to the FEATURES.md file (doc/FEATURES.md)

- Changing FEATURES.md to include the detailed instructions

* Update CONTRIBUTING.md

* Update FEATURES.md

* Update FEATURES.md

* changed features.md

* Update FEATURES.md

* Update FEATURES.md

* oops - Reverting instructions to CONTRIBUTING

* Update FEATURES.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Added missing 'Navigation' line.

!! The word 'Electric' still displays in French.

* Update CONTRIBUTING.md
  • Loading branch information
codingh2 authored Mar 10, 2022
1 parent 35e6e32 commit 4de93a2
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 8 deletions.
105 changes: 105 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,108 @@ Example of the `maps_map_tilesVersion` entry after editing:
]
}
````
### Translations

You can help translating the application by following these steps.


- 1 Create a file at `src/translations` and name it to the disired [BCP 47 Code](https://www.techonthenet.com/js/language_tags.php), appended with the `.yaml` extension.
Example for `de-DE` (German Germany): `de-DE.yaml`

- 2 Open the new file with a text editor and copy the contents of another translation file into your new file, using [fr-FR.yaml](https://github.com/JAGFx/ets2-dashboard-skin/blob/master/src/translations/fr-FR.yaml) located at `src/translations/fr-FR.yaml` for example.

- 3 Translate all keys, by changing the values to the desired language.

Example:
`Key : Value`
````
Delivered !: Geliefert !
Config : Konfigurationen
````
- 3.1 Add a new line at the end of the file with the language translated.
Example:
`German : Deutsch`

> Note: *Do not leave trailing spaces` ` and try to respect punctuation marks*.
- 4 Save your file and place the file inside the `src/translations/` folder.

- 5 Open your local copy of [doc\TRANSLATION_CHANGESmd](TRANSLATION_CHANGES.md).
At the top, after `# Translation changes`, you will find the version number, like `## From 1.7.1`.
Add a new line below `### Added` containing the name of the new language.
Example:
````
### Added
- German
````

- 6 Edit the file [src/data/config-field-values.json](https://github.com/JAGFx/ets2-dashboard-skin/blob/master/src/data/config-field-values.json) and scroll down or find the section `"general_skin_locale"`.

Append the `label` and `value` sub-section, given that **label** is the language name and **value** is the BCP 47 Code.
It should look like this, at the end of the section:

````json
"general_skin_locale" : [

{
"label" : "Russian",
"value" : "ru-RU"
},
{
"label" : "German",
"value" : "de-DE"
}
]
````

- 7 Edit the file [src/utils/_i18n.js](https://github.com/JAGFx/ets2-dashboard-skin/blob/master/src/utils/_i18n.js)

- 7.1 Insert in a new line
````js
import de_de from '@/translations/de-DE.yaml';
````
after the lines
````js
import fr_fr from '@/translations/fr-FR.yaml';
import cn_cn from '@/translations/cn-CN.yaml';
import ru_ru from '@/translations/ru-RU.yaml';
````

- 7.2 Edit the values at `const availableLocale =` and add the new values to the array.
As such:
````js
const availableLocale = ['fr-FR', 'en-EN', 'cn-CN', 'ru-RU', 'pt-PT', 'de-DE'];
````

- 7.3 Insert a new case at `const currentLocaleTranslations =` before the `default:` line.
````js
case 'pt-PT':
return pt_pt;
case 'de-DE':
return de_de;
default:
return {};
````

- 8 Save every change and test the translation by editing the file `lib/config/config.json` and replacing the values in
`"general_skin_locale" : "en-EN",` to the desired locale code.
Example: `"general_skin_locale" : "de-DE",`

- 8.1 Launch the dashboard development server with `$ npm run dashboard:dev`, as described above in [Useful commands](#useful-commands)
- 8.2 Open your browser and navigate to one of the url's provided by the server.
````
- Local: http://localhost:8080/
- Network: http://192.168.1.65:8080/
````
> If you get a message saying `Unable to Launch`, create a `.env.local` file as described [here](#environment-file). This will let you launch the app without the game running, for testing purposes.
- 9 Create a pull request by following this link: [JAGFx ETS2 Pulls](https://github.com/JAGFx/ets2-dashboard-skin/pulls) and click on **New Pull Request**

- If you are having issues or don't know how to edit any file, you can ask for help or just edit the sample [fr-FR.yaml](src/translations/fr-FR.yaml) file and send your translation via [Discord](https://discord.gg/qYsFaMUR67). Some members may be able to help filling in the rest of the requirements.

- More information about how to do a pull request can be found here [Github - Creating a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)


### Next release

12 changes: 5 additions & 7 deletions doc/FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,15 @@ Currently, these locales are available:

### Add a new language

The translations files was stored in `src/translations/` folder.

All translations files are in YAML format. The key is the English version and the value is your locale.
The translations files are stored inside the `src/translations/` folder.

All translations files are in YAML format. The key is the English version and the value is your locale.
The format for the file contents is: `key : value`, being `key` in English and `value` the translated equivalent.
If you want to contribute and add a new language:

- Check changes in [TRANSLATION_CHANGES.md](TRANSLATION_CHANGES.md)
- Get the base file `src/translations/fr-FR.yaml`
- Translate all values
- Rename your file with the locale code like `fr_FR.yaml` and place on the `src/translations/` folder
- Create a pull request
- Get the base file `src/translations/fr-FR.yaml`
- Follow the instruction provided in [CONTRIBUTING.md](../CONTRIBUTING.md#translations)


---
Expand Down
3 changes: 2 additions & 1 deletion src/translations/pt-PT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,5 @@ Russian: Russo
Port: Porta
Port used by the server: Porta utilizada pelo servidor
ets2.jagfx.fr (Deprecated): ets2.jagfx.fr (Descontinuado)
Last waiting time to drive: Último tempo de espera para dirigir
Last waiting time to drive: Último tempo de espera para dirigir
Navigation: Navegação

0 comments on commit 4de93a2

Please sign in to comment.