Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property locale string value reset isn't working for non-default locale #7388

Closed
YaroslavHapon opened this issue Nov 20, 2023 · 0 comments · Fixed by #7390
Closed

Property locale string value reset isn't working for non-default locale #7388

YaroslavHapon opened this issue Nov 20, 2023 · 0 comments · Fixed by #7390
Assignees
Labels
bug user issue An issue or bug reported by users
Milestone

Comments

@YaroslavHapon
Copy link

YaroslavHapon commented Nov 20, 2023

Are you requesting a feature, reporting a bug, or asking a question?

It looks like an issue

What is the current behavior?

Reset property value, if the property value is LocaleString is not working for non-default locale

In that part of the code, the current locale is not passed, and the string lookup resets to the default locale strings object on the reset property value button click. That led to an issue that the locale string value reset wasn't working

Base.resetPropertyValue

public resetPropertyValue(name: string): void {
    const locStr = this.localizableStrings ? this.localizableStrings[name] : undefined;
    if(locStr) {
      locStr.clearLocale();
    }
    else {
      this.setPropertyValue(name, undefined);
    }
  }

What is the expected behavior?

Property value reset should work for the current locale that differs from the default/base locale
Was checked by passing locStr?.curLocale argument to locStr.clearLocale(locStr?.curLocale); in the source code

Base.resetPropertyValue

public resetPropertyValue(name: string): void {
    const locStr = this.localizableStrings ? this.localizableStrings[name] : undefined;
    if(locStr) {
      locStr.clearLocale(locStr?.curLocale);
    }
    else {
      this.setPropertyValue(name, undefined);
    }
  }

How would you reproduce the current behavior (if this is a bug)?

Create a property with a localizable string value
Add localizable string translations for several locales
Change locales and test if property value reset works for each locale

Specify your

  • browser: Chrome
  • browser version: 119.0.6045.123
  • surveyjs platform (angular or react or jquery or knockout or vue): React
  • surveyjs version: 1.9.116
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug user issue An issue or bug reported by users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants