-
1. Re: Cancel / OK non-English Buttons
TᴀW Jul 13, 2014 7:42 AM (in response to Trevorׅ)Hi Trevor,
My guess is that the using the string OK or Cancel for the text property
is probably not going to work for non-English localizations. (Can anyone
confirm that? Uwe?)
The way to make sure it does work, though, is to use the Name property
(it's a creation property) as opposed to the Text property.
If you do that, you can use the two special names OK and Cancel, and I
believe that will work in any localization:
b2 = w.add('button', undefined, "Cancel", );
Ariel
-
2. Re: Cancel / OK non-English Buttons
Trevorׅ Jul 13, 2014 7:58 AM (in response to TᴀW)Hi Ariel
My guess is that my script will work in the non-English localizations but also waiting to hear from Uwe
I highly doubt b = w.add('button', undefined, "בסדר") will work
The example line you wrote at the bottom came messed up maybe you meant to write b2 = w.add ("button", undefined, "Abbrechen", {name: "cancel"}); ?
Trevor
-
3. Re: Cancel / OK non-English Buttons
TᴀW Jul 13, 2014 8:06 AM (in response to Trevorׅ)Yes, the last line is what I wrote.
In short, I suspect that using one of the special Name
creation-properties (OK and Cancel) will work in any localization,
whereas the Text property of the button is probably less robust.
Let's see if anyone can confirm...
-
4. Re: Cancel / OK non-English Buttons
Trevorׅ Jul 13, 2014 8:11 AM (in response to TᴀW)It was the comma at the end of the line that confused me
I also think it will work
Just a matter of waiting
Uwe's prob watching the world cup, have to see if it comes out for him OK or cancel
-
5. Re: Re: Cancel / OK non-English Buttons
pixxxel schubser Jul 13, 2014 9:04 AM (in response to Trevorׅ)Hi @Trevor,
why you don't use the default elements? (And sorry for my bad german english)
var w = new Window('dialog'); b1 = w.add('button', undefined, "OK"); b2 = w.add('button', undefined, "Abbrechen"); w.defaultElement = b1; w.cancelElement = b2; alert((w.show() == 1) ? "OK" : "Abbrechen");
Another way could be to use the localize data:
strButtonRun = localize( "$$$/JavaScripts/ImageProcessor/Run=Run" ); strButtonCancel = localize("$$$/JavaScripts/ImageProcessor/Cancel=Cancel"); var w = new Window('dialog'); b1 = w.add('button', undefined, strButtonRun); // you can also use "OK" instead of strButtonRun, this is really ok for germans b2 = w.add('button', undefined, strButtonCancel); w.defaultElement = b1; w.cancelElement = b2; alert((w.show() == 1) ? strButtonRun : strButtonCancel);
(This is borrowed from the ImageProzessor.jsx)
"Run" in german means "Ausführen" and not "OK", but you can really use "OK" for that instead.
This way can be helpful for your international scripts – or not?
Have fun
Let's watching the world cup to night. Go for the fourth star.
-
6. Re: Cancel / OK non-English Buttons
Jump_Over Jul 13, 2014 9:14 AM (in response to TᴀW)Hi,
I am confirming Ariel's conclusion.
Using a "Cancel" and "OK" as text property makes button's action default.
Using any localized string but adding {name:"cancel"} or {name:"OK"} makes button's action default.
Was tested with polish version
Jarek
-
7. Re: Cancel / OK non-English Buttons
Trevorׅ Jul 13, 2014 9:41 AM (in response to Jump_Over)Thanks All
So in conclusion It's like Ariel and I thought
1) OK is OK for everybody So is "Run" (didn't know about Run)
2) Name property can be used to assign the "OK" property (Peter uses this with Yes in his guide)
3) Abbrechen works in German UI
Now for the really difficult question. Who do I allocate the correct answer to?
On Jarek's side is a real confirmation and on Ariel's side is a first answer so based on the flip of a coin it's going to Ariel. I would certainly give out some helpfulls but Jives is not allowing that today
Once again thanks
Trevor
-
8. Re: Cancel / OK non-English Buttons
TᴀW Jul 13, 2014 11:53 AM (in response to Jump_Over)So I would tighten up the conclusion a little:
Both the Text and the Name properties work with OK and Cancel even in
non-English localizations. But, if you need a some different text in
your button (a different language, etc.), you can still use the Name
property with OK and Cancel to get the default behaviour for those buttons.
And as Pixxxel schubser points out, this is all just a shortcut
convenience, because it's always possible to explicitly set the
defaultElements and cancelElement for any buttons.
-
9. Re: Cancel / OK non-English Buttons
pixxxel schubser Jul 13, 2014 3:01 PM (in response to pixxxel schubser) -
10. Re: Cancel / OK non-English Buttons
Trevorׅ Jul 13, 2014 3:02 PM (in response to pixxxel schubser)Congrats