Changes

Jump to navigation Jump to search
Current process, could certainly be much improved
The translations for the strings used in Product Opener are located in Lang.pm

For Open Food Facts, the part of Lang.pm containing translations is copied in the wiki so that users can add and edit translations: http://en.wiki.openfoodfacts.org/Translations_-_Web_site_interface

This how-to explains how to push new translations from the wiki live.

== Review diffs ==

In the wiki, use the "View history" function to review what was added / changed.

== Update Lang.pm ==

We will be using a copy of Lang.pm:

Copy the current Lang.pm to Lang2.pm

Edit Lang2.pm and copy and paste the translations from the wiki in Lang2.pm (replacing the current translations).

Notes:
* Lang.pm contains some code before and after the translations, keep it.
* Make sure to use a UTF-8 editor (and that Lang2.pm character set is set to UTF-8), or you will lose special alphabets when doing the copy and paste.


== Check updated Lang2.pm ==

=== Duplicate language keys ===

A common error is contributors who copy and paste strings to translate them, but who then forget to change the language key (e.g. "en" to the language their translating to).

A script makes sure there is only one value for each key:

<pre>
stephane@ks3095298:~/product-opener/scripts$ ./check_lang_pm.pl ../cgi/Lang2.pm
Checking ../cgi/Lang2.pm
key column has 2 values for lang pt
<<HTML
<<HTML
</pre>

-> we have twice pt => for the string "column" (side column of the web site)

=== Perl syntax ===

Lang.pm is a Perl module, the syntax needs to be correct.
You can test it by running perl Lang.pm:

<pre>
perl Lang2.pm
Bareword found where operator expected at Lang2.pm line 3303, near ""Geef de ingrediënten met de vermelding "Kan"
(Missing operator before Kan?)
Bareword found where operator expected at Lang2.pm line 3303, near "", "Geproduceerd"
</pre>

Most errors are mismatched or forgotten " and ' to terminate strings.


== Restarting Apache ==

When issues are fixed, copy Lang2.pm to Lang.pm and restart Apache.

Check that the changes are live and display correctly on the site.

== Update wiki ==

Any fixes you made to the Lang.pm file need to be saved immediately on the wiki.

Navigation menu