Elric's random thoughts in idle times

"Why stop now, when I'm just starting to hate it?" – Marvin the robot

Posts Tagged ‘po4a

po4a and vim-doc-es. Example of text format usage.

leave a comment »

po4a and vim are among my favourite FOSS applications ever since I started to like GNU/Linux systems. Some time ago, I joined vim-doc-es and (recently) po4a projects as a translator. However, I was in grief as I couldn’t use po4a in my vim-doc-es project due to some formatting problems. Up to now :)

This post is for people who don’t know about po4a, and intended as a simple example of adapting po4a to your project (or the other way around) if it’s just documentation what you need to translate. The po4a.cfg file is so complete I had no need to change the directory structure, though I guess it may be neccesarry in projects where you need to extract the translatable strings from the code. At vim-doc-es we only deal with text format (I would like to go html some time). The requirements of po4a in this project are very simple. I hope this will enlighten your way if you’ve never touched po4a before.

As I said, the central part of automatizing po4a in your project is the po4a.cfg file. Here’s vim-doc-es one.

# vim-doc-es po4a.cfg

[po4a_langs] es

# The languages to which you want to translate the document.

[po4a_paths] original/POT/$master.pot es:traducido/PO/$master.po

# The paths to both pot’s and po’s. The $master variable is perfect when you need to translate several documents. If you only have one document, you may do the following.

[po4a_paths] original/POT/original.pot $lang:traducido/PO/$lang.po

# In this case, original.pot would be translated to as many languages as specified in the [po4a_langs] field.

# General options for po4a (po4a-translate and po4a-updatepo). Specify the module options below.

[options] opt:"-v --package-name Vim --package-version 7.2\
--msgid-bugs-address vim@bugs.org --no-backups"

# You can see here that some fields are automatically filled up with po4a.

# Aliases for the text module. You may create as many aliases as needed, or none and just use [type:module] for every document.

[po4a_alias:vimtxt] text opt:"-M utf-8 -L utf-8 -o tabs=verbatim -o nobullets"
[po4a_alias:vimtxt0] text opt:"-M utf-8 -L utf-8 -k 0 -o tabs=verbatim -o nobullets"
# I need one file to recieve different options.

# List of documents. The source and destination paths of the original and translated document. You may use the $lang variable in case you have more languages. Note how every document is set to a module alias, not to the module itself. You can specify as many format modules as needed.

# help.txt
[type:vimtxt] original/TXT/help.txt es:traducido/ESX/help.esx

# Tabla de contenidos
[type:vimtxt0] original/TXT/usr_toc.txt es:traducido/ESX/usr_toc.esx

# Manual de usuario.
[type:vimtxt] original/TXT/usr_01.txt es:traducido/ESX/usr_01.esx
[type:vimtxt] original/TXT/usr_02.txt es:traducido/ESX/usr_02.esx
[type:vimtxt] original/TXT/usr_03.txt es:traducido/ESX/usr_03.esx
[type:vimtxt] original/TXT/usr_04.txt es:traducido/ESX/usr_04.esx
[type:vimtxt] original/TXT/usr_05.txt es:traducido/ESX/usr_05.esx
[type:vimtxt] original/TXT/usr_06.txt es:traducido/ESX/usr_06.esx
[type:vimtxt] original/TXT/usr_07.txt es:traducido/ESX/usr_07.esx
[type:vimtxt] original/TXT/usr_08.txt es:traducido/ESX/usr_08.esx
[type:vimtxt] original/TXT/usr_09.txt es:traducido/ESX/usr_09.esx
[type:vimtxt] original/TXT/usr_10.txt es:traducido/ESX/usr_10.esx
[type:vimtxt] original/TXT/usr_11.txt es:traducido/ESX/usr_11.esx
[type:vimtxt] original/TXT/usr_12.txt es:traducido/ESX/usr_12.esx
[type:vimtxt] original/TXT/usr_20.txt es:traducido/ESX/usr_20.esx
[type:vimtxt] original/TXT/usr_21.txt es:traducido/ESX/usr_21.esx
[type:vimtxt] original/TXT/usr_22.txt es:traducido/ESX/usr_22.esx
[type:vimtxt] original/TXT/usr_23.txt es:traducido/ESX/usr_23.esx
[type:vimtxt] original/TXT/usr_24.txt es:traducido/ESX/usr_24.esx

Running “po4a po4a.cfg” updates pot and po files, as well as the translated documents.
And that’s about it. Easy and cool.

Written by elric80

November 24, 2009 at 3:56 pm

Posted in l10n, linux

Tagged with , , , ,

po4a. Gestión del formato y las traducciones de documentación

leave a comment »

po4a es un programa que me lleva fascinando un tiempo. Tanto que he acabado actualizando su extenso y completo manual, lo cual me ha llevado a aprender mejor su uso. Así mismo, es mi herramienta predilecta en el proyecto vim-doc-es, del cual formo parte (sin desmerecer el excelente translate toolkit).
Ayer mismo salió la versión 0.37 de po4a, que trae importantes mejoras para aquellos desarrolladores que desean localizar los documentos de ayuda (generalmente páginas de manual) de su programa. Read the rest of this entry »

Written by elric80

November 21, 2009 at 3:05 pm

Posted in debian, l10n, linux

Tagged with , , , , ,