On 02/14/2011 04:40 PM, Derrell Lipman wrote:
> Having never had to do any internationalization of apps before (the
> whole world does, in fact, speak English, doesn't it? :-) ), I just
> spent some quality debugging time trying to figure out why most stuff in
> my application was translating when I switched the locale, but not a few
> things. I discovered the following:
>
>        label = new qx.ui.basic.Label(this.tr("Language") + ": ");

The problem is that already at this point you are losing the 
LocalizedString, and hence any ability to do a re-translation 
down-stream. The "+" operator forces the return value of 
this.tr("Language") into a plain string, so all the Label constructor 
sees *is* already a plain string, and not a LocalizedString object anymore.

The Label class has indeed no provision of handling "composed" label 
values, and you would need to write your own Label (sub-)class to cater 
for that (extend the constructor for multiple label components, maintain 
them as different parts internally, go through them on a changeLocale 
event, etc.).

Alternatively, you could think of a new LocalizedString class (e.g. 
"LocalizedComposedString") that knew of dynamic and static parts of its 
value, and would itself re-translate the dynamic parts on request:
    new qx.locale.LocalizedComposedString(this.tr("Language"), ":", 
this.tr("Setting"));
But I'm not sure about the over-all utility of that :).

T.


------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to