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

feat(FEC-7681): add i18n support #269

Merged
merged 6 commits into from
Sep 5, 2018
Merged

feat(FEC-7681): add i18n support #269

merged 6 commits into from
Sep 5, 2018

Conversation

OrenMe
Copy link
Contributor

@OrenMe OrenMe commented Sep 5, 2018

Description of the Changes

adding full mapping and some re-org of components.
The translations can be added via the config object, currently only supporting setting the locale language on init of ui manager.
The config accepts:

{
  "locale": "en", //locale name
  "translations": {
    "en": {
      "tokenName": "value"
    }
  }

the base config is english and any additional config dictionary with missing keys will inherit the english ones.

CheckLists

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • test are passing in local environment
  • Travis tests are passing (or test results are not worse than on master branch :))
  • Docs have been updated

@OrenMe OrenMe self-assigned this Sep 5, 2018
dan-ziv
dan-ziv previously requested changes Sep 5, 2018
@@ -34,6 +35,8 @@ class UIManager {
store: any;
container: ?HTMLElement;
root: React$Component<any, any, any>;
_translations: {[langKey: string]: Object} = {en: en_translations};
Copy link
Contributor

Choose a reason for hiding this comment

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

Create TranslationManager which will return u this object

* @private
* @returns {void}
*/
_setLocaleTranslations(config: UIOptionsObject): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

TranslationManager logic?

@@ -141,7 +164,7 @@ class UIManager {
// i18n, redux and initial player-to-store connector setup
const template = (
<Provider store={this.store}>
<IntlProvider definition={definition}>
<IntlProvider definition={this._translations[this._locale]}>
Copy link
Contributor

Choose a reason for hiding this comment

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

translationManager.getTranslation()

@OrenMe OrenMe dismissed dan-ziv’s stale review September 5, 2018 20:38

translationManager will be a HoC in future release

@OrenMe OrenMe merged commit 0b06db9 into master Sep 5, 2018
@OrenMe OrenMe deleted the FEC-7681 branch September 5, 2018 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants