How to use the react-i18nify.I18n.setLocale function in react-i18nify

To help you get started, we’ve selected a few react-i18nify 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 scaleflex / filerobot-uploader / projects / react-plugin / components / AirstoreUploader.js View on Github external
init(callback = () => {}) {
    let { config, onUpload } = this.props;
    const language = config.language || config.LANGUAGE || CONFIG.language;

    // support old config
    let activeModules = config.modules || config.MODULES || CONFIG.modules || ["UPLOAD"];
    activeModules = activeModules.join('|').replace('UPLOADED_IMAGES', 'MY_GALLERY').split('|');
    // end

    I18n.setLocale(language);
    config.modules = activeModules;

    const nextConfig = prepareConfig(config, onUpload);

    getTokenSettings(nextConfig)
      .then(settings => {
        this.props.setAppState(() => ({ ...settings }));
      })
      .catch(error => {
        const response = error && error.response && error.response.data || {};

        this.showAlert(response.msg, response.hint, 'error', 10000);
      });

    this.props.setAppState(() => ({
      config: nextConfig,
github assembl / assembl / assembl / static2 / .storybook / config.js View on Github external
//   
// );
// addDecorator(bootstrapWrapperDecorator);

addDecorator(withInfo);

// Option defaults:
setOptions({
  name: 'Assembl',
  url: '#',
  hierarchySeparator: /\//,
  hierarchyRootSeparator: /\|/
});

I18n.setTranslations(messages);
I18n.setLocale('fr');

function loadStories() {
  require('../js/app/integration/101/components/button101/button101.stories.jsx');
  require('../js/app/integration/101/components/checkbox101/checkbox101.stories.jsx');
  require('../js/app/integration/101/components/checkboxList101/checkboxList101.stories.jsx');
  require('../js/app/stories/components/common/menu/menu.stories.jsx');

  require('../js/app/stories/components/debate/common/toggleCommentButton.stories.jsx');
  require('../js/app/stories/components/debate/common/replyToCommentButton.stories.jsx');
  require('../js/app/stories/components/debate/common/sharePostButton.stories.jsx');
  require('../js/app/stories/components/debate/common/commentHelperButton.stories.jsx');

  require('../js/app/stories/components/debate/brightMirror/fictionPreview.stories.jsx');
  require('../js/app/stories/components/debate/brightMirror/fictionsList.stories.jsx');
  require('../js/app/stories/components/debate/brightMirror/instructionsText.stories.jsx');
  require('../js/app/stories/components/debate/brightMirror/circleAvatar.stories.jsx');
github QuentinDutot / motada-photos-browser / src / client / index.js View on Github external
import React from 'react'
import ReactDOM from 'react-dom'
import ReactGA from 'react-ga'
import { I18n } from 'react-i18nify'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import translations from '../assets/translations/translations'
import Home from './containers/Home'
import reducer from './reducer'
import './index.css'

I18n.setTranslations(translations)
I18n.setLocale(
  (localStorage.getItem('motada_language') || navigator.language || navigator.userLanguage || 'en').substring(0,2)
)

if(window.location.href.indexOf('localhost') === -1) {
  ReactGA.initialize('UA-127688890-1')
  ReactGA.pageview(window.location.pathname + window.location.search)
}

ReactDOM.render(
  
    
  ,
  document.getElementById('root'),
)
github decidim / decidim / decidim-comments / app / frontend / application / application.component.tsx View on Github external
constructor(props: ApplicationProps) {
    const { locale } = props;

    I18n.setLocale(locale);

    super(props);
  }
github flyve-mdm / web-mdm-dashboard / src / hoc / withI18NTranslation / index.js View on Github external
.then(jsonModule => {
        I18n.setTranslations({
          [i18nConvention]: jsonModule
        })
        I18n.setLocale(i18nConvention)
        this.forceUpdate()
      }).catch((error) => {
        I18n.setTranslations(this.props.languageDefault)
github flyve-mdm / web-mdm-dashboard / src / hoc / withI18NTranslation / index.js View on Github external
.then((jsonModule) => {
          I18n.setTranslations({
            [i18nConvention]: jsonModule,
          })
          I18n.setLocale(i18nConvention)
          this.forceUpdate()
        }).catch((error) => {
          I18n.setTranslations(this.props.languageDefault)