-
Notifications
You must be signed in to change notification settings - Fork 131
Adding a new language
Trang edited this page Jul 21, 2018
·
11 revisions
Here we describe the steps to add a new language in Tatoeba from a development point of view.
This is needed to make the language available in the various dropdown lists.
- Open the file
app/Lib/LanguagesLib.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)
.
- Language icons are located in
app/webroot/img/flags
. - The icon needs to be a PNG file, named with the ISO 639-3 language code.
- The dimension must be 30x20. On each icon there is (in theory) a 1px line of color #dcdcdc on the border bottom and right. Most of the icons also have gone through a luminosity change, so that they are a bit more pale than the original image. Anyway, most of it doesn't matter right now. The most important is that the icon is a PNG file of dimension 30x20.
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.
- The script that creates the procedure
add_new_language()
can be found indocs/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.
This needs to be done on the production server, so that users can search sentences in the new language. You can ignore this step for local development if you don't have Sphinx installed.
- Generate the sphinx.conf file with the CakePHP shell:
Console/cake sphinx_conf > /path/to/sphinx.conf
- Re-index the sentences using the new conf:
indexer --all --rotate
If you have any question, if something in this page was not clear enough for you, or if you have suggestions to improve it, please let us know: [email protected].