Difference between revisions of "Instructions for translators"

From WeBWorK_wiki
Jump to navigation Jump to search
 
(17 intermediate revisions by one other user not shown)
Line 15: Line 15:
 
** .po stands for portable object. It is a text file which consists of strings to be translated followed by their translations. It also contains comment lines which give the location of the string in the source file. Translators modify this file to add new translations to strings.
 
** .po stands for portable object. It is a text file which consists of strings to be translated followed by their translations. It also contains comment lines which give the location of the string in the source file. Translators modify this file to add new translations to strings.
 
** .pot stands for portable object template. Developers modify (or recreate) this file when the original code file is rewritten. The format for this file is the same as for the .po file, but the translations are ignored. This file exists to specify which strings need to be translated.
 
** .pot stands for portable object template. Developers modify (or recreate) this file when the original code file is rewritten. The format for this file is the same as for the .po file, but the translations are ignored. This file exists to specify which strings need to be translated.
** Poedit uses the webwork2.pot file as a template or catalog to define the strings that need translating. It saves a .po file, for example tr.po (resp. es.po, etc.) which contains the translations of those strings in Turkish (resp. Spanish, etc.).
+
* Poedit uses the webwork2.pot file as a template or catalog to define the strings that needs translating. It saves a .po file, for example tr.po (resp. es.po, etc.) which contains the translations of those strings into Turkish (resp. Spanish, etc.). When one merges an existing .po file and an existing .pot file all of the string entries of the .pot file are used and the corresponding translations in .po file are used if they exist.
* Poedit uses the webwork2.pot file as a template or catalog to define the strings that need translating. It saves a .po file, for example tr.po (resp. es.po, etc.) which contains the translations of those strings in Turkish (resp. Spanish, etc.). When one merges an existing .po file and an existing .pot file all of the string entries of the .pot file are used and the corresponding translations in .po file are used if they exist.
+
  +
  +
=== Converting existing .pm files ===
  +
  +
  +
If you have already created a *.pm file (e.g. fr.pm) defining translation strings by editing
  +
%Lexicon in a perl file then you can send [mailto:gage@math.rochester.edu Mike Gage] and/or [mailto:aubreyja@missouri.edu Jason Aubrey ] the file. They can
  +
translate it into a .po file so that you will not loose any of the translating work you have done so far.
  +
 
===Creating a new .po file from webwork2.pot ===
 
===Creating a new .po file from webwork2.pot ===
 
* Open the webwork2.pot file. (You may need to change the pop-up menu to "all files" so that the .pot files are displayed. )
 
* Open the webwork2.pot file. (You may need to change the pop-up menu to "all files" so that the .pot files are displayed. )
* Fill out Catalog-->Settings: [[Image:Poedit_settings.png|thumb|widthpx|POedit Settings]].
+
* Fill out Catalog-->Settings: [[Image:Poedit_settings.png|thumb|widthpx|POedit Settings]]. If you don't fill out this "settings" box you will get a warning error message when you save. However nothing else will happen.
If you don't fill out this "settings" box you will get a warning error message when you save. However nothing else will happen.
 
 
* Save the file as fr.po (French) or es.po (Spanish). If unsure what name to give the language file email [mailto:gage@math.rochester.edu Mike Gage] and/or [mailto:aubreyja@missouri.edu Jason Aubrey ]
 
* Save the file as fr.po (French) or es.po (Spanish). If unsure what name to give the language file email [mailto:gage@math.rochester.edu Mike Gage] and/or [mailto:aubreyja@missouri.edu Jason Aubrey ]
  +
* We are using the [http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes ISO_639-1] convention for languages.
 
* Proceed to add translations in the lower panel of the window
 
* Proceed to add translations in the lower panel of the window
 
[[Image:Poedit_window.png|thumb|widthpx|Pedit Window ]]
 
[[Image:Poedit_window.png|thumb|widthpx|Pedit Window ]]
 
* Save often :-)
 
* Save often :-)
* You can display or hide the comment panels and other panels using the "view" menu. Automatic comments are the line numbers in the source file. Comments can be anything.
+
* You can display or hide the comment panels and other panels using the "view" menu. The automatic comments panel contain the line numbers in the source file of the string. Comments can be added at any time. Include any information that will be helpful to future translators.
** The .po and .pot files are simply text files. You can view these files in any text editor to see what is happening. It is safer to update them using Poedit since that insures that the format is preserved.
+
* The .po and .pot files are simply text files. You can view these files in any text editor to see their format and to inspect any changes. It is safer to update them using Poedit since that insures that the format is preserved.
   
 
=== Updating an existing .po file from webwork2.pot ===
 
=== Updating an existing .po file from webwork2.pot ===
* Open the .po file in Poedit
 
  +
* Obtain new webwork2.pot file, with new strings to translate, from the SVN or from programmers.
* Choose Catalog --> Update from POT file... from menu
 
  +
  +
* Open your current .po file in Poedit
  +
* Choose "Catalog --> Update from POT file..." from menu
 
* Select new webwork2.pot file
 
* Select new webwork2.pot file
* Any new untranslated strings will be added to your .po file
+
* Any new untranslated strings in webwork2.pot will be added to your .po file
 
* Translate the new strings
 
* Translate the new strings
 
* Save and return the new .po file for testing.
 
* Save and return the new .po file for testing.
Line 41: Line 44:
 
** Include a brief description of what you have done.
 
** Include a brief description of what you have done.
 
