Re: i18n

Emiliano <[email protected]> Tue, 8 Apr 2003 17:45:07 +0200
Newsgroups gmane.comp.java.xwt.general
Message-ID <[email protected]>
On Tue, Apr 08, 2003 at 04:44:18PM +0100, Charles Goodwin wrote:

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

Would these go in <template/>, or <static/>? Why? And doesn't the 'var'
in front of it make it local to the template?

>     </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" );

BTW, Charles, I'm finally getting this. It's a symlink. I was thinking
themes were something separate from 'regular' XWTs. A lot of things we
discussed this afternoon make sense to me now.

>     </static>
> 
>     <template>
>         <teststrings id="strings" />
>         <testtemplate1 id="template1" />
>         <testtemplate2 id="template2" />
>         <testtemplate3 id="template3" />
> 
>         $template1.font = $template2.font = $template3.font =
> $teststrings.font;

I still don't understand how $teststrings ends up pointing to
com.emile.lang here.

>         $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?

Well, what would be really cool is if the above would work, but if there
was also a way for me to do something like <testtemplate1 id="template1"
label="&xwt.property.foo.bar.stringz;"/>. This would obviously only be
useful for non-parametrized strings. Note that I'm not suggesting
any specific namespace here; I'm not here to open that can of worms.

The upside of this is that fixed parts of the ui would translate itself
automatically without much code being necesary to do so; the downside is
that it needs engine support, and needs thought about the architectural
side of the thing (do we map to vars? Java-style property files?
Special-format XML files?).

But for now I'll be happy to just do it by hand. All I want, initially,
is a way to keep the language strings and images (these might need
localization at some point) separate from the actual code.

Emile

_______________________________________________
http://lists.xwt.org/listinfo/dev