PDA

View Full Version : Externalize Messages


maxmil
05-28-2005, 10:43 PM
In my current application i would like to externalize all the messages (string literals) that the application uses.

My motivations are that i believe that this is a best practice for maintaining clean and readable code, that modification of texts is much easier when the strings are externalized and above all that this makes internationalization of an application a piece of cake.

Ideally i would like this to be kept in an external plain text file so that messages could be changed without the need to recompile the swf.

I have a Java background and am used to the luxury of .properties files, i guess that really i'm looking for a similar solution in action script.

All comments gratefully received.

max

hangalot
05-29-2005, 11:03 AM
you will have to write your own dictionary class that manages this. if you are loading in via xml, make certain that you use the right encoding types (obviously depending on where you are deploying to). also if a problem is that fonts need be embeded for certain charactersets so you will have to consider that as well, depending on where you deploy it to. all this is obviously not aimed at your problem, hust some general thoughts around what you asked.

maxmil
06-02-2005, 08:49 PM
In the end i've found a solution using LoadVars. In this way i can initiate the application with the language file that i want and LoadVars dynamically creates variables for each string.

I now have all my strings externalized and the aplication can be easily translated into another language.