September 15, 2013

Make localizing apps easier

Here’s the steps:

Take inventory of text

Do an inventory of all your files, and see where text lives. Is it baked into images? Is it written right into the code of the application? Is it already stored separately in XML? Count how many files it is spread across.

Use regexes to find hardcoded strings in your code

You took inventory of text in your app, and you probably missed some of it. Think of regex patterns that might help you catch more strings in your programming language of choice.

In Objective C, look for something like this: @"(.*)"

In Java and many other languages, a pattern like ('|")(.*)('|") is a good place to start, but it will return a lot of false positives as well.

Know your date, time, number, and currency formatting

You remembered all the static copy, but may have forgotten this stuff. The good news is the standard libraries of your programming languages might be able to help you. If you rely on web services that serve strings of unlocalized dates, expect to parse them into native Date objects (or whatever your language offers), and then format those dates back into localized strings.

Wikipedia provides examples of international date formatting here.

Make layouts flexible

Copy will no longer fit within the same size box (unless you change the font size). Let textfields and labels change in size and push other things down the page. The operating system on the device was built to work like this. Let go of that comp the designer made with only one language in mind. It needs revisions, or it can no longer be used as a pixel-perfect guide.

Try putting those input field labels above the input field instead of beside them. Add scrolling functionality if the new content is too tall. Take advantage of liquidy layouts in HTML, or auto layout in iOS