From owner-freebsd-translators@FreeBSD.ORG Tue Dec 16 23:14:02 2014 Return-Path: Delivered-To: freebsd-translators@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E7753306 for ; Tue, 16 Dec 2014 23:14:01 +0000 (UTC) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F0FB10B for ; Tue, 16 Dec 2014 23:14:01 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.9/8.14.9) with ESMTP id sBGNDsnd072054 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 16 Dec 2014 16:13:54 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.9/8.14.9/Submit) with ESMTP id sBGNDsYB072051 for ; Tue, 16 Dec 2014 16:13:54 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Tue, 16 Dec 2014 16:13:54 -0700 (MST) From: Warren Block To: freebsd-translators@FreeBSD.org Subject: A Trivial Translation Example Message-ID: User-Agent: Alpine 2.11 (BSF 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Tue, 16 Dec 2014 16:13:54 -0700 (MST) 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: Tue, 16 Dec 2014 23:14:02 -0000 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:
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.