Notes On Localizing Flash

So it’s the day after my presentation on Flash Localization. I was quite happy with how things panned out, given I had been a presentation virgin prior to last night. The presentation didn’t hurt nearly as much as I was afraid of. At least it didn’t hurt me :D.

Thanks to AKQA for the venue, support, beer and pizza, very nice it was to. Thanks also to Tink for the opportunity to break my cherry, so to speak. And finally thanks to every one that came along to listen to me gibbering on. It must be said this is a subject I have come to build a love-hate relationship with over the many years I have spent in the field. I love the challenge of working to localise the content. I hate the fact that Flash makes even some of the most mundane solutions or Ideas a HUGE Challenge. It would seem I am not alone in this.

In addition to nattering on myself, I also received some useful information as well, which was great. So thanks for correcting my terminology of Polish as a Cyrillic based Language. Apparently it’s an Extended European language, which would account for me having issues with that one. 😀

Something I didn’t do last night was to show any code. This was due to operating on a Mac (thanks again Tink) and not being confident enough in my app switching on the alien technology. Below are some snippets I made reference to.

Using System.capabilities.playerType to allow altered path references dependent on whether you are testing through a browser.
str_xml variable is a string appended to the SWF file name in the HTML
this is used to dictate which XML language version the flash movie
will load and display. If no XML variable is detected then the movie will
default to the UK English version (en-GD) this allows for easy testing in the
flash IDE
var str_defaultLang:String = “en-GB”;
// use the playerType to asertain whether the movie is playing in the browser or not and alter the Pathing acordingly
var str_siteRoot: = (System.capabilities.playerType == “External”) ? “../” : “”;
var str_xml:String = (str_xml == undefined) ? str_defaultLang : str_xml;
var str_xmlSource:String = str_siteRoot + “xml/structure” + str_xml + “.xml”;
A simple (nasty) prototype to string that offers find and replace functionality. This is then shown searching for pesky windows carriage return and line feed symbols and replacing them with single newline statement. I hope the URL encoded values are correct; I have actually done this from memory. Please let me know it this not the case.

/*String object prototype adds find and replace functionality*/
usage : str_myString.replace(str_stringToFind, str_stringToReplace);
str_stringToFind: string you wish to find in ‘str_myString’
str_stringToReplace: string you wish to replace str_stringToFind with in ‘str_myString’
returns: str_myString with all occurances of str_stringToFind replaced with str_stringToReplace
String.prototype.replace = function(str_f:String, str_r:String):String
return (this.split(str_f).join(str_r));
var myString:String
myString = escape(myString)
myString = myString.replace(“%0A%0D”, newline);
myString = unescape(myString);

Finally a snippet showing how to store Country/Language code combinations in order to switch fonts to Arial MS Unicode in those more troublesome language character sets.

/* Array to list non supported county/language codes */
var arr_nonSuportedCC:Array = new Array(“gr-GR”, “ru-RU”, “tr-TR”, “cr-CR”, “kr-KR”, “pl-PL”, “si-SI”, “cs-CZ”, “da-DK”, “el-GR”, “sv-FI”, “hu-HU”);
setFontFace loops trough an array of Values that represent Country/language codes for the
current content, if the current document country code is in this list then return true to
say use a default font face that supports the countries glyphs more fully.
e.g Arial Unicode MS for russian/greek/cyrilic languages
var setFontFace = function(str_CC:String, arr_CountryList:Array):Boolean
var bln_retval:Boolean = false;
var i:Number = 0;
var iTotal:Number = arr_CountryList.length;
var str_curCC:String;
str_CC = str_CC.toLowerCase()
while(i < iTotal) { str_curCC = arr_CountryList[i].toLowerCase(); if (str_CC == str_curCC) { bln_retval = true; i = iTotal; } ++i; } return bln_retval; } /* switch to determin if the font glyphs are supported*/ var bln_useArial:Boolean = setFontFace(str_xml, arr_nonSuportedCC); var str_defaultDisplayFont:String str_defaultDisplayFont = bln_useArial ? "Arial Unicode MS" : "HelveticaNeueLT Pro 43 LtEx"; // Text Formating object that will use the 'default' or 'switched' font __tf_navigationDefault = new TextFormat() __tf_navigationDefault.font = str_defaultDisplayFont __tf_navigationDefault.size = 14; __tf_navigationDefault.color = 0x102C4A; [/AS] This last Snippet could also be extended to switch Font Size based on Asian Language or country codes as well. In addition I have used a similar script to check for 'preferred' fonts based on TextField.getFontList().

4 thoughts on “Notes On Localizing Flash”

  1. Good stuff you’ve put here. I’m curious.. do you normally use embedded fonts or non-system fonts for all text? Is it ok to just specify “_sans” for the font and allow the users system to pick the font that (since it’s on their system) will display the characters?

  2. Dave

    Unfortunately, I missed your LFPUG presentation.

    It would be a great help if you posted any notes on your MANAGING TEXT AND FONTS; PROBLEM lANGUAGES sections from your talk.


    John Coumbe

  3. I have had a couple of emails and comments requesting more information from the Presentations I delivered.

    Unfortunately all I actually produced to work from during the presentation
    were bullet lists. The rest was ‘off the hip’ and from experience on the night. :S

    As a result I dont have anything formal to provid at the moment. It is great to here the more specific requests regarding this subject, and I will definately follow up with more formal information.

  4. Flash localisation – what a nightmare. I had to engineer some of the Help files for Flash 5 and still have nightmares about it. Had to learn Flash in a weekend and then manually copy and paste the translated text in. Even Macromedia didn’t use dynamic text in their own product’s Help to make localisation easier.

Leave a Reply

Your email address will not be published. Required fields are marked *