Tutorial: Translating alphaOS Vala applications

Tutorials & Tips
simargl
Site Admin
Posts: 466
Joined: 16 May 2013, 10:54
Contact:

Tutorial: Translating alphaOS Vala applications

Postby simargl » 07 Jan 2014, 19:52

Setup and submit changes

To start translating applications and submitting your changes to central alphaos repository first you need to open bitbucket account.

Currently all 6 Vala applications:
control-center
emendo
gmp-video
simple-radio
taeni
wpset
have localization support. They all are ATM translated to Serbian, you can use that as example. All have same Makefile and same directory structure.

When you make your bitbucket account, first go to https://bitbucket.org/simargl/alphaos and fork that repository.

Then clone:

Code: Select all

hg clone https://bitbucket.org/your-account-name/alphaos


make changes in cloned repository on your disk, commit and start pull request
https://confluence.atlassian.com/displa ... l+requests

How to translate Vala applications?

For example let's see how to translate emendo text editor to Italian locale, it_IT.

In alphaos repository base program directory for emendo is alphaos/def-scripts/03_extra/emendo/emendo, so change to that directory.

Translations files are in po directory, go there and make directory named it. Then you need to make po file for Italian from global pot file.

Use this command:

Code: Select all

msginit -l it_IT -o it/emendo.po -i emendo.pot


Translate strings from it/emendo.po, then go to Emendo base directory, to adjust Makefile. In that file you need to change lines in gen_mo, gen_po, install and uninstall

Current

Code: Select all

gen_mo:
   msgfmt -c -v -o po/sr/$(BINARY).mo po/sr/$(BINARY).po

gen_po:
   ....
   msgmerge -s -U po/sr/$(BINARY).po po/$(BINARY).pot

install: all gen_mo
   ...
   install -Dm644 po/sr/$(BINARY).mo $(DESTDIR)/usr/share/locale/sr/LC_MESSAGES/$(BINARY).mo

uninstall:
   ...
   rm $(DESTDIR)/usr/share/locale/sr/LC_MESSAGES/$(BINARY).mo


What you need to add?

Code: Select all

gen_mo:
   msgfmt -c -v -o po/it/$(BINARY).mo po/it/$(BINARY).po
   msgfmt -c -v -o po/sr/$(BINARY).mo po/sr/$(BINARY).po

gen_po:
   ....
   msgmerge -s -U po/it/$(BINARY).po po/$(BINARY).pot
   msgmerge -s -U po/sr/$(BINARY).po po/$(BINARY).pot

install: all gen_mo
   ...
   install -Dm644 po/it/$(BINARY).mo $(DESTDIR)/usr/share/locale/it/LC_MESSAGES/$(BINARY).mo
   install -Dm644 po/sr/$(BINARY).mo $(DESTDIR)/usr/share/locale/sr/LC_MESSAGES/$(BINARY).mo

uninstall:
   ...
   rm $(DESTDIR)/usr/share/locale/it/LC_MESSAGES/$(BINARY).mo
   rm $(DESTDIR)/usr/share/locale/sr/LC_MESSAGES/$(BINARY).mo


With make gen_po, pot and po files are automatically updated when it's needed for additional strings. Locales in Makefile should be in alphabetical order.

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 0 guests

cron