Internationalization and Act

An interesting question came up today regarding our team’s Act development for YAPC::NA: Are we going to take the effort to maintain internationalization for the new features we add? My answer was an emphatic yes!

We’re a US conference, with a team largely composed of US programmers (we have a few foreigners lending us a hand; thanks, guys!). Even so, Perl is not exclusively a US programming language; people all over the world use Perl for just about everything! The Act team has been doing a great job making their application available to people speaking a variety of languages, and I’m proud to carry on that tradition. Now, if you’ve never written internationalized code before, the prospect may seem a bit daunting; so here’s a tip you can use when working on Act:

When you’re working on the code or templates, and you come across a string of text that is intended to be displayed to the user (more likely in the latter case), make sure you wrap that text in one of the following:

  • localize(…) - for Perl code
  • loc(…) - for Template Toolkit code
  • {{…}} - for template contents

This file demonstrates how to use the latter two.

After you’ve done this, you will likely notice your string has been replaced by ‘TRANSLATEME’ when you run the application. You need to add the English localization for that string to po/en.po. You may notice that the po/ directory contains a lot of localization files; you can leave these alone, as we don’t expect everyone to speak all of those languages! Of course, if you do speak one of these languages, feel free to add any missing localizations!

On that topic, we still need translators for the internationalized code. I’ve been providing German translations thus far (only for Germany-German; I wasn’t going to naïvely assume my dialect would pass as Austrian German!), so we still need a lot of translations. Also, on a side note, if you’re a native speaker of German, please give my translations a look. I can get by and make myself understood in German, but I’m afraid I’m still at the level where what I say sometimes sounds unnatural to a native.

-Rob

Leave a comment

About JT Smith

user-pic My little part in the greater Perl world.