Donnerstag, 15. August 2013

Create *.po translation files from Vala Sources with context information in Ubuntu / Linux

I recently tried to create a *.po-File for translations strings from Vala sources which include locale context information.
As it was not so easy to figure out the right command, I thought I would share it with the internet folks:

xgettext -o result.po -L C -k_ --keyword=C_:1c,2 src/*.vala

So how does this work ?
  • xgettext extracts the translatable strings from the sources 
  • ...and puts it into the output file (-o result.po)
  • ...it also requires a defined programming language in this case C (-L C)
  • ...and needs to know what are translatable keywords (_ for strings and C_:1c,2 for contextual information, in this case)
  • ...finally set the input files (src/*.vala)
It's not that hard if you understand how it works :)

Keine Kommentare:

Kommentar veröffentlichen