Hi Nikolaidis,

qooxdoo does not have a built-in way to handle dynamic translations.
The workaround you are using is one way to deal with that issue. An optimization
would be to define a class with your translation ids in the "defer" function.

You might also use the solution provided by Cajus


Regards,
Romeo

-----Ursprüngliche Nachricht-----
Von: Cajus Pollmeier [mailto:pollme...@gonicus.de] 
Gesendet: Dienstag, 14. April 2015 14:37
An: qooxdoo Development
Betreff: Re: [qooxdoo-devel] Work around translation key discovery of 
generator.py

I'm not sure if I understand the problem correctly. Here's what we do in an 
application with the need for dynamic localization:

We're loading i18n messages from a backend and feed them into the current 
translation using the "addTranslation" method of qx.locale.Manager.

The code hasn't been updated for years, but you can basically see it
here:

https://github.com/gonicus/gosa/blob/master/source/class/gosa/Application.js#L211

Maybe it helps.

Cheers,
Cajus

Am Dienstag, den 14.04.2015, 13:18 +0300 schrieb George Nikolaidis:
> Dear all,
> 
> In a number of cases we have stumbled upon a shortcoming of the 
> translation framework. It is my understanding that generator.py scans 
> class files  for tr*() and marktr() calls in order to extract relevant 
> translation message ids. It then looks up these ids in the .po files 
> to compile the final JS file.
> 
> While this behavior is generally fine, there a lot of cases where we 
> need to include message ids that do not appear in class files, the 
> most prominent being:
> 
> - message ids that are dynamically generated by adding a prefix to a 
> server response
> - messages appearing in XML files that are parsed at runtime (Qookery)
> - message ids as values of static maps that are lazily replaced by 
> their translation only on first use at runtime
> 
> Right now we resort to workarounds such as:
> 
> __uglyHackForQooxdooAggressiveTranslationOptimization: function() {
>     // TODO There must be a better way to achieve this!
>     this.marktr("waffle.common.code.gender.M");
>     this.marktr("waffle.common.code.gender.F");
> }
> 
> Is there a better way to achieve this?
> 
> An option in generator.py that includes all .po file content 
> regardless of message id existence would be perfect.
> 
> 

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to