How to use the fbt.IntlViewerContext.locale function in fbt

To help you get started, we’ve selected a few fbt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / fbt_v0.x.x / flow_v0.69.x- / test_fbt.js View on Github external
it('should raise an error when mutate locale property not string', () => {
    // $ExpectError: need string
    IntlViewerContext.locale = 123;
  });
github facebookincubator / fbt / live-demo-app / src / example / Example.react.js View on Github external
setLocale(locale: Locale) {
    IntlViewerContext.locale = locale;
    this.setState({locale});
    const html = document.getElementsByTagName('html')[0];
    if (html != null) {
      html.lang = LOCALES[locale].bcp47;
    }
    document.body.className = LOCALES[locale].rtl ? 'rtl' : 'ltr';
  }
github facebookincubator / fbt / demo-app / src / example / Example.react.js View on Github external
setLocale(locale: Locale) {
    IntlViewerContext.locale = locale;
    this.setState({locale});
    const html = document.getElementsByTagName('html')[0];
    if (html != null) {
      html.lang = LOCALES[locale].bcp47;
    }
    document.body.className = LOCALES[locale].rtl ? 'rtl' : 'ltr';
  }