Re: i18n

Charles Goodwin <[email protected]> Tue, 8 Apr 2003 16:44:18 +0100
Newsgroups gmane.comp.java.xwt.general
Message-ID <308906BE5D07D5119285009027D61C5722F6D0@NTFPS1>
> > > Definately.  You could use something like xwt.theme("myapp.lang",
> > > "myapp.english") to overlay the english templates onto the lang
> > > templates, which are the ones you instantiate.
> > 
> > But what about parameter positions?
> > 
> >   "Are you sure you want to delete file %file%, dated %date%"
> 
> myapp.lang.areyousure is a String, so you can do this:
> 
>   myapp.lang.areyousure.replace("%file%", "foo.html");

I had a chat with Emile about this.

The problem is that you don't want to be rolling out a different version of
each widget/xwt for each language, but rather have the templates reference a
'mother' template.

Are your thoughts that you'd have a template, say,
com.emile.english.teststrings:

<xwt>
    <template>
        var stringx = "some string containing %file%";
        var stringy = "another string, but container %name%";
        var stringz = "a string with no parameters";
        font = "someenglishfont";
    </template>
</xwt>

Then in your app you'd have:

<xwt>
    <import "com.emile.lang" />
    <import "com.emile.app" />

    <static>
        xwt.theme( "com.emile.lang", "com.emile.english" );
    </static>

    <template>
        <teststrings id="strings" />
        <testtemplate1 id="template1" />
        <testtemplate2 id="template2" />
        <testtemplate3 id="template3" />

        $template1.font = $template2.font = $template3.font =
$teststrings.font;

        $template1.label = $strings.stringx;
        $template2.label = $strings.stringy;
        $template3.label = $strings.stringz;
    </template>
</xwt>

Is this what you meant, Adam?  It was my interpretation of what you said.

There is something that doesn't feel quite right with this approach, some
aching disadvantage that I can't actually pinpoint at the moment.  Anybody
got any thoughts?
_______________________________________________
http://lists.xwt.org/listinfo/dev