Geek2Geek Answers: Externalizing Strings

Category: Translation Services

Here is a question that I answered recently via our Acclaro Twitter account:

Q: What is the best/easiest way to “resource” all of your strings when doing software localization?

A: In the industry, we refer to what you are asking as “externalization” of strings. The file created at the end of this process is called a resource file or bundle, depending on your platform. Strangely, I had this issue come up just recently with a prospect of ours. They asked me if I knew of any tools that could quickly and efficiently extract hardcoded strings into a resource file. My answer was this: the main product in our industry for achieving this task is produced by a company called Lingoport and is called “Globalyzer.”  Now this is just one of many internationalization functions that Globalyzer can perform, so if you are working on an internationalization project and have a lot to do outside of just externalizing your strings (such as identifying classes, properties and methods that are not “international friendly”) I would say Globalyzer is the tool  for you. However, if your goal is just to externalize strings for the purpose of translation, a simple “grep” tool with batch script search and replacement capabilities can often do the trick.

Usually hardcoded string values (i.e., translatable text) have a particular pattern and that pattern can be searched for across the code. Using a grep tool and a search and replace table, you can partially automate the creation of a resource file in a fraction of the time it would take you to dig though millions of lines of code searching for every string manually. Remember, however, that this is just one step in a long list of things that need to be done before internationalizing an application. Also keep in mind that no tool, no matter how powerful, will find every single string that could potentially be displayed to a user in the UI. This is why programmers should think about internationalization right as they begin development so that they are using a resource file to store strings from the start and thereby avoiding any unnecessary backtracking though code.

Have questions about localization and translation? Send them to me:

Via Twitter, ask your question using the hash tag #geek2geek

Send me your question via email: