Hi Sak,

to be able to use variables as argument of the "tr()" method you have (at
least) 2 options:

a) Cover it by "eval"
   <code>
     // ...
     var vMessage = getResultStringFromBackend();
     foo.setLabel( eval("this.tr(vMessage);") );
     // ...
   </code>

b) Use the "square bracket syntax" to trick the generator (a great trick by
   Tobias Oetiker; see http://bugzilla.qooxdoo.org/show_bug.cgi?id=2639#c1)
   <code>
     // ...
     var vMessage = getResultStringFromBackend();
     foo.setLabel( this['tr'](vMessage) );
     // ...
   </code>

Anyway in both cases it is important to let the generator "know" the possible
keys that can be translated, so that another run of "generate translation" does
keep the translations.
So you add something like this somewhere in your code:
<code>
  // Dummy-calls, to let the generator know the backend-generated strings for
  // translation.
  this.marktr("Not Authenticated");
  this.marktr("Multiple Login Not Allowed");
  this.marktr("Inactivity Too Long");
  this.marktr("Maintenance Running");
  this.marktr("Version Conflict");
</code>


/Peter


On 2010-11-08 10:57 Mustafa Sak wrote:
> Hi List,
> 
>  
> 
> Does qooxdoo offers a translation method for text generated in runtime? I
> mean, I am getting phrases to translate from an ajax request to my app. So
> if I include the phrase/messageId into .po files, how to tell qx, to take a
> look on it? 
> 
>  
> 
> this.tr(variable) just gets me an error.
> 
>  
> 
> Is there any concept to handle this nicely?
> 
>  
> 
> Regards Sak
> [...]

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to