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

I18N manager supported customization translations #28

Closed
ddivin-sc opened this issue Nov 21, 2019 · 1 comment
Closed

I18N manager supported customization translations #28

ddivin-sc opened this issue Nov 21, 2019 · 1 comment

Comments

@ddivin-sc
Copy link
Contributor

ddivin-sc commented Nov 21, 2019

Meta-Info Value
ExtProjectId JCPROC-01
Original Estimation 8h
Remaining Estimation 8h

Description

We need to override translations on UI with custom translations. Found translation message should be changed by the following logic:

if (overriddenTranslations[key]) {
  return overriddenTranslations[key];
} else if (translations[locale][key]) {
  return translations[locale][key];
} else {
  return translations[fallbackLocale][key]
}

But the API will be changed like that:

const overriddenTranslations = {
    messages: {
      test: 'custom test message',
    }
}
let i18n = new I18nManager({
  locale, 
  fallbackLocale,
  localeFormattingInfo,
  overriddenTranslations
});

p.s. Don't forget updating tests

Original issue: https://github.com/OpusCapita/minsk-core-externals/issues/471
See also: https://github.com/OpusCapita/minsk-core-externals/issues/433

@ddivin-sc ddivin-sc changed the title I18N manager supported master translations I18N manager supported customization translations Nov 22, 2019
@ddivin-sc ddivin-sc self-assigned this Nov 25, 2019
@ddivin-sc
Copy link
Contributor Author

Please, review my changes in current repository and in OpusCapita/react-i18n#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants