Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Fix #4750: It still will switch language if you click the cancel button. #4753

Merged
merged 1 commit into from
Aug 16, 2013
Merged

Fix #4750: It still will switch language if you click the cancel button. #4753

merged 1 commit into from
Aug 16, 2013

Conversation

TomMalbran
Copy link
Contributor

Fix #4750.

It should only change the language and reload the window when the OK button was pressed, since done only means that the dialog was closed, and not that was accepted.

return;
} else if (locale !== curLocale) {
Dialogs.showModalDialogUsingTemplate(template).done(function (id) {
if (id === Dialogs.DIALOG_BTN_OK && locale !== curLocale) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you want to use the localized OK string to compare. Dialogs.DIALOG_BTN_OK is translated for each language so just compare to the non-localized version: "ok".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're comparing the button label here. Tom is comparing the id of the button and not the value of the button.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. I was thinking that Dialogs.DIALOG_BTN_OK was a translated string but it doesn't look like it is used consistently for the button ID. Some dialog templates use this value while others just use "ok" and the extension manager dialog checks against "ok" instead of the constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Dialogs.DIALOG_BTN_OK = "ok" and is the constant that we should use for ok. The only problem I see with our code is that inside the templates we use "ok" instead of the constant. We should start changing this by passing the Dialogs constants to Mustache, so that it also renders that instead. But that should be part of a bigger cleanup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see it as an issue in using data-button-id="ok" in the template. It is a non-localizable string used as an id for the element and not to be rendered in the UI.

@ghost ghost assigned RaymondLim Aug 16, 2013
@RaymondLim
Copy link
Contributor

Looks good! Merging.

RaymondLim added a commit that referenced this pull request Aug 16, 2013
Fix #4750: It still will switch language if you click the cancel button.
@RaymondLim RaymondLim merged commit e8c04c2 into adobe:master Aug 16, 2013
@TomMalbran TomMalbran deleted the tom/issue-4750 branch August 16, 2013 20:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core][switch language]: It still will switch language if you click the cancel button.
3 participants