Archive for the ‘programming’ Category

Using Google Docs For Software Localization

Friday, September 18th, 2009

Google provides some truly amazing automatic translation tools. And now translation is included in Google Docs. This turns out to be a powerful tool for software localization.

My current and probably long-term favorite development environment is Grails. Grails has great localization support build into it. An important piece of that is the messages.properties file, where you store all of your values that you want to be localized.

Actually, there can be lots of properties files. Grails actually ships with:

  • messages_de.properties
  • messages_es.properties
  • messages_fr.properties
  • messages_it.properties
  • messages_ja.properties
  • messages_nl.properties
  • messages_pt_BR.properties
  • messages_ru.properties
  • messages_th.properties
  • messages_zh_CN.properties

For example, messages_fr.properties is for French.

All the base files have translations of commonly used words. As you add more functionality to your application, you of course need more labels and buttons, etc. So you add them to your messages.properties file. Then all you have to do is translate your file into all these and other languages. The good news is that you can use Google Docs to get the job done. Or at least give you a head start on the translation process.

Just load your properties file into Google Docs and select Tools|Translate.

translate

translate

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

Calling A Service From The Grails Console

Friday, August 21st, 2009

I’m doing my first project in Grails and intend to blog some of thing things I’m learning.

During development, the grails console is very useful for testing specific pieces of code without having to go through your whole system to get to that particular bit of code.

For the most part, you can just enter grails commands and hit execute. But apparently dependency inject doesn’t happen in the console. So there’s a bit of a trick to execute a service from the console.

If you had a service named MySecretService with a function named secretSquirell, you could access it via dependency injection in a domain class, a controller or another service by first adding

def mySecretService

then later you can say
def result = mySecretService.secretSquirell()

But to test in the console you need to do this:

def service = ctx.getBean("mySecretService")
def result = service.secretSquirell()

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]