From owner-freebsd-translators@FreeBSD.ORG Wed Dec 17 13:07:25 2014 Return-Path: Delivered-To: freebsd-translators@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5B6FEA29 for ; Wed, 17 Dec 2014 13:07:25 +0000 (UTC) Received: from mxout2.bln1.prohost.de (mxout2.bln1.prohost.de [91.233.87.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.prossl.de", Issuer "RapidSSL SHA256 CA - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E58209D7 for ; Wed, 17 Dec 2014 13:07:21 +0000 (UTC) Received: from fbipool-clients-45-68.fbi.h-da.de (fbipool-clients-45-68.fbi.h-da.de [141.100.45.68]) (authenticated bits=0) by mx1.bln1.prohost.de (8.14.9/8.14.9) with ESMTP id sBHD7CWO004827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 17 Dec 2014 14:07:12 +0100 Message-ID: <54918000.6010802@FreeBSD.org> Date: Wed, 17 Dec 2014 14:07:12 +0100 From: Benedict Reuschling Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: freebsd-translators@freebsd.org Subject: Re: A Trivial Translation Example References: In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Null-Tag: 63f616a39b45a66d78bb8ce6a801c908 X-BeenThere: freebsd-translators@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Translators List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Dec 2014 13:07:25 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Am 17.12.14 um 00:13 schrieb Warren Block: > A Trivial Translation Example > > Here I show a bare-minimum example that can be used to get an idea > of the PO translation process. > > 1. Install textproc/docproj, textproc/itstool, and editors/poedit. > > 2. In a documentation tree checkout, create a new directory: mkdir > -p en_US.ISO8859-1/articles/translate-example/translated cd > en_US.ISO8859-1/articles/translate-example > > 3. Create a standard documentation Makefile: > > # # $FreeBSD$ # > > DOC?= article > > FORMATS?= html > > INSTALL_COMPRESSED?=gz INSTALL_ONLY_COMPRESSED?= > > SRCS= article.xml > > URL_RELPREFIX?= ../../../.. DOC_PREFIX?= ${.CURDIR}/../../.. > > .include "${DOC_PREFIX}/share/mk/doc.project.mk" > > 4. Create a sample article.xml: > > > > Extension//EN" > "http://www.FreeBSD.org/XML/share/xml/freebsd50.dtd"> > >
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" > xml:lang="en"> > > FreeBSD Translation Example > > Random > User > > > Translation Example > Article > > This sample article is very short. It exists to be used as > an example for translation software. > > 01 This program listing contains only plain text. > 02 It is only two lines long. > > This is the conclusion of this short sample article. >
> > 5. Generate a .pot file from the article using itstool. The > strings are extracted from article.xml into article.pot. This > overwrites the file, and would normally only be used the first time > a new translation is created: echo env `make -VXSLTPROC_ENV` > itstool -d -o article.pot article.xml | sh > > 6. Set a couple of values in the generated article.pot file to > silence warnings: on line 3, change "Project-Id-Version: PACKAGE > VERSION\n" to "Project-Id-Version: 1\n" add a new line after it > (this should be the actual language code, but I have just used > "en"): "Language: en\n" on line 8, change "Language-Team: LANGUAGE > \n" to "Language-Team: en\n" > > 7. Use poedit to enter translations: poedit article.pot Click on a > line to translate and enter the translation below it. When done, > click the Save icon and close poedit. Translated strings are > stored in the article.pot file. > > 8. After leaving poedit, generate a translated version of the > article: echo env `make -VXSLTPROC_ENV` \ itstool -d -m article.mo > -o translated article.xml | sh > > The translated version of the article is written to > translated/article.xml. The translated strings have replaced the > originals, and the article can be built with the documentation > tools. _______________________________________________ > freebsd-translators@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-translators To > unsubscribe, send any mail to > "freebsd-translators-unsubscribe@freebsd.org" Here is the workflow I figured out for textproc/po4a. Note that some of these instructions were originally provided by Thomas Abthorpe. 1. Install textproc/po4a and poedit 2., 3., and 4. are the same as above 3. Generate a POT file from po4a using this command: $ po4a-gettextize --copyright-holder "The FreeBSD Documentation Project" -f xml -m en_US.ISO8859-1/articles/translate-example/article.xml -p translate-example.pot 4. Copy translate-example.pot to translate-example.po: $ cp translate-example.pot translate-example.po This way, you can make changes to translate-example.po and regenerate translate-example.pot when needed without overwriting your translation work thus far. 5. Follow 6. above 6. Edit translate-example.po using poedit (there are also other editors in the ports collection you can use). Follow step 7. above. Make sure not to translate entities like &os; (if any). 7. You can view your translation progress any time by saving your file in poedit, then exiting the editor and issuing the following command: po4a-translate -k 0 -w 70 -f xml -m en_US.ISO8859-1/en_US.ISO8859-1/articles/translate-example/article.xml - -p translate-example.po -l translated/result.xml The important parameter is -k, which sets the translation threshold to 0. Without it, the threshold would be 80%, which means that no output would be generated because that amount of the document hasn't been translated yet. The -w parameter should wrap the lines at that number of characters (70 here), but it does not work. I just provided this for completeness. This is a mayor problem, as you'll see in step 8. So in general, use this command when you are completely finished translating or have just parts of it. 8. View translated/result.xml. You will notice that the file is not properly formatted anymore according to our documentation guidelines. The file does build, though when copied to ../article.xml (create a backup of it first). 9. You should now have a translated html version of the document. The mayor problem with that approach is reapplying our style to the resulting xml file. Because each time, when changes are made to the translated document and the po4a-translate command is run, the formatting is lost. It takes a lot of manual work to do this each time, so a script that does this would be fantastic to have. Here are some links that might help you with the above instructions: - - http://www.paolocorti.net/2012/01/05/managing_documentation_translations_with_open_source_tools/ - - https://wiki.mageia.org/en/Translation_with_Calenco_and_Gettext - - http://localization-guide.readthedocs.org/en/latest/guide/project/howto.html Regards Benedict Reuschling Documentation Committer The FreeBSD Project The FreeBSD Documentation Project -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUkYAAAAoJEAQa31nbPD2LPbAH/RO8cGMy9TQF9tW32n4AI7zp mPUbPqle44ZJergKVQ54SH6xebOOA+gLyaU1mnc3OdAJd7mHHXhqpOPWJqdz9+VE WIwdYrsZc8VYcX1sV3CUG8f/whsqYR7Zaby92KwnpRjJWN3yXX0b7ReSKSVHV/9h PmtqMjQbfrwS2My7PsBar+YVF8s9leYdUA/jg4/NQkWnd6OoFjK3t9+eKnh/DaMh wULhp5aiVIqABRBgDh9/lMhCT70rNLZFcktzZTPtnDe1cScy2GMrW23Sj7N2enA0 X44KSWjX26QEGzGVVllH/Fwj/JNLq/zGvOo8LBwBQJNptf95b7WdfRYVuLtsfhc= =NDvK -----END PGP SIGNATURE-----