Hello Stefan,

I don't want to be picky, but what did you expect when you apply the plus (+)
operator on two Objects?

this.tr("...") returns an instance of {LocalizedString}.

I know that this is not documented directly at the Method (tr), but looking a
little bit deeper you will find the Method qx.locale.Manager#translate() which
is actually called. Here you see: It returns an Object.


By the way, maybe I can help on another question you've asked (something about
"key" and "nonstandard locale"...

What the tr() Method basically does is the following:
<code>
  var translations = {
    "en" : { "good" : "good"},
    "de" : { "good" : "gut" },
    "it" : { "good" : "bene"}
  };
  function (key)
  {
    var locale = getLocaleSetting(); // returns something like e.g. "pl"
                                     //or "en"
    var retVal = key; // if we don't find anything, fallback to "value of key"

    // Locale present?
    if (locale in translations)
    {
      // Easy-case: we have everything
      if (key in translations[locale]) {
        retVal = translations[locale][key];
      }
    }

    // return this object to be dynamically translatable
    return new LocalizedString(retVal);

  }
</code>
Note: This is only the concept description what really is done is a bit more
      elegant.


Singing off, Peter


P.S.: I personally find the style you write your postings a bit to
      demanding...But that's maybe just my personal opinion.


On 2010-09-30 10:37 Stefan Andersson wrote:
> found that...
> 
> var str1 = this.tr("Here we come");
> var str2 = this.tr("with a cake to the core team");
> 
> var label = new qx.ui.basic.Label(str1 + str2);
> 
> does not translate....
> instead...
> 
> var str1 = "Here we come";
> 
> var str2 = "with a cake to the core team";
> 
> 
> 
> var label = new qx.ui.basic.Label(this.tr(str1 + str2));
> 
> 
> which works.
> 
> We couldn't find it to be documented.
> 
> Stefan

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to