0
votes

was hoping someone could recommend a relatively simple solution for managing multiple langauges in Flash

Problem:

I have a Flash image caraousel, and I need to manage multiple translations & fonts for the text captions and potentially localised images E.g. picture of a sales person from China for the China version of the webpage

Solutions under consideration:

  • Have multiple translations in 1 XML file, categorized by country, use HTML dynamic text fields and set relavent font family through passing a &country="" FlashVar in the embed code
  • Create separate SWF & XML files for each translation, and use conditional Javascript to embed the right version
2

2 Answers

1
votes

Imo best idea is to create XML file for each translation. That would better optimize your project because you do not need to load chinese translations when users wants to see polish version of the swf.

As for fonts embeding - create additional SWF for each translation (fonts_pl.swf, fonts_de.swf, ... etc). Each swf would have font embeded:

public class CustomFont extends MovieClip {
    [Embed(source='font_pl.ttf', fontName='MyFont', mimeType='application/x-font')]
    public static var FONT:Class;
}

Then load proper SWF to main SWF. As you have font embeded in loaded SWF you can use it in main SWF as well.

Here you have some tutorial: http://www.flashcomponents.net/tutorials/loading_fonts_in_actionscript_3/step_1_font_swf.html

1
votes

This is the method I use, so I can hand whole Flash projects off to clients to do their own translation, and to outside translation houses:

  • Create a swf file to hold your fonts, embed only the fonts needed for the current language, and register them with ActionScript.
  • Create a CSS file for the language (this is optional, probably only needed if you have radically different languages that will need different formatting).
  • Create an XML file for the language.
  • Load all three files, then place the text from the XML file in HTMLTextFields.
  • Assign the stylesheet to each of the text fields.

For a simple translation, the whole project can be copied, the fonts swf and xml text can be changed, and all the changes can be viewed without reexporting anything else. Of everything I've tried, this is what's given the translators the least trouble.

For something more complicated, where the user might select their language, you can include links to the font swf and css file in the XML for each language. You could use FlashVars or ExternalInterface to grab the current language XML.

This is an example I put together a while back: http://binquisitive.wordpress.com/2011/08/13/totally-dynamic-text-formatting/

Here's an example from someone else: http://yourpalmark.com/2009/04/05/embedding-fonts-using-external-swf-files/