[ Index ] |
|
Code source de Horde 3.1.3 |
1 ========================= 2 Horde Translation Guide 3 ========================= 4 5 :Last update: $Date: 2005/10/18 11:33:38 $ 6 :Revision: $Revision: 1.8.10.2 $ 7 :Author: Joris Braakman <jbraakman@yahoo.com> 8 :Author: Chuck Hagenbuch <chuck@horde.org> 9 :Author: Jan Schneider <jan@horde.org> 10 :Contact: horde@lists.horde.org 11 12 .. contents:: Contents 13 14 15 GNU gettext, PHP and Horde 16 ========================== 17 18 Horde uses GNU gettext for internationalization (i18n) and localization 19 (l10n). The manual at http://www.gnu.org/manual/gettext/index.html is biased 20 against C and using Emacs. This is more for Horde. 21 22 There is a good explanation for PHP and gettext at: 23 http://www.faqts.com/knowledge-base/view.phtml/aid/2953/fid/422 24 25 People seem to like learning from examples better, so I have used dutch 26 (nl_NL) as an example everywhere. 27 28 There is a command line tool written in PHP for creating and managing 29 translations in the ``horde/po/`` directory. Usage instructions can be found 30 in ``horde/po/README`` as well as instructions on how to start and maintain 31 translations. 32 33 34 Translations don't work 35 ======================= 36 37 If all or some translations don't work on your system, please follow the steps 38 described below. If you want to ask for help either on the `i18n mailing 39 list`_ or on `Horde's bug system`_, please explain which steps you tried and 40 which failed. 41 42 You might also find some more information in the FAQ_. 43 44 Please note that Dutch (nl_NL) is only used as an example here. If you have 45 problems with a certain translation use this translation's language code 46 instead. 47 48 1. Is this locale (nl_NL) installed at all? 49 50 ``locale -a`` should list all locales installed on your system. 51 52 On Debian not all locales may be enabled by default. Edit 53 ``/etc/locale.gen`` and run ``locale-gen`` if you changed the list of 54 enabled locales. 55 56 2. Do you have any .mo files? 57 58 Usually in ``/usr/share/locale/`` 59 e.g. ``/usr/share/locale/nl/LC_MESSAGES/tar.mo`` 60 61 3. Does gettext even work? 62 63 Get a string to translate:: 64 65 $ strings /bin/tar | grep Memory 66 Memory exhausted 67 $ (LANG=nl_NL; LANGUAGE=nl_NL; LC_MESSAGES=nl_NL; gettext tar "Memory exhausted" ) 68 Geheugen uitgeput 69 70 4. Does the local Horde file work? 71 72 Assuming that you have put the translated Horde file in 73 ``/data/www/horde/locale/nl_NL/LC_MESSAGES/horde.mo``:: 74 75 $ export TEXTDOMAINDIR=/data/www/horde/locale 76 $ (LANG=nl_NL; LANGUAGE=nl_NL; LC_MESSAGES=nl_NL; gettext horde "Message" ) 77 Bericht 78 79 Create a file in the horde directory, langtest.php:: 80 81 <?php 82 83 setlocale(LC_MESSAGES, 'nl_NL'); 84 putenv('LANG=nl_NL'); 85 putenv('LANGUAGE=nl_NL'); 86 // use the tar test. 87 echo dgettext('tar', 'Memory exhausted'); 88 echo '<br />'; 89 90 // Specify location of translation tables 91 bindtextdomain('horde', './locale'); 92 93 // Choose domain 94 textdomain('horde'); 95 96 // Print the already tested message 97 echo _("Message"); 98 echo '<br />'; 99 100 // this should print the same. 101 echo dgettext('horde', 'Message'); 102 103 ?> 104 105 Output web browser:: 106 107 Geheugen uitgeput 108 Bericht 109 Bericht 110 111 112 .. _`i18n mailing list`: http://horde.org/mail/ 113 .. _`Horde's bug system`: http://bugs.horde.org 114 .. _FAQ: http://horde.org/faq/ 115 116 117 Solaris 118 ======= 119 120 Since the .mo files are binary, they are platform specific. You have to rerun 121 make in all po directories. 122 123 On Solaris 7, you don't have the ``Partial Locales (SUNWploc)`` and 124 ``Supplementary Partial Locales (SUNWploc1)`` packages installed if you get:: 125 126 $ LANG=nl_NL 127 couldn't set locale correctly 128 129 On Solaris 8, you must install the local packages required for the locales you 130 desire (for example, you may need to install ``SUNWweuos`` for Western 131 European locales or ``SUNWmeaos`` for Middle Eastern locales). The packages 132 are located on Software Disk 1 of 2 in the directory: 133 ``sol_8_1001_sparc/s0/Solaris_8/Product`` 134 135 This is what it should say: 136 137 Solaris 7:: 138 139 $ pkginfo | grep ploc 140 system SUNWploc Partial Locales 141 system SUNWploc1 Supplementary Partial Locales 142 143 Solaris 8:: 144 145 $ pkginfo | grep euo 146 system SUNWceuos Central Europe OS Support 147 system SUNWceuox Central Europe 64-bit OS Support 148 system SUNWeeuos Eastern Europe OS Support 149 system SUNWeeuox Eastern Europe 64-bit OS Support 150 system SUNWneuos Northern Europe OS Support 151 system SUNWneuox Northern Europe 64-bit OS Support 152 system SUNWseuos Southern Europe OS Support 153 system SUNWseuox Southern Europe 64-bit OS Support 154 system SUNWweuos Western Europe OS Support 155 system SUNWweuox Western Europe 64-bit OS Support 156 157 The stuff is installed in ``/usr/lib/locale``:: 158 159 $ ls /usr/lib/locale/nl 160 LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME nl.so.1 161 162 It was reported that the HTTP server has to be linked to the same libintl.so 163 file as PHP on Solaris. Also, it may be required that libintl.so be loaded 164 before libc is loaded. If you are having conflicts, you may be able to reside 165 them by starting apache with one of the following commands:: 166 167 $ LD_PRELOAD=libintl.so apachectl start 168 169 170 FreeBSD 171 ======= 172 173 To enable UTF-8 support in Horde, you also need UTF-8 support in 174 FreeBSD. This is not installed by default, you need to install the 175 ``utf8locale-without-swidth-040319`` package or port.
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |