Translating Ruby on Rails 2.2+ yml files

Asked by Shaun McDonald

Is it possible to use Launchpad to translate Ruby on Rails 2.2+ yml files. I would like to use Launchpad for translating the OpenStreetMap web site, and I'm currently using the new Rails i18n implementation that came in Rails 2.2.

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
Shaun McDonald
Solved:
Last query:
Last reply:
Revision history for this message
Adi Roiban (adiroiban) said :
#1

Hi,

Launchpad Translation only support Gettext PO files. YAML is a general file format, like CSV or XML.

In this case you should convert the yaml file to po. This is how is done for translating XML/Docbook files.

Unfortunalty I am not aware of any converter from YAML to PO.

The format of a PO file is very simple and it should be easy to implement a converter
http://www.gnu.org/software/hello/manual/gettext/PO-Files.html

Cheers,
Adi

Revision history for this message
Daniel de Souza Telles (danielsouza) said :
#2

I'm on a need of a converter of yml2po too.

Revision history for this message
Shaun McDonald (smsm1) said :
#3

Take a look at http://svn.openstreetmap.org/sites/rails_port/script/locale/ for the start of a couple of conversion scripts by Thomas Wood.

Revision history for this message
Daniel de Souza Telles (danielsouza) said :
#4

smsm1 thanks a lot, but i'm having a problem with it.

"daniel@opensuse-n1:~/Desktop/jgilliam-nationbuilder-22baa4e42bfc3c2de91e25d57fe9b3c69f538648> yaml2po --all
/usr/lib64/ruby/1.8/yaml.rb:143:in `initialize': No such file or directory - ./../../config/locales/en.yml (Errno::ENOENT)
 from /usr/lib64/ruby/1.8/yaml.rb:143:in `open'
 from /usr/lib64/ruby/1.8/yaml.rb:143:in `load_file'
 from ./yaml2po:16"

Revision history for this message
Shaun McDonald (smsm1) said :
#5

The problem you are having is the location of the script relative to the en.yml file.

Revision history for this message
Daniel de Souza Telles (danielsouza) said :
#6

smsm1 i don't know what i have to do, please help me as I don't understand ruby, i'm only a translator on this project.

daniel@opensuse-n1:~> ls --recursive /home/daniel/Desktop/nationbuilder/config/locales/
/home/daniel/Desktop/nationbuilder/config/locales/:
activities general menu notifications

/home/daniel/Desktop/nationbuilder/config/locales/activities:
en.yml

/home/daniel/Desktop/nationbuilder/config/locales/general:
en.yml

/home/daniel/Desktop/nationbuilder/config/locales/menu:
en.yml

/home/daniel/Desktop/nationbuilder/config/locales/notifications:
en.yml