version=pmwiki-2.1.11 ordered=1 urlencoded=1
agent=Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.0.3) Gecko/20060425 SUSE/1.5.0.3-7 Firefox/1.5.0.3
author=Pm
csum=adjusted faq
host=24.1.26.255
name=PmWiki.Internationalizations
rev=38
targets=PmWiki.WikiGroup,PmWiki.PerGroupCustomizations,PmWiki.DocumentationIndex
text=PmWiki supports internationalization (internationalisation) of web pages, allowing accented characters to appear in page names and almost complete customization of PmWiki's prompts.  Most customization is provided via the `XLPage() function in PmWiki, which loads a set of translation variables from a wiki page (typically named `XLPage, but it can be named anything you wish).%0a%0a%0a!!Loading Translation Pages%0a%0aPages for many languages such as French, German, Dutch, and Spanish have already been created and maintained at the pmichaud.com site.  You can download an archive of these translations from http://www.pmichaud.com/pub/pmwiki/i18n.tgz.  Simply unpack the archive into the directory containing your ''pmwiki.php'' installation.  The archive contains a number of page files that are placed in your wikilib.d/ directory, and some special scripts for translations that use a character set other than iso-8859-1 (PmWiki's default).%0a%0aOnce the translation pages are installed, you enable a language by adding a call to `XLPage() in your ''config.php'' file.  For example, to select French language prompts, one would specify%0a%0a->[@XLPage('fr','PmWikiFr.XLPage');@]%0a%0awhich says to load the translations for French ('fr') from the page `PmWikiFr.XLPage.  It's perfectly okay to load multiple pages; so if you want to create your own local translations without changing the ones you got from ''i18n.tgz'', just create another page (see below) and load it on top. Be sure that you load first the page with your local chances:%0a%0a-> [@%0aXLPage('fr','PmWikiFr.XLPageLocal');  # my local translations%0aXLPage('fr','PmWikiFr.XLPage');       # from i18n.tgz%0a@]%0a%0aIf your intention is to offer multiple languages on your site, and use [[WikiGroup]]s as language selectors, you may want to place this code in local customizations files (see [[PerGroupCustomizations]]). For example, if your site is published in French and English, and the French pages are in a group called Fr, you could create a file named Fr.php in the local/ directory which contains:%0a%0a-> [@%0a%3c?php if (!defined('PmWiki')) exit();%0a##change to French language%0aXLPage('fr','PmWikiFr.XLPage');%0a@]%0a%0aYou may wish to create a page called `PmwikiFr.php with the same content to access the French documentation in the `PmwikiFr group.%0aEn.php is not necessary in this case since English is the default language.%0a%0aAn alternative to the above would be to add to config.php the following, which tests if there is an `XLPage in a group, and if it finds one it gets loaded:%0a%0a-> [@    %0a$xlpage = FmtPageName('$Group.XLPage', $pagename);%0aif (PageExists($xlpage)) XLPage($xlpage, $xlpage);%0a@]%0a%0aWith this method you would need to copy any relevant `XLPage into any group which needs the different language support.%0a%0a%0a!!Creating New Translations%0a%0aIf language pages don't exist for your desired language, it's easy to create one!  An `XLPage translation file simply contains lines of the form%0a%0a->[@'phrase' => 'translated phrase',@]%0a%0awhere "phrase" is an internationalized phrase (denoted by @@$[...]@@) in PmWiki's $...Fmt variables, and "translated phrase" is what should be printed in your particular language.  For example, the line (in [@PmWikiFr.XLPage@])%0a%0a->[@'SearchWiki' => 'Rechercher',@]%0a%0aconverts "`SearchWiki" to "Rechercher" on output.  The file PmWiki:XLPageTemplate is a good starting point for creating a new `XLPage and has most of PmWiki's key phrases already listed in it.  Note that the translation mechanism only converts phrases that have been listed as translatable in $...Fmt strings--it won't translate things that appear in wiki markup.%0a%0aIf you create new versions of PmWiki pages in other languages, please consider adding them to the [[PmWiki:PmWiki | main PmWiki site]] so that they can be made available to others in the ''i18n.tgz'' archive!%0a%0a->%25note%25 The term "i18n" is commonly used as an abbreviation for the English word "internationalization".  The abbreviation is derived from the fact that there are 18 letters between the "i" and the final "n" and few people want to type them all out.%0a%0a%0a!!Tools for PmWiki Localization%0a%0aYou can help to localize PmWiki in your language in the original site:%0a%0a* [[PmWiki:Localization]]%0a%0a%25trail%25 %3c%3c|[[DocumentationIndex]]|>>%0a%0a>>faq%3c%3c [[#faq]]%0a%0aQ: If my wiki is internationalized by [@config.php@], how do I revert a specific group to English?%0a%0aA: Use [@$XLLangs = array('en');@] in the [@group.php@] configuration file.%0a
time=1154900876