** They will upload the file to a WeBWorK course where you can test your translations.
 
** They will upload the file to a WeBWorK course where you can test your translations.
  +
  +
=== Testing translations locally ===
  +
* If you have administrative access to a WeBWorK server, you may test the resulting .po file locally as follows:
  +
** Save the .po file to /opt/webwork/webwork2/lib/WeBWorK/Localize
  +
** Restart the apache2 server (<code>sudo systemctl restart apache2</code> on Ubuntu)
  +
** Select the language from the course configuration of a course on the server.
  +
  +
=== Tips on translations ===
  +
  +
  +
[[Translation_tips]] (please add your comments)
   
 
=== Thank you ===
 
=== Thank you ===
Line 54: Line 68:
   
 
* Instructions on creating .pot and .po files http://betterwp.net/wordpress-tips/create-pot-file-using-poedit/
 
* Instructions on creating .pot and .po files http://betterwp.net/wordpress-tips/create-pot-file-using-poedit/
  +
* PO file format: http://www.gnu.org/s/hello/manual/gettext/PO-Files.html
  +
* Language codes: There seems to be some disagreement on the standards.
  +
** Language codes: http://msdn.microsoft.com/en-us/library/ms533052(v=vs.85).aspx
  +
** Language codes: http://joeclark.org/book/sashay/serialization/AppendixB.html
   
   
Line 89: Line 107:
   
   
 
  +
[[Category:Translators]]
 
 
[[Category:Developers]]
 
[[Category:Developers]]

Latest revision as of 11:38, 17 May 2021

Editing Instructions for WeBWorK translators

  • Getting started as a translator:
    • You should download the java based application Poedit. (See http://www.poedit.net/). The download page is http://www.poedit.net/download.php
    • Obtain the webwork2.pot file from http://webwork.maa.org/viewvc/system/trunk/webwork2/lib/WeBWorK/Localize/.
      • Click on webwork2.pot
      • Click on "download" near the top of the page
      • If the page opens in the browser window save it as webwork2.pot in the directory where you will work on translations.
    • At the same location you might also find the current versions of the .po file for each language. Download them in the same way.
    • The .po and .pot files are simply text files. You can view their format in any text editor. It is safer to update them using Poedit since that insures that the format is preserved.


Background

  • Definitions
    • .po stands for portable object. It is a text file which consists of strings to be translated followed by their translations. It also contains comment lines which give the location of the string in the source file. Translators modify this file to add new translations to strings.
    • .pot stands for portable object template. Developers modify (or recreate) this file when the original code file is rewritten. The format for this file is the same as for the .po file, but the translations are ignored. This file exists to specify which strings need to be translated.
  • Poedit uses the webwork2.pot file as a template or catalog to define the strings that needs translating. It saves a .po file, for example tr.po (resp. es.po, etc.) which contains the translations of those strings into Turkish (resp. Spanish, etc.). When one merges an existing .po file and an existing .pot file all of the string entries of the .pot file are used and the corresponding translations in .po file are used if they exist.


Converting existing .pm files

If you have already created a *.pm file (e.g. fr.pm) defining translation strings by editing %Lexicon in a perl file then you can send Mike Gage and/or Jason Aubrey the file. They can translate it into a .po file so that you will not loose any of the translating work you have done so far.

Creating a new .po file from webwork2.pot

  • Open the webwork2.pot file. (You may need to change the pop-up menu to "all files" so that the .pot files are displayed. )
  • Fill out Catalog-->Settings:
    POedit Settings
    . If you don't fill out this "settings" box you will get a warning error message when you save. However nothing else will happen.
  • Save the file as fr.po (French) or es.po (Spanish). If unsure what name to give the language file email Mike Gage and/or Jason Aubrey
  • We are using the ISO_639-1 convention for languages.
  • Proceed to add translations in the lower panel of the window
Pedit Window
  • Save often :-)
  • You can display or hide the comment panels and other panels using the "view" menu. The automatic comments panel contain the line numbers in the source file of the string. Comments can be added at any time. Include any information that will be helpful to future translators.
  • The .po and .pot files are simply text files. You can view these files in any text editor to see their format and to inspect any changes. It is safer to update them using Poedit since that insures that the format is preserved.

Updating an existing .po file from webwork2.pot

  • Obtain new webwork2.pot file, with new strings to translate, from the SVN or from programmers.
  • Open your current .po file in Poedit
  • Choose "Catalog --> Update from POT file..." from menu
  • Select new webwork2.pot file
  • Any new untranslated strings in webwork2.pot will be added to your .po file
  • Translate the new strings
  • Save and return the new .po file for testing.

Uploading translations

  • When you have translated phrases you would like to have tested:
    • save your translations using Poedit
    • email the .po and .mo files which it creates as attachments to Mike Gage and/or to Jason Aubrey .
    • Include a brief description of what you have done.
    • They will upload the file to a WeBWorK course where you can test your translations.

Testing translations locally

  • If you have administrative access to a WeBWorK server, you may test the resulting .po file locally as follows:
    • Save the .po file to /opt/webwork/webwork2/lib/WeBWorK/Localize
    • Restart the apache2 server (sudo systemctl restart apache2 on Ubuntu)
    • Select the language from the course configuration of a course on the server.

Tips on translations

Translation_tips (please add your comments)

Thank you

If you have questions email Mike Gage or Jason Aubrey .

Please help modify this wiki page to make the instructions more accurate and complete.


Thank you for your help in making WeBWorK available in every language.

Technical resources