Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

[JS CS3 Mac&Pc] Enabling automatic localization problem

Valorous Hero ,
Mar 11, 2009 Mar 11, 2009
Hi all,

I’m trying to enable automatic localization in my script, as described in ‘Localization in ScriptUI Objects’ section of ‘JavaScript Tools Guide’ for CS3 (pages 87-88).

I try the first example and it works as expected:
$.locale = "fr";

w = new Window('dialog', 'Test');
btnText = { en: "Yes", de: "Ja", fr: "Oui", ru: "Да" };
b1 = w.add ( "button", undefined, localize(btnText) );
w.show();


Then I read the following:
>If you do not need variable replacement, you can use automatic localization. To turn on automatic
>localization, set the global value:
>$.localization=true

I really don’t need variable replacement in my script and don’t want to type localize() around every string over and over again, because there are countless numbers of them.
So automatic localization is just what the doctor ordered. I try the second example, but instead of the localized string I get ‘Object’.
$.locale = "fr";

$.localize = true;
w = new Window('dialog', 'Test');
btnText = { en: "Yes", de: "Ja", fr: "Oui", ru: "Да" };
b1 = w.add ( "button", undefined, btnText );
w.show();



Any1 have any ideas?

Kasyan
TOPICS
Scripting
489
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 12, 2009 Mar 12, 2009
Kasyan,

You need this:
>b1 = w.add ( "button", undefined, String (btnText));

It's indeed not what you's espect from the description in the guide.

Peter
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 12, 2009 Mar 12, 2009
LATEST
Thank you, Peter.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines