head	1.2;
access;
symbols
	HORDE_2_0_RC3:1.1.2.1
	HORDE_2_0:1.1.2.1
	HORDE_2_0_RC2:1.1
	RELENG_2:1.1.0.2
	HORDE_2_0_0_RC1:1.1;
locks; strict;
comment	@# @;


1.2
date	2001.11.28.19.45.30;	author jan;	state Exp;
branches;
next	1.1;

1.1
date	2001.09.07.19.55.56;	author chuck;	state Exp;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2001.11.28.19.47.49;	author jan;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Update to our new locale scheme. Add content table. Add hint how to
customize the English texts.
@
text
@Horde Translation Guide
Copyright 2000 Joris Braakman <jbraakman@@yahoo.com>
Copyright 2001 Chuck Hagenbuch <chuck@@horde.org>
Copyright 2001 Jan Schneider <jan@@horde.org>

Contents
========
- GNU gettext, PHP and Horde
- Starting a new translation
- Example messages header
- Updating a existing translation
- Debugging
- Solaris 2.6
- Changing the English standard texts


GNU gettext, PHP and Horde
--------------------------

Horde uses GNU gettext for internationalization (i18n) and localization
(l10n). The manual at http://www.gnu.org/manual/gettext/index.html is
biased against C and using Emacs. This is more for Horde.

There is a good explanation for PHP and gettext at:
http://www.faqts.com/knowledge-base/view.phtml/aid/2953/fid/422

People seem to like learning from examples better, so I have used
dutch (nl_NL) as an example everywhere.


Starting a new translation
--------------------------

- run xgettext.sh (in this directory - horde/po/), this generates a
  messages.po file.
- rename it to the language you are translating to, e.g. nl_NL.po
- adjust the header of nl_NL.po, then remove the #, fuzzy line.
  Emacs has support for .po files, but I used vi
- translate, the time consuming part.
- convert the nl_NL.po to horde.mo and put the file in place:
$ make install
Compiling locale nl_NL:
261 translated messages, 21 untranslated messages.
  ... done

- modify the horde/config/lang.php to use nl_NL as the default language, if you
  wish.
- Make sure your language exists in the horde/config/lang.php file. Also, if
  the translation uses a character set that isn't ascii, make sure the
  appropriate charset is defined in $nls['charsets']. You should also define
  an alias for the language because some browsers only send a two letter code
  in their Accept-Charset header.

And then it works.


Example messages header
-----------------------
# Dutch translation for Horde.
# Joris Braakman <jbraakman@@yahoo.com>, 2000.
#
msgid ""
msgstr ""
"Project-Id-Version: Horde 2.3\n"
"POT-Creation-Date: 2000-08-14 10:30+0200\n"
"PO-Revision-Date: 2000-08-14 17:17+02:00\n"
"Last-Translator: Joris Braakman <jbraakman@@yahoo.com>\n"
"Language-Team: Dutch <dev@@lists.horde.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8-bit\n"


Updating a existing translation
-------------------------------
As soon as you check out a new version you have to check the translations
again, messages might have been changed after all. If you don't, you
can get strange effects.  Information is cached every where so as a no
brain solutions I sometimes also restart the webbrowser and webserver
to make sure everything is fresh. msgmerge will mark translations that
have changed a bit to fuzzy.

- run xgettext.sh again, this generates a messages.po file.
- merge it with the old .po file:
$ msgmerge nl_NL.po messages.po > nl_NL-new.po

- translate/update the strings that are new or have become fuzzy..
- move the nl_NL-new.po to nl_NL.po
- put the new translations in effect
$ make install
Compiling locale nl_NL:
261 translated messages, 21 untranslated messages.
  ... done


Debugging
---------
Is this locale (nl_NL) installed at all?
$ locale -a
should list all locales installed on your system.

Do you have any .mo files? Usually in /usr/share/locale/
e.g. /usr/share/locale/nl/LC_MESSAGES/tar.mo

Does gettext even work?
Get a string to translate,
$ strings /bin/tar | grep Memory
Memory exhausted
$ (LANG=nl_NL; gettext tar "Memory exhausted" )
Geheugen uitgeput

On some systems you need to set the LANGUAGE variable instead:
$ (LANGUAGE=nl_NL; gettext tar "Memory exhausted" )

Does the local Horde file work?
Assuming that you have put the translated Horde file in
/data/www/horde/locale/nl_NL/LC_MESSAGES/horde.mo
$ export TEXTDOMAINDIR=/data/www/horde/locale
$ (LANG=nl_NL; gettext horde "Message" )
Bericht

Create a file in the horde directory, langtest.php:
<?php
putenv('LANG=nl_NL');
// use the tar test.
echo dgettext('tar', 'Memory exhausted');
echo '<br />';

// Specify location of translation tables
bindtextdomain('horde', './locale');

// Choose domain
textdomain('horde');

// Print the already tested message
echo _("Message");
echo '<br />';

// this should print the same.
echo dgettext('horde', 'Message');

?>

OUTPUT web browser:
Geheugen uitgeput
Bericht
Bericht


Solaris 2.6
-----------
Since the .mo files are binary, they are platform specific. You
have to rerun the msgfmt command.
$ msgfmt -v -o ../locale/nl_NL/LC_MESSAGES/horde.mo nl_NL.po
Processing file "nl_NL.po"...

You have not installed the Supplementary Partial Locales (SUNWploc1) if
you get:
$ LANG=nl_NL
couldn't set locale correctly

This is what it should say.
$ pkginfo | grep ploc
system      SUNWploc       Partial Locales
system      SUNWploc1      Supplementary Partial Locales


The stuff is installed in /usr/lib/locale
$ ls /usr/lib/locale/nl
LC_COLLATE   LC_CTYPE     LC_MESSAGES  LC_MONETARY  LC_NUMERIC   LC_TIME      nl.so.1


Changing the English standard texts
-----------------------------------
You can also use gettext to change some of the English texts to your own taste.

- Create a message.po file as described in "Starting a new translation"
- Edit the msgstr entry of the strings you want to change. You can leave all
other msgstr entries empty.
- Run "make install"
@


1.1
log
@documentation is good.
@
text
@d4 1
d6 13
a18 2
GNU gettext, PHP and Horde.
-------------------------
d28 1
a28 1
dutch (nl) as an example everywhere.
d36 2
a37 2
- rename it to the language you are translating to, e.g. nl.po
- adjust the header of nl.po, then remove the #, fuzzy line.
d40 1
a40 1
- convert the nl.po to horde.mo and put the file in place:
d42 1
a42 1
Compiling locale nl:
d46 1
a46 1
- modify the horde/config/horde.php to use nl as the default language, if you
d50 3
a52 1
  appropriate charset is defined in $nls['charsets'].
d56 1
d58 1
a58 1
------------------------------------------
d64 1
a64 1
"Project-Id-Version: horde 2.3\n"
d68 1
a68 1
"Language-Team: Dutch <nl@@li.org>\n"
d85 1
a85 1
$ msgmerge nl.po messages.po > nl-new.po
d88 1
a88 1
- move the nl-new.po to nl.po
d91 1
a91 1
Compiling locale nl:
d95 1
d98 4
d109 1
a109 1
$ (LANG=nl; gettext tar "Memory exhausted" )
d112 3
d117 1
a117 1
/data/www/horde/locale/nl/LC_MESSAGES/horde.mo
d119 2
a120 2
$ (LANG=nl; gettext horde "Save as" )
Bewaren als
d124 1
a124 1
putenv('LANG=nl');
d136 1
a136 1
echo _("Save as");
d140 1
a140 1
echo dgettext('horde', 'Save as');
d146 3
a148 2
Bewaren als
Bewaren als
d154 2
a155 2
$ msgfmt -v -o ../locale/nl/LC_MESSAGES/horde.mo nl.po
Processing file "nl.po"...
d159 1
a159 1
$ LANG=nl
d171 10
@


1.1.2.1
log
@MFH 1.2: Update
@
text
@a3 1
Copyright 2001 Jan Schneider <jan@@horde.org>
d5 2
a6 13
Contents
========
- GNU gettext, PHP and Horde
- Starting a new translation
- Example messages header
- Updating a existing translation
- Debugging
- Solaris 2.6
- Changing the English standard texts


GNU gettext, PHP and Horde
--------------------------
d16 1
a16 1
dutch (nl_NL) as an example everywhere.
d24 2
a25 2
- rename it to the language you are translating to, e.g. nl_NL.po
- adjust the header of nl_NL.po, then remove the #, fuzzy line.
d28 1
a28 1
- convert the nl_NL.po to horde.mo and put the file in place:
d30 1
a30 1
Compiling locale nl_NL:
d34 1
a34 1
- modify the horde/config/lang.php to use nl_NL as the default language, if you
d38 1
a38 3
  appropriate charset is defined in $nls['charsets']. You should also define
  an alias for the language because some browsers only send a two letter code
  in their Accept-Charset header.
a41 1

d43 1
a43 1
-----------------------
d49 1
a49 1
"Project-Id-Version: Horde 2.3\n"
d53 1
a53 1
"Language-Team: Dutch <dev@@lists.horde.org>\n"
d70 1
a70 1
$ msgmerge nl_NL.po messages.po > nl_NL-new.po
d73 1
a73 1
- move the nl_NL-new.po to nl_NL.po
d76 1
a76 1
Compiling locale nl_NL:
a79 1

a81 4
Is this locale (nl_NL) installed at all?
$ locale -a
should list all locales installed on your system.

d89 1
a89 1
$ (LANG=nl_NL; gettext tar "Memory exhausted" )
a91 3
On some systems you need to set the LANGUAGE variable instead:
$ (LANGUAGE=nl_NL; gettext tar "Memory exhausted" )

d94 1
a94 1
/data/www/horde/locale/nl_NL/LC_MESSAGES/horde.mo
d96 2
a97 2
$ (LANG=nl_NL; gettext horde "Message" )
Bericht
d101 1
a101 1
putenv('LANG=nl_NL');
d113 1
a113 1
echo _("Message");
d117 1
a117 1
echo dgettext('horde', 'Message');
d123 2
a124 3
Bericht
Bericht

d130 2
a131 2
$ msgfmt -v -o ../locale/nl_NL/LC_MESSAGES/horde.mo nl_NL.po
Processing file "nl_NL.po"...
d135 1
a135 1
$ LANG=nl_NL
a146 10


Changing the English standard texts
-----------------------------------
You can also use gettext to change some of the English texts to your own taste.

- Create a message.po file as described in "Starting a new translation"
- Edit the msgstr entry of the strings you want to change. You can leave all
other msgstr entries empty.
- Run "make install"
@


