How to use the react-i18nify.I18n.setTranslations 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 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');
github flyve-mdm / web-mdm-dashboard / src / hoc / withI18NTranslation / index.js View on Github external
}).catch((error) => {
        I18n.setTranslations(this.props.languageDefault)
        this.forceUpdate()
      })
    }
github flyve-mdm / web-mdm-dashboard / src / hoc / withI18NTranslation / index.js View on Github external
constructor(props) {
      super(props)
      I18n.setTranslations({
        [this.props.languageDefault]: source_file_translation
      })
    }
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 flyve-mdm / web-mdm-dashboard / src / hoc / withI18NTranslation / index.js View on Github external
}).catch((error) => {
          I18n.setTranslations(this.props.languageDefault)
          this.forceUpdate()
        })
    }
github scaleflex / filerobot-uploader / projects / react-plugin / components / AirstoreUploaderWrapper.js View on Github external
import React from 'react';
import '../polyfills';
import AirstoreUploader from './AirstoreUploader';
import AppState from './AppState';
import { ThemeProvider } from 'styled-components';
import { I18n } from 'react-i18nify';
import * as translations from '../assets/translations';
import theme, { colorSchemes } from '../assets/styles/colorScheme';

I18n.setTranslations(translations);

export default (props) => {
  const {
    config = {}, opened = false, onClose = () => {}, initialTab = null, onUpload = () => {}, ...otherProps
  } = props;
  config.colorScheme = config.colorScheme || {};

  const colorTheme = config.colorScheme.active;
  const colors = colorTheme === 'custom' ?
    config.colorScheme[colorTheme] : colorSchemes[colorTheme || 'solarized'];

  return (
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 scaleflex / filerobot-uploader / projects / react-plugin / components / AirstoreUploaderWrapper.js View on Github external
import React from 'react';
import AirstoreUploader from './AirstoreUploader';
import AppState from './AppState';
import { ThemeProvider } from 'styled-components';
import { I18n } from 'react-i18nify';
import * as translations from '../assets/translations';
import '../assets/fonts/scaleflex-icon-font.css';
import theme, { colorSchemes } from '../assets/styles/colorScheme';
import '../utils/md5';

I18n.setTranslations(translations);

export default (props) => {
  const {
    config = {}, opened = false, onClose = () => {}, initialTab = null, onUpload = () => {}, ...otherProps
  } = props;
  config.colorScheme = config.colorScheme || {};

  const colorTheme = config.colorScheme.active;
  const colors = colorTheme === 'custom' ?
    config.colorScheme[colorTheme] : colorSchemes[colorTheme || 'default'];

  return (
github decidim / decidim / decidim-comments / app / frontend / support / load_translations.ts View on Github external
export const loadLocaleTranslations = (locale: string) => {
  const translationFile = require(`./../../../config/locales/${locale}.yml`);
  const translations = Object.keys(translationFile).reduce((acc: any, key: string) => {
    acc[locale] = translationFile[locale].decidim;
    return acc;
  }, {});

  I18n.setTranslations(translations);
};