Define new language: Difference between revisions

From ARIS
Jump to navigation Jump to search
David (talk | contribs)
No edit summary
Alberto (talk | contribs)
No edit summary
 
(27 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Category:ARIS:Define new language]]
[[Category:Define new language]]
<languages/>
<translate>
<!--T:1-->
In this section you will find the information that will help you to add new languages to the ARIS application.


In this section you will find the information about the multilanguage system, this will help you to add new languages to the ARIS application.
<!--T:9-->
__TOC__


==Introducction==
==Introducction== <!--T:2-->
The multilanguage system is composed by five main files: ''langContext.js'', ''index.js'', ''NavBar.js'', ''languageList.json'', language json files. You will find these files in the FrontEnd folder in ARIS system files.
The multilanguage system of ARIS is implemented through some files, but to add a new language you will only need to know about two of them: ''languageList.json'' and the language JSON files.  
You will find these files in the ''lang'' folder in ARIS system files (under "C:\Users\Public\ARIS\Frontend\build" by default in MSWindows).


===langConext.js===
===''languageList.json''=== <!--T:3-->
In this file you will find a provider component ''LangProvider'' that will wraps the app's main component tree, providing language switching functionality using ''react-intl''. This component sets up two pieces of state using ''useState'':
This file contains a list of all the languages ​​that the multilanguage system of the ARIS application can handle. All the languages ​​it contains will appear in the dropdown menu on the ARIS navigation bar.
[[File:LanguageList.PNG|none|400px|thumb| ''languageList.json'']]


· '''messages:''' a state variable that holds the current language messages. This is initially set to the default language messages.
===Language JSON files=== <!--T:4-->
By default, the ARIS system contains language JSON files that correspond to the Spanish, Portuguese, and English languages.
These files contain all the translations of the messages displayed in ARIS interface, following a JSON structure where the key has to be the same in all the language files, you can see the example in the images below.
[[File:EnJson.png|none|400px|thumb| English JSON file]]
[[File:EsJson.png|none|400px|thumb| Spanish JSON file. Notice that the keys for the same words are the same as in both files]]


· '''locale:''' a state variable that holds the current locale code. This is initially set to the default locale code for English language (en-GB).
==How to add a new language?== <!--T:5-->
Thanks to how the multilanguage system is implemented, in order to add a new language not provided by default in the distribution, you only have to follow two simple steps that we explain below.


Also this file contains a function called ''establishLanguage'', which takes in a language label as a parameter. This function is responsible for loading the corresponding language messages based on the selected language label.
<!--T:6-->
· '''Step 1:''' Add a new language JSON file. Remember that it must follow the same structure as the files for other languages, so they must all contain the same keys. We recommend naming the new files as the [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes ISO 639-1] code of the new language.


===index.js===
<!--T:7-->
Within this file the ''LangProvide'' defined in the ''langContext.js'' file, wraps the application to allow the language switching functionality to work on the system.
· '''Step 2:''' Add the new language to the ''languageList.json'' file just as the other languages already listed.
  ''{"fileName": "NewLanguageCode", "label": "NewLanguageName"},''


===NavBar.js===
<!--T:8-->
In this file you will find the dropdown menu where you can visually select the different languages. The menu takes all the languages that the ''languageList.json'' file contains.
You don't have to worry about modifying any other file, if you have followed the above two steps you have successfully added a new language to the ARIS system, that will automatically be added to the Language in the [[User Guide#Navigation bar|Navigation bar]].
 
</translate>
===languageList.json===
This file contains all the languages ​​that the multilanguage system of the ARIS application can handle. All the languages ​​it contains will appear in the dropdown menu on the app's navigation bar.
 
===Language json files===
By default, the ARIS system contains language json files that correspond to the Spanish and English languages. These files contain all the translations of the ARIS application, they follow a json structure where the key has to be the same in all the language files, you can see the example in the images below.
[[File:EnJson.png|none|400px|thumb| English json file]]
[[File:EsJson.png|none|400px|thumb| Spanish json file. Notice that the keys for the same words are the same as in the English file]]
 
==How to add a new language?==
Now that we briefly know how the multilanguage system works, it is time to know how to add a new language. Thanks to this system you only have to follow two simple steps that we explain below.
 
· '''Step 1:''' Add a new language json file. Remember that it must follow the same structure as the files for other languages, so they must all contain the same keys. We recommend naming the new files as the ''ISO 639-1'' code of the new language.
 
· '''Step 2:''' Add the new language to the ''languageList.json'' file just as the other languages ​​are added.
 
You don't have to worry about modifying other files, if you have followed the above two steps you have successfully added a new language to the ARIS system.

Latest revision as of 17:42, 8 January 2026

In this section you will find the information that will help you to add new languages to the ARIS application.

Introducction[edit]

The multilanguage system of ARIS is implemented through some files, but to add a new language you will only need to know about two of them: languageList.json and the language JSON files. You will find these files in the lang folder in ARIS system files (under "C:\Users\Public\ARIS\Frontend\build" by default in MSWindows).

languageList.json[edit]

This file contains a list of all the languages ​​that the multilanguage system of the ARIS application can handle. All the languages ​​it contains will appear in the dropdown menu on the ARIS navigation bar.

languageList.json

Language JSON files[edit]

By default, the ARIS system contains language JSON files that correspond to the Spanish, Portuguese, and English languages. These files contain all the translations of the messages displayed in ARIS interface, following a JSON structure where the key has to be the same in all the language files, you can see the example in the images below.

English JSON file
Spanish JSON file. Notice that the keys for the same words are the same as in both files

How to add a new language?[edit]

Thanks to how the multilanguage system is implemented, in order to add a new language not provided by default in the distribution, you only have to follow two simple steps that we explain below.

· Step 1: Add a new language JSON file. Remember that it must follow the same structure as the files for other languages, so they must all contain the same keys. We recommend naming the new files as the ISO 639-1 code of the new language.
· Step 2: Add the new language to the languageList.json file just as the other languages already listed.
 {"fileName": "NewLanguageCode", "label": "NewLanguageName"},

You don't have to worry about modifying any other file, if you have followed the above two steps you have successfully added a new language to the ARIS system, that will automatically be added to the Language in the Navigation bar.