A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Locale + XLIFF .. can't get it working..

  1. #1
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560

    Locale + XLIFF .. can't get it working..

    According to Flash8 help the flash code should be:
    Code:
    import mx.lang.Locale;
    Locale.autoReplace = true;
    Locale.addXMLPath("de","localetest_de.xml");
    Locale.addDelayedInstance(greeting_txt, "IDS_GREETING");
    Locale.loadLanguageXML("de", localeCallback)
    function localeCallback(success:Boolean) {
        if (success) {
            trace(Locale.stringIDArray); // IDS_GREETING
            trace(Locale.loadString("IDS_GREETING"));
        } else {
            trace("unable to load XML");
        }
    }
    According to XLIFF specs my localetest_de.xml should look like:
    Code:
    <?xml version="1.0"?>
    <xliff version="1.1">
     <file source-language="DE" datatype="plaintext" original="localetest_de.xml">
      <body>
       <trans-unit id="IDS_GREETING">
        <source>Hallo Welt!</source>
       </trans-unit>
      </body>
     </file>
    </xliff>
    But the TextField allways renders to "undefined" ...
    I suspect the XML beeing formated not correctly.
    I am totally lost now, anyone of u guys got it working yet?
    Last edited by McUsher; 11-22-2005 at 08:24 AM.

  2. #2
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    you are missing a header tag and your attributes are wrong for the trans-unit tag.

    Code:
    <?xml version="1.0"?>
    <xliff version="1.1">
     <file source-language="DE" datatype="plaintext" original="localetest_de.xml">
      <header />
      <body>
       <trans-unit id="001" resname="IDS_GREETING">
        <source>Hallo Welt!</source>
       </trans-unit>
      </body>
     </file>
    </xliff>
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  3. #3
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    Damn i don't believe it, ....

    (Well i missed important things in the specs, so i might blame me )

    Thanks alot, your nick is no lie

  4. #4
    Junior Member
    Join Date
    Dec 2006
    Posts
    1

    Important notice

    If you have, before deciding to reposition XLIFF files, created them over String panel, then Flash wil allways look for them on default position.
    And if they are not there, it will raise an error (or die silently prior AS 3.0), although you have provided path by using Locale.addXMLPath(...).

    In that case, you have to remove languages, over String panel.

    That way you'll have to edit them over external editor.
    Bad thing is that Flash don't bind those files somehow.
    Anyway, you can import files over String panel.

    All the best,
    Sinisa

    Sinisa Rudan
    --------------------------------------------------------------------------
    Associate editor of multimedia part of InfoM Journal,
    Journal of Information technology and multimedia systems.
    http://www.infoM.org.yu

    MAGIC WAND solutions * Studio
    founder and owner
    http://www.MagicWandSolutions.com
    http://www.sinisarudan.com
    --------------------------------------------------------------------------
    Last edited by sinisa.rudan; 11-02-2007 at 08:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center