Elric's random thoughts in idle times

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

Archive for the ‘l10n’ Category

Using vim-addons and PO plugin

leave a comment »

I really like vim-addons. It provides a very convenient and quick way to install, enable, disable, and more, addons for Vim. You can do it per-user if you run without privileges (a link is created under ~/.vim, or system-wide. To work, it needs some data fields in a yaml file for every plugin. The package vim-scripts in Debian provides such file, so I just used that one.

By default, vim-addons searches for plugins under /usr/share/vim/addons, whereas the plugins provided by vim-scripts are located under /usr/share/vim-scripts. This means you can add any plugin under /addons with the knowledge that it won’t interfere with other vim-scripts.

The reason I did this is because I don’t like the PO plugin file provided with vim-scripts. I rather like its fork, which also includes documentation. This is the entry I created for it in /usr/share/vim/registry/vim-scripts.yaml. You can also create a new yaml file and place it under the same directory. I didn’t have to specify the field basedir, as I placed the files under vim/addons.

addon: po-fork
description: "Enhanced PO addon"
disabledby: "let loaded_alternateFile = 1"
- ftplugin/po.vim
- doc/po.txt

This done, use vim-addons list to see all addons with a yaml file, and vim-addons install addon to activate it. Use vim-addons help to get an idea of what you can do with this program.


Written by elric80

December 1, 2010 at 12:30 pm

Posted in debian, l10n, linux, vim

Tagged with , , , ,

Debian: virtaal 0.6.1 and translate-toolkit 1.7

with 3 comments

Edit: You might want to try the newest beta releases. The packages have been tested on Debian Squeeze and Ubuntu 10.04 and 10.10, and work just fine. Take a look into the amazing enhancements this release will offer by downloading the deb packages from Translate.org.za!

Definitely, virtaal is my po editor of choice. It’s clean interface and ease of use are the best virtues of this application. translate-toolkit is a dependency for virtaal and Pootle as well as a CLI tool to manipulate po files. If you haven’t used it yet, you’ll be surprised by the enhances it may bring to your work.
Ok, virtaal doesn’t do half of what Lokalize does, but I only use a quarter of what Lokalize does. Gtranslator is a fine tool, but development seems to be stopped. It is a stable and full piece of software, but I’m not a fan of the interface either. Poedit isn’t that great, in my opinion. However, Virtaal’s integration with translate-toolkit, offering nice enhancements, promising a bright future, and its interface just beat all aforementioned.

Obligatory image:

As you can see there are NO extra buttons, and the layout looks like a side-by-side sheet presentation. Beautiful.
It also allows access to machine translation services such as Google, Moses and Opentran. Other features include highlighted diffs between the translation memory suggestions, a don’t-touch-your-mouse approach, and much more.

One thing that saddens me is how late updates can be for these two packages in Debian (not incredibly late, just to much for me to wait :), and in this particular case, there was a bug rendering the preferences window pretty useless that was fixed in this release (thanks to Walter). As I couldn’t wait for long :) I just built the packages from the latest sources. It’s working great for me, but use at your own risk.
Actually, I’m doing this so often (build newer packages or rebuild other with different options) that I should consider starting a ppa. Anway, these are the links for both packages.



Happy FOSS translating!

Written by elric80

June 4, 2010 at 11:10 am

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 , , , , ,