Localization in Windows Tip

Real Studio makes it very easy to create localized applications. When you use Dynamic Constants and create strings based on language the application will switch, at runtime, to the proper language. It’s pretty easy and straightforward.

In Windows, the only thing you have to do to set the language to something other than the default language is to change the Date/Time format settings in the control panel in Windows 7 to the language (and variation) of choice. This makes it very easy to test since you can have a different OS language than your apps (even if you can’t read the language).

This week, however, we had a client take our Spanish (and English) localized apps to a country in South America for installation only to find out that their default configuration is to leave everything in English. That meant the apps wouldn’t run in Spanish. I have no idea why they do this, but it certainly wasn’t what my client expected!

Major bummer and we all went into panic mode.  We went through various ideas on how to get work around the situation (and all of them ugly) until we stumbled upon the idea that the en.mo and es.mo files (located in the Resources directory next to the executable) could be swapped. So, we deleted the en.mo file and then renamed the es.mo to en.mo.

Voila! Problem solved. The client is happy, the folks on site are happy, and ultimately that makes me happy. The only minor issue is that the apps won’t run in English without swapping the files around again.

Happy coding!

Localization in Real Studio

We have clients all over the world and surprisingly most of them want their apps in English. It’s been kind of an oddity that up until a few months ago we have not had to localize an application. While it’s not hard, there are some things that are just harder than it should be.

Real Studio has some of the tools in place to make the localization process relatively easy with Dynamic Constants. Dynamic Constants let you localize strings per platform and per language. This is handy, for example, with platform differences such as Mac OS X calling it Preferences while Windows apps like to call it Options. Same with File->Quit versus File->Exit menu commands on Mac and Windows respectively.

Once you’ve created the dynamic constant strings you can then export a single Language to Lingua that the linguists can then search for missing strings and provide a translation. Lingua is only a marginally useful utility. Its biggest drawback, in my opinion, is that it only handles one language at a time. It would be way more useful if I could export selected languages from my project and have my translators be able to work on all of them.

In my most recent project I really only had to worry about Spanish so this wasn’t a concern but I could see this being an issue in the future. Of course, this feature might be useful in certain circumstances as I might be sending the Lingua files to multiple people for only the languages they handle. Either way, I only have one option now and it would be nice to have the option.

One of the things that’s missing from Real Studio is the ability to search for missing Dynamic Strings for a particular language. The only way to do this is to check each dynamic constant to see if it has a translation or run the app in the language in question and test, test, test and test some more.

If you’re not disciplined when you start your project and make all strings constants you have to search for strings after the fact. This is a royal pain – especially in large projects. In the project in question I had 30 windows, 86 classes, 28 modules and 30,000+ lines of code. And I had to do this in 2 additional sister projects (the UI was similar but each had slightly different functionality). The thought of searching all that code (3 times no less) didn’t make me happy. There had to be a way of making this easier.

The utility that I ended up using was, in fact, quite useful. Arbed http://www.tempel.org/Arbed/Arbedfrom long time Real Studio developer Thomas Tempelmann, makes this process relatively easy. It will scan your xml or binary project files searching out all strings. You then have the option of putting these strings in a global modules or making the constants local to the object. Furthermore, if you tell it to group the constants it will use the same constant for multiple instances of the same string. Be warned however as some words may actually mean different things in different contexts so you might have to break them out later.

Arbed does much more than just dynamic string creation and I highly recommend taking a look at if you are a Real Studio developer. It has a number of features that no other utility has.

Back to the Real Studio IDE. The constants editor is okay for dynamic strings but it’s not exceptionally smooth and like many of the editors in the IDE it’s acts stupidly at times causing me to pause for a moment until it will recognize a mouse click. Ideally, when it comes to dynamic strings in controls, I’d like to somehow have the creation of the dynamic string in the properties list without having to break concentration to go to a separate editor. I also find myself doing a lot of unnecessary copy/pastes.

It would be handy to be able to tell the IDE to make a string property a dynamic constant (using some standardized rules) so make it even easier. Perhaps when Real Studio releases their new IDE interface with its redesigned properties list (it’s no longer a listbox but dynamically generated controls from what little I’ve seen of the UI so far) they’ll somehow make this a reality in a future version.

I’m NOT a normal user of Real Studio. I understand that. This pain isn’t something most users are experiencing. But, the localization process could be simpler and making it simpler makes Real Studio even that much more powerful. Let’s hope they can do something in future versions of Real Studio.

What pains have you experienced localizing a project in Real Studio?