Version at: 23/02/2014, 00:05 vs. version at: 23/02/2014, 00:09
11# Adding a New Language to the Corpus (for Developers)
22
33##Introduction
44
55These are the instructions for adding a language to the Tatoeba corpus. Instructions for adding a language in which the Tatoeba UI will be displayed are found elsewhere.
66
77These instructions were copied from [Assembla](https://www.assembla.com/spaces/tatoeba2/wiki/Adding_a_language_in_Tatoeba). They have not yet been verified for current use, or updated.
88
9##Instructions
9##FAQ for users
1010The FAQ for users who want to add a new language: [How to request a new language](http://tatoeba.org/eng/faq#new-language).
1111
12###In the source code
12##Language icon
131. Create the icon for the language. The icon should be a PNG file of dimension 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.
1314
14There is a script on the server, add_lang.sh, that will modifiy the right files to add the new language code to the appropriate files. The script is called add_lang.sh. It can be executed as followed:
152. Commit the image to the repository. The icons are stored in the app/webroot/img/flags folder. Ask one of the people with repository access if you don't have it yourself and don't want to obtain it.
16
173. Update the app/webroot/img/flags directory on the server, to retrieve the new images for the new languages.
18
19##Source code
20
21There is a script on the server that will modify the right files to add the new language code to the appropriate files. It can be executed as followed:
1522
1623./add_lang.sh <lang_code> <english_name> <list_id>
1724
1825For example:
1926
2027./add_lang.sh eng English 123
2128
2229Once this script is executed, the new languages will be available on the website. The sentences that were in the list with id <list_id> will have their language set to the new language (instead of being set to language unknown). This script edits the following files:
2330
2431* app/model/sentence.php
2532Adds the language ISO code to the $validate array. Languages that are not part of this array are not allowed.
2633
2734* app/views/helpers/languages.php
2835Adds the language ISO code and the name to the languagesArray() method.
2936
3037* docs/generate_sphinx_conf.php
3138Adds the language ISO code and name to the $languages array. Also adds the ISO code to the $cjkLanguages array if the language uses Chinese, Japanese or Korean characters.
3239
3340
3441In addition, make this change:
3542
3643* app/webroot/img/flags/
3744Add an icon for the new language. Dimensions 30 x 20. Format png. Modify luminosity so that it looks a bit more pale than the original and add a 1 pixel border on right and bottom (color #dcdcdc).
3845
3946
4047In the past, we used to edit this:
4148
4249* app/controllers/components/google_language_api.php
4350Adds the corresponding case to the google2TatoebaCode() method, if Google supports the detection for the language. See the Language enum.
4451
4552but now tatodetect takes care of language detection.
4653
4754After you make your changes, commit your code to the SVN repository.
4855
4956##In your local Tatoeba
5057
5158* Connect to mysql and select the database.
5259* If you haven't done it yet, run the following script:
5360 docs/database/scripts/add_new_language.sql.
5461It will create a procedure to easily add a new language and do the necessary updates in the database.
5562* CALL add_new_language(iso_code, list_id, tag_name);
5663* Read the comments in add_new_language.sql to have examples of the procedure.
5764* Test that the language detection works (or can work) by adding a sentence with 'auto-detect'. There should be on Tatoeba a list of sentences in the language in question (named after the language in question).
5865* Test that you can change the language of a sentence into the language in question.
5966* Check that the count displays properly in the languages stats.
6067* If it's all fine, commit and refer to the ticket #225 in your comment (=> re #225) and indicate the languages that were added. Also refer to any separate tickets that were added to track adding these languages in particular. The syntax for referring to multiple tickets is described here.
6168
6269
6370##On the dev
6471
6572* Go to the 'dev' repository.
6673* Update it, if necessary.
6774* Connect to the mysql database of the dev version.
6875* CALL add_new_language(iso_code, list_id, tag_name);
6976* Test the same things you have tested in local.
7077
7178
7279##On the prod
7380
7481* If everything is fine with the dev, go to the 'prod' repository.
7582* htop
7683* Check that the load is below 2.
7784* Update the repository if necessary
7885* Connect to the mysql database of the prod version.
7986* CALL add_new_language(iso_code, list_id, tag_name);
8087* exit
8188* Check that the sentences that were in the list and tags have now the appropriate icon.
8289* Check that the language appears in the languages stats.
8390* cp /usr/local/etc/sphinx.conf /usr/local/etc/sphinx.conf.old
8491* php generate_sphinx_conf.php > /usr/local/etc/sphinx.conf
8592* Change the necessary things in the new config file (user, password, database and port). Look at the old conf file for reference.
8693* indexer --all --rotate & disown
8794
8895
diff view generated by jsdifflib

Version at: 23/02/2014, 00:05

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

##Introduction

These are the instructions for adding a language to the Tatoeba corpus. Instructions for adding a language in which the Tatoeba UI will be displayed are found elsewhere.

These instructions were copied from [Assembla](https://www.assembla.com/spaces/tatoeba2/wiki/Adding_a_language_in_Tatoeba). They have not yet been verified for current use, or updated. 

##Instructions
The FAQ for users who want to add a new language: [How to request a new language](http://tatoeba.org/eng/faq#new-language).

###In the source code

There is a script on the server, add_lang.sh, that will modifiy the right files to add the new language code to the appropriate files. The script is called add_lang.sh. It can be executed as followed:

./add_lang.sh <lang_code> <english_name> <list_id>

For example: 

./add_lang.sh eng English 123

Once this script is executed, the new languages will be available on the website. The sentences that were in the list with id <list_id> will have their language set to the new language (instead of being set to language unknown). This script edits the following files:

* app/model/sentence.php
Adds the language ISO code to the $validate array. Languages that are not part of this array are not allowed.

* app/views/helpers/languages.php
Adds the language ISO code and the name to the languagesArray() method.

* docs/generate_sphinx_conf.php
Adds the language ISO code and name to the $languages array. Also adds the ISO code to the $cjkLanguages array if the language uses Chinese, Japanese or Korean characters.

 
In addition, make this change:

* app/webroot/img/flags/
Add an icon for the new language. Dimensions 30 x 20. Format png. Modify luminosity so that it looks a bit more pale than the original and add a 1 pixel border on right and bottom (color #dcdcdc).


In the past, we used to edit this:

* app/controllers/components/google_language_api.php
Adds the corresponding case to the google2TatoebaCode() method, if Google supports the detection for the language. See the Language enum.

but now tatodetect takes care of language detection.

After you make your changes, commit your code to the SVN repository.

##In your local Tatoeba

* Connect to mysql and select the database.
* If you haven't done it yet, run the following script: 
 docs/database/scripts/add_new_language.sql. 
It will create a procedure to easily add a new language and do the necessary updates in the database.
* CALL add_new_language(iso_code, list_id, tag_name);
* Read the comments in add_new_language.sql to have examples of the procedure.
* Test that the language detection works (or can work) by adding a sentence with 'auto-detect'. There should be on Tatoeba a list of sentences in the language in question (named after the language in question).
* Test that you can change the language of a sentence into the language in question.
* Check that the count displays properly in the languages stats.
* If it's all fine, commit and refer to the ticket #225 in your comment (=> re #225) and indicate the languages that were added. Also refer to any separate tickets that were added to track adding these languages in particular. The syntax for referring to multiple tickets is described here. 

 
##On the dev

* Go to the 'dev' repository.
* Update it, if necessary.
* Connect to the mysql database of the dev version.
* CALL add_new_language(iso_code, list_id, tag_name);
* Test the same things you have tested in local. 

 
##On the prod

* If everything is fine with the dev, go to the 'prod' repository.
* htop
* Check that the load is below 2.
* Update the repository if necessary
* Connect to the mysql database of the prod version.
* CALL add_new_language(iso_code, list_id, tag_name);
* exit
* Check that the sentences that were in the list and tags have now the appropriate icon.
* Check that the language appears in the languages stats.
* cp /usr/local/etc/sphinx.conf /usr/local/etc/sphinx.conf.old
* php generate_sphinx_conf.php > /usr/local/etc/sphinx.conf
* Change the necessary things in the new config file (user, password, database and port). Look at the old conf file for reference.
* indexer --all --rotate & disown

version at: 23/02/2014, 00:09

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

##Introduction

These are the instructions for adding a language to the Tatoeba corpus. Instructions for adding a language in which the Tatoeba UI will be displayed are found elsewhere.

These instructions were copied from [Assembla](https://www.assembla.com/spaces/tatoeba2/wiki/Adding_a_language_in_Tatoeba). They have not yet been verified for current use, or updated. 

##FAQ for users
The FAQ for users who want to add a new language: [How to request a new language](http://tatoeba.org/eng/faq#new-language).

##Language icon
1. Create the icon for the language. The icon should be a PNG file of dimension 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.

2. Commit the image to the repository. The icons are stored in the app/webroot/img/flags folder. Ask one of the people with repository access if you don't have it yourself and don't want to obtain it.

3. Update the app/webroot/img/flags directory on the server, to retrieve the new images for the new languages.

##Source code

There is a script on the server that will modify the right files to add the new language code to the appropriate files. It can be executed as followed:

./add_lang.sh <lang_code> <english_name> <list_id>

For example: 

./add_lang.sh eng English 123

Once this script is executed, the new languages will be available on the website. The sentences that were in the list with id <list_id> will have their language set to the new language (instead of being set to language unknown). This script edits the following files:

* app/model/sentence.php
Adds the language ISO code to the $validate array. Languages that are not part of this array are not allowed.

* app/views/helpers/languages.php
Adds the language ISO code and the name to the languagesArray() method.

* docs/generate_sphinx_conf.php
Adds the language ISO code and name to the $languages array. Also adds the ISO code to the $cjkLanguages array if the language uses Chinese, Japanese or Korean characters.

 
In addition, make this change:

* app/webroot/img/flags/
Add an icon for the new language. Dimensions 30 x 20. Format png. Modify luminosity so that it looks a bit more pale than the original and add a 1 pixel border on right and bottom (color #dcdcdc).


In the past, we used to edit this:

* app/controllers/components/google_language_api.php
Adds the corresponding case to the google2TatoebaCode() method, if Google supports the detection for the language. See the Language enum.

but now tatodetect takes care of language detection.

After you make your changes, commit your code to the SVN repository.

##In your local Tatoeba

* Connect to mysql and select the database.
* If you haven't done it yet, run the following script: 
 docs/database/scripts/add_new_language.sql. 
It will create a procedure to easily add a new language and do the necessary updates in the database.
* CALL add_new_language(iso_code, list_id, tag_name);
* Read the comments in add_new_language.sql to have examples of the procedure.
* Test that the language detection works (or can work) by adding a sentence with 'auto-detect'. There should be on Tatoeba a list of sentences in the language in question (named after the language in question).
* Test that you can change the language of a sentence into the language in question.
* Check that the count displays properly in the languages stats.
* If it's all fine, commit and refer to the ticket #225 in your comment (=> re #225) and indicate the languages that were added. Also refer to any separate tickets that were added to track adding these languages in particular. The syntax for referring to multiple tickets is described here. 

 
##On the dev

* Go to the 'dev' repository.
* Update it, if necessary.
* Connect to the mysql database of the dev version.
* CALL add_new_language(iso_code, list_id, tag_name);
* Test the same things you have tested in local. 

 
##On the prod

* If everything is fine with the dev, go to the 'prod' repository.
* htop
* Check that the load is below 2.
* Update the repository if necessary
* Connect to the mysql database of the prod version.
* CALL add_new_language(iso_code, list_id, tag_name);
* exit
* Check that the sentences that were in the list and tags have now the appropriate icon.
* Check that the language appears in the languages stats.
* cp /usr/local/etc/sphinx.conf /usr/local/etc/sphinx.conf.old
* php generate_sphinx_conf.php > /usr/local/etc/sphinx.conf
* Change the necessary things in the new config file (user, password, database and port). Look at the old conf file for reference.
* indexer --all --rotate & disown

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.