Version at: 26/07/2015, 13:01 vs. version at: 26/07/2015, 13:25
11# Adding a New Language to the Corpus (for Developers)
22
3There are basically 3 steps to add a new language in Tatoeba:
3There are basically 4 steps to add a new language in Tatoeba:
44
551. Add the language in LanguagesLib. This is needed to make the language available in the various dropdown lists, so that one can to add/translate sentences in the new language.
662. Add the language icon. This is needed to display the language icon that is displayed next to every sentence.
773. Update the languages table in the database. This is needed for the statistics page, that lists all the languages, and the number of sentences in each language. It's also needed to display the sentences count on some other pages.
84. Update the sphinx.conf. This is needed so that users can search sentences in the new language.
89
910
1011## 1. Add the language in LanguagesLib
1112
1213* Open the file `app/vendors/languages_lib.php`
1314
1415* Add the language in the in `languagesInTatoeba()`.
1516
1617* If the language has an ISO 639-1 code, also add it in `get_Iso639_3_To_Iso639_1_Map()`.
1718
1819* If the language is a right to left language, also add it in `getLanguageDirection($lang)`.
1920
2021
2122## 2. Add the icon
2223
2324* The icon needs to be a PNG file, named with the ISO 639-3 language code.
2425
2526* It must be placed in `app/webroot/img/flags`.
2627
2728
2829## 3. Run the MySQL add\_new\_language() procedure
2930
3031* The script to create the `add_new_language()` procedure can be found in `docs/database/procedures/add_new_language.sql`. If your database does not have this procedure, then run this script first.
3132
3233* Connect to the database and execute the procedure: `CALL add_new_language('<lang>', <listId>);`. Replace `<lang>` with the ISO 639-3 code and `<listId>` with the id of the list that contains the sentences in that language.
34
35
36## 4. Update the sphinx.conf
37
38* Generate the sphinx.conf file with the CakePHP shell: `cake -app "/path/to/app" sphinx_conf > sphinx.conf`
39* Replace the old sphinx.conf with the new one.
40* Re-index the sentences using the new conf: `indexer --all --rotate`.
diff view generated by jsdifflib

Version at: 26/07/2015, 13:01

# Adding a New Language to the Corpus (for Developers)

There are basically 3 steps to add a new language in Tatoeba:

1. Add the language in LanguagesLib. This is needed to make the language available in the various dropdown lists, so that one can to add/translate sentences in the new language.
2. Add the language icon. This is needed to display the language icon that is displayed next to every sentence.
3. Update the languages table in the database. This is needed for the statistics page, that lists all the languages, and the number of sentences in each language. It's also needed to display the sentences count on some other pages.


## 1. Add the language in LanguagesLib

* Open the file `app/vendors/languages_lib.php`

* Add the language in the in `languagesInTatoeba()`.

* If the language has an ISO 639-1 code, also add it in `get_Iso639_3_To_Iso639_1_Map()`.

* If the language is a right to left language, also add it in `getLanguageDirection($lang)`.


## 2. Add the icon

* The icon needs to be a PNG file, named with the ISO 639-3 language code.

* It must be placed in `app/webroot/img/flags`.


## 3. Run the MySQL add\_new\_language() procedure

* The script to create the `add_new_language()` procedure can be found in `docs/database/procedures/add_new_language.sql`. If your database does not have this procedure, then run this script first.

* Connect to the database and execute the procedure: `CALL add_new_language('<lang>', <listId>);`. Replace `<lang>` with the ISO 639-3 code and `<listId>` with the id of the list that contains the sentences in that language.

version at: 26/07/2015, 13:25

# Adding a New Language to the Corpus (for Developers)

There are basically 4 steps to add a new language in Tatoeba:

1. Add the language in LanguagesLib. This is needed to make the language available in the various dropdown lists, so that one can to add/translate sentences in the new language.
2. Add the language icon. This is needed to display the language icon that is displayed next to every sentence.
3. Update the languages table in the database. This is needed for the statistics page, that lists all the languages, and the number of sentences in each language. It's also needed to display the sentences count on some other pages.
4. Update the sphinx.conf. This is needed so that users can search sentences in the new language.


## 1. Add the language in LanguagesLib

* Open the file `app/vendors/languages_lib.php`

* Add the language in the in `languagesInTatoeba()`.

* If the language has an ISO 639-1 code, also add it in `get_Iso639_3_To_Iso639_1_Map()`.

* If the language is a right to left language, also add it in `getLanguageDirection($lang)`.


## 2. Add the icon

* The icon needs to be a PNG file, named with the ISO 639-3 language code.

* It must be placed in `app/webroot/img/flags`.


## 3. Run the MySQL add\_new\_language() procedure

* The script to create the `add_new_language()` procedure can be found in `docs/database/procedures/add_new_language.sql`. If your database does not have this procedure, then run this script first.

* Connect to the database and execute the procedure: `CALL add_new_language('<lang>', <listId>);`. Replace `<lang>` with the ISO 639-3 code and `<listId>` with the id of the list that contains the sentences in that language.


## 4. Update the sphinx.conf

* Generate the sphinx.conf file with the CakePHP shell: `cake -app "/path/to/app" sphinx_conf > sphinx.conf`
* Replace the old sphinx.conf with the new one.
* Re-index the sentences using the new conf: `indexer --all --rotate`.

Note

The lines in green are the lines that have been added in the new version. The lines in red are those that have been removed.