From: Carsten K. <car...@us...> - 2001-12-27 04:25:05
|
Update of /cvsroot/phpwiki/phpwiki/locale In directory usw-pr-cvs1:/tmp/cvs-serv24665/phpwiki/locale Modified Files: README Log Message: Extensive rewrite with more instructions for andding new translations. Also incorporated changes from patch #496662. Index: README =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/locale/README,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** README 2001/04/06 18:21:37 1.2 --- README 2001/12/27 04:25:02 1.3 *************** *** 1,79 **** ! Phpwiki can be localized and use different languages. ! If you would like to use one of supported languages, then ! just go to lib/config.php and set the language to use there. ! This README describes how to add support for a new language. ! Let's assume you would like to support Islandic (code 'is'). ! ! Just copy locale/po/phpwiki.pot to locale/po/is.po. ! Then, translate all the strings inside is.po to Islandic. ! See the other *.po files as example if you are uncertain about the ! syntax. Hint: Emacs has a handy po translation mode for you. ! Most of the work, though, is in translating the pgsrc and template ! files. Do the following: mkdir locale/is cp -rv pgsrc locale/is - cp -rv templates locale/is - - Note: it is more important to translate the templates than to translate - the pgsrc/ files. For the pgsrc/ files it is sufficient to change their - names to Islandic and maybe translate the HomePage (or how it is - called in Islandic). Again, for anything you don't know, look at the - `nl' or `de' versions. - - - After you have finished translating, you may want to check the result - of your efforts. - - First you need to modify locale/translate.sh - Add Islandic to the variable ALL_LINGUAS like this: - ALL_LINGUAS="nl es de is" ! Then (from the main directory where index.php resides) run: ! ./locale/translate.sh - which generates all necessary files**. - If this step fails, because you don't have the necessary software - installed, then just send your files to one of the phpwiki developers - and we run translate.sh for you. ! ! Next edit ./lib/config.php and change the line that sets $LANG to ! make phpwiki use your language, e.g. make them look like this: ! ! // Select your language - default language "C": English ! // other languages available: Dutch "nl", Spanish "es", German "de" ! // $LANG="C"; ! $LANG="is"; ! Phpwiki should now speak Islandic. ! If you're unfamiliar with GNU gettext and po files, you may find some ! information at http://www.iro.umontreal.ca/contrib/po/HTML/ ! If you succeed, you may also want to add instructions to this ! translation README for phpwiki ;-) Good luck, Jan Nieuwenhuizen <ja...@gn...> Arno Hollosi <aho...@ma...> ! ! ! ! **)translate.sh is a simple script that tries to replace the usual ! `make po po-update'. It actually does these things: ! * make the .pot file up to date ! * merge differences into all translated .po files ! * generate .mo files ! * generate legacy php3 translation dictionary [this is the hairiest ! part and should be dropped when we drop php3 support] --- 1,205 ---- ! Phpwiki uses GNU gettext tools to provide and maintain multi-lingual ! messages for different languages. ! <http://www.gnu.org/directory/gettext> ! This document describes how to add a new language translation to PhpWiki. + If you just want to use one of the existing language translations, see + part three in 'index.php' to change the default language of your + Wiki. Modify the line that sets $LANG to use the two-letter code of + one of the supported languages, like this: ! // Select your language - default language "C": English ! // other languages available: Dutch "nl", Spanish "es", German "de" ! // $LANG="C"; ! $LANG="is"; ! General Steps ! ============= ! The general steps to creating a new language module for PhpWiki are as ! follows: ! ! 1. Copy and rename the master template to create a new file for your ! language ('phpwiki.pot' => 'xx.po'). ! ! 2. Translate all the strings in the new language file ('.po file'). ! ! 3. Run "Make" to automatically create or update any additional files ! ('.po' => '.mo' => 'phpwiki.php' files). ! ! 4. Create translations of the content for the default pages ('pgsrc' ! files). ! ! ! Example ! ======= ! Let's assume for example that you would like to add an Islandic ! translation to PhpWiki. ! ! ! Text Strings ! ------------ ! Duplicate the file phpwiki.pot in the 'locale/po/' folder and name it ! 'is.po' ('is' is the code for Islandic). Next, translate all the ! strings inside 'is.po' from English to Islandic. Unix Hint: Emacs has ! a handy "po translation mode" for you. ! ! Important: Currently all the language files are saved using the ! ISO-8859-1 character encoding to preserve accented characters. Make ! sure the text editor you use is capable of the appropriate Latin-1 ! translation. Strictly speaking, ISO-8859-1 is *different* than Windows ! code page 1252 or MacRoman. Upon quick inspection one will notice that ! many of the letters do occupy the same positions in each of their' ! respective encoding tables, so it is easy to understand how people ! have made such a false assumption. ! ! <FIXME> Add a note about %s and variable reordering: %3$s, %1$s, %2$s. </FIXME> ! ! Example of word-substitution-reordering from 'de.po': ! #: ../lib/diff.php:251 ! #, c-format ! msgid "Differences between %s and %s of %s." ! msgstr "Der Unterschiedsergebnis von %3$s, zwischen %1$s und %2$s." ! ! While translating the text strings if you are uncertain about the ! syntax, look at the '.po' files of the other languages as an ! example. The 'phpwiki.php' file does not need to be created or edited ! because the Makefile will create and update these files automatically ! (see below**). ! ! ! Default Pages ! ------------- ! Most of the work will be in the translation of the default pgsrc ! files. As a starting point you can copy the English 'pgsrc' directory: mkdir locale/is cp -rv pgsrc locale/is ! For these 'pgsrc' files it will be sufficient to change the page names ! to Islandic, and maybe translate the HomePage and give it an Islandic ! name. Again, for anything you don't know, look at the `nl' or `de' ! versions. ! ! The best approach to translating the default pages is to do all of ! your page editing in the web browser itself, then perform a page dump ! to save the pages as MIME text files. Some of the pages are locked so ! you will have to log into PhpWiki as the administrator before you can ! edit them. ! ! <FIXME> ! Add instructions for editing MIME headers of files before moving ! files into '/locale/is/pgsrc' ! ! - keep modification date, page name and lock, remove author). ! Example: ! Content-Type: application/x-phpwiki; ! pagename= PhpWikiSystemverwalten; ! flags=PAGE_LOCKED; ! lastmodified=1008730541; ! Content-Transfer-Encoding: quoted-printable ! ! - Make sure to rename files with accents in the page name. ! (e.g. "GästeBuch" => "G%E4steBuch" ) ! ! - Translate body text and rename plugin pages to match changes ! specified in the '.po' file. ! Example: ! <?plugin RecentChanges days=3D4 show_all=3D1 show_minor=3D1?> ! ! </FIXME> ! ! ! Makefile ! -------- ! The Makefile automatically performs a number of important translation tasks: ! ! * Retrieves all the English text strings used throughout the php ! code, then collects and indexes them into the file 'phpwiki.pot'. ! ! * Merges any new differences of the collected English text strings ! with similar text strings found during any previous runs of 'make', ! stored inside each of the translated '.po' files. ! ! * Makes note of which English text strings have been added, reworded ! or removed. The translated strings in the '.po' files are then marked ! as "Fuzzy" translations for all cases where the English text has been ! changed. This makes it easy for translators to spot which items need ! to be updated. (Emacs' po mode also uses this information). ! ! * The necessary '.mo' files and 'phpwiki.php' text files are ! synchronized and sorted according to the translated contents of the ! '.po' files, for each of the locale subdirectories. ! ! When a new language module is added to PhpWiki the 'Makefile' in the ! 'locale' folder also needs to be updated. Add the two-letter gettext ! language code to the list of all languages known by PhpWiki, by ! changing the variable ALL_LINGUAS. In this example 'is' was added for ! Icelandic: ! ! ALL_LINGUAS="nl es de sv it is" ! ! To start the 'Makefile' process, change to the 'locale' directory ! before invoking the 'make' command: ! ! cd locale ! make ! ! Make will then automatically generate and update all the necessary ! files. If this step fails because you don't have the necessary ! software installed, then send your '.po' files to one of the PhpWiki ! developers who will run Makefile for you. ! ! ! HTML Templates ! -------------- ! The template files do not need to be translated. As of PhpWiki 1.3 all ! the text strings have been moved out of the html templates into the ! '.po' files. ! ! *** Note: Updating html template translations from PhpWiki 1.2 to 1.3: *** ! ! The translated version of the tips for TextFormattingRules ! must be moved from the old html template 'editpage.html', and placed ! into the 'pgsrc' for the default page of TextFormattingRules. A plugin ! now extracts this text and inserts it when editing a page in PhpWiki, ! rather than putting it into the html template itself. ! ! It is suggested to put the paragraph at the top of the page. It must ! be in a section heading entitled "Summary". Of course you will ! substitute the translations for "TextFormattingRules" and "Summary", ! according to the wording you used for these phrases when you ! translated the '.po' file. ! Refer to the English "TextFormattingRules" and German (de) ! "TextFormatierungsRegeln" pages to see working examples. ! Finale ! ====== ! After you have finished translating, you may want to check the result ! of your efforts. Change the $LANG setting in 'index.php' to the ! two-letter code for your language. ! Et voilà, Phpwiki should now speak Islandic! + If your translation was a success, you may also want to add a + translation of these instructions for PhpWiki ;-) ! About gettext ! ------------- ! To learn more about GNU gettext and '.po' files, you may find some ! information at: ! <http://www.iro.umontreal.ca/contrib/po/HTML/> ! <http://www.gnu.org/directory/gettext> Good luck, Jan Nieuwenhuizen <ja...@gn...> Arno Hollosi <aho...@ma...> ! Carsten Klapp <car...@ma...> ! $Id$ |