PDA

View Full Version : Strategy for Bilingual Flash site


mowgliF
04-14-2008, 06:09 AM
Hi - I am working on a bilingual site for a client ( a wine producer in France...). It will be in English and French. Obviously, there will be several updates before the site goes live and probably quite a few as well after the site has gone live. I would like to avoid duplicating workload or having 2 versions (i.e 2swf's). In your experience, what is the best way to approach the challenge from a coding strategy viewpoint ?
Thanks

Assertnfailure
04-14-2008, 03:55 PM
If you already know you aren't going to use two seperate swfs, then that pretty much only gives you one option (that I could think of), which is to pull xml from the server which provides all of the text for the swf, and you just pair the nodes to the different text fields.

Flash Gordon
05-16-2008, 08:01 AM
That solution is obviously much more elegant, but if you wanted you could also have 2 of the same scene and just attach which ever language you wanted.
eg

function languageFactory(type:String):SceneFactory
{
var fac:Function;
switch(type)
{
case "en": fac = enFactory; break;
case "fr": fac = frFactory(); break;
}
return fac;
}

function enFactory(scene:int):void
{
var scene:DisplayObject;
switch(scene)
{
case 0: scene = new HomeEn(); break;
case 1: scene = new ContactEn(); break;
}
return scene;
}
//

var fac:Function = languageFactory("en");
addChild( fac(0) );

something along those lines....Where HomeEn and HomeFr could share the same super class or base class.

But anyway, do you know what are the different glyphs that are needed between EN and FR when embedding a font? Is there a master list somewhere?

mowgliF
05-19-2008, 10:22 AM
FG - Thanks for this very elegant solution. I have already started the project though and decided to allow users to change the language mid-visit. So I went for a solution with a language var which is always checked before xml or html text is loaded. For the navigation, I use a simple function which reloads the navigation buttons whenever the language buttons are clicked on.
This is an OK solution which is not making the code so much heavier.
Thanks again

gd2000
05-30-2008, 12:54 PM
yup, xml and switch statements are good for this kind of thing

but note the difference in text size for those with restricted space... buttons etc.

Flash Gordon
05-30-2008, 04:26 PM
But anyway, do you know what are the different glyphs that are needed between EN and FR when embedding a font? Is there a master list somewhere?-

asf8
05-30-2008, 10:25 PM
But anyway, do you know what are the different glyphs that are needed between EN and FR when embedding a font? Is there a master list somewhere?

http://www.5etdemi.com/blog/archives/2004/12/quick-tip-french-chars-in-flash/

<glyphRange name="French Characters " id="26" >
<range min="0x0020" max ="0x0020" />
<range min="0x00C0" max ="0x00C0" />
<range min="0x00C2" max ="0x00C2" />
<range min="0x00C4" max ="0x00C4" />
<range min="0x00C6" max ="0x00CB" />
<range min="0x00CE" max ="0x00CF" />
<range min="0x00D4" max ="0x00D4" />
<range min="0x00D6" max ="0x00D6" />
<range min="0x00D9" max ="0x00D9" />
<range min="0x00DB" max ="0x00DC" />
<range min="0x00E0" max ="0x00E0" />
<range min="0x00E2" max ="0x00E2" />
<range min="0x00E4" max ="0x00E4" />
<range min="0x00E6" max ="0x00EB" />
<range min="0x00EE" max ="0x00EF" />
<range min="0x00F4" max ="0x00F4" />
<range min="0x00F6" max ="0x00F6" />
<range min="0x00F9" max ="0x00F9" />
<range min="0x00FB" max ="0x00FC" />
<range min="0x0152" max ="0x0153" />
</glyphRange>

or maybe try to "Include these characters" when you embed.



I am not French so maybe there are more ? ;)

Flash Gordon
05-30-2008, 11:44 PM
Cool, but how does that relate the embedded button?
http://img95.imageshack.us/img95/7366/embedaz5.jpg (http://imageshack.us)

Which one of those do I have to use for what font? Like what glyphs do I need from French? How about Spanish? etc It would be great if there was a master list somewhere.

Thanks for your help :)

EDIT: http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000894.html
on the right track now...cool :) But I'll be back with more questions shortly.

Flash Gordon
05-31-2008, 12:21 AM
This is what I've been looking for:
http://tlt.its.psu.edu/suggestions/international/bylanguage/index.html

asf8
06-01-2008, 01:39 PM
It would be great if there was a master list somewhere. Thanks for your help. EDIT: on the right track now...cool

Glad to help. I am trying to figure out this whole topic also ;-)

This is what I've been looking for:
http://tlt.its.psu.edu/suggestions/international/bylanguage/index.html

Nice link :) Here are some more:

http://www.alanwood.net/unicode/ (under characters)
http://www.eki.ee/letter/
http://unicode.org/charts/

Also here is a COOL function for creating the XML needed for adding to the UnicodeTable.xml

Custom character-set embedding in Flash
http://www.psyked.co.uk/adobe/flash/custom-character-set-embedding-in-flash.htm

var myString:String = " abcdABCD";
var nameOfFontSet:String = "abcdABCD Character Set"
var fontSetID:Number = 50
generateCharSet(nameOfFontSet, fontSetID, myString);
function generateCharSet(setName, setID, chars) {
var outputXML:String = "<glyphRange name=\""+setName+"\" id=\""+setID+"\">\n";
var numberOfChars:Number = chars.length;
for (var i:Number = 0; i<=numberOfChars-1; i++) {
var charCode:Number = chars.charCodeAt(i);
var hexCode:String = convertTo4DigitHexValue(charCode.toString(16));
outputXML += "\t<range min=\"0x"+hexCode+"\" max=\"0x"+hexCode+"\" />\n";
}
outputXML += "</glyphRange>";
trace("outputXML:\n"+outputXML);
XML_Output_txt.text = outputXML;
}
function convertTo4DigitHexValue(hexValue:String):String {
var hexLength:Number = hexValue.length;
var numberOfLeadingZerosRequired:Number = 4-hexLength;
for (var i:Number = 0; i<=numberOfLeadingZerosRequired-1; i++) {
hexValue = "0"+hexValue;
}
return hexValue;
}

Outputs:

<glyphRange name="abcdABCD Character Set" id="50">
<range min="0x0020" max="0x0020" />
<range min="0x0061" max="0x0061" />
<range min="0x0062" max="0x0062" />
<range min="0x0063" max="0x0063" />
<range min="0x0064" max="0x0064" />
<range min="0x0041" max="0x0041" />
<range min="0x0042" max="0x0042" />
<range min="0x0043" max="0x0043" />
<range min="0x0044" max="0x0044" />
</glyphRange>

Keep us posted with anything you discover or come up with regarding this subject!!

Flash Gordon
06-05-2008, 06:15 PM
Its appears what I want to do can only be done in Flex. If/When I figure it out, I'll post a step by step.

My goal is:
to have a font library.
the library will be broken down into glyph types
since french language is built upon [A-Za-z] characters, there is only a need to embedded the accents (which flash can't do this).
Load the base font [A-Za-z] and then load the accent character set (fr, sp, gr, etc) to support the foreign language.

This is what I'm currently working towards. If anyone has done this, I'm open to so help!