How to use react-i18nify - 10 common examples

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');
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 scaleflex / filerobot-uploader / dist / components / UploadImagesTab / UserUploaderTab.js View on Github external
}, _this.uploadFromWeb = function () {
      var value = _this._uploadFromWebField.value;
      var isValid = value && /^(http:\/\/|https:\/\/|\/\/)/.test(value);

      if (isValid) _this.upload(true, value);else _this.uploadError(value ? _reactI18nify.I18n.t('upload.url_not_valid') : _reactI18nify.I18n.t('upload.empty_url'), 4000);
    }, _temp), _possibleConstructorReturn(_this, _ret);
  }
github artisavotins / react-redux-i18n / build / index.js View on Github external
function syncTranslationWithStore(store) {
  _reactI18nify.I18n.setTranslationsGetter(function () {
    try {
      return store.getState().i18n.translations;
    } catch (e) {
      console.error('Error getting translations from store!');
    }
  });
  _reactI18nify.I18n.setLocaleGetter(function () {
    try {
      return store.getState().i18n.locale;
    } catch (e) {
      console.error('Error getting locale from store!');
    }
  });
}
github artisavotins / react-redux-i18n / build / index.js View on Github external
var _reducer = require('./reducer');

Object.defineProperty(exports, 'i18nReducer', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_reducer).default;
  }
});
exports.syncTranslationWithStore = syncTranslationWithStore;

var _reactI18nify = require('react-i18nify');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.I18n = _reactI18nify.I18n;
exports.Translate = _reactI18nify.Translate;
exports.Localize = _reactI18nify.Localize;
function syncTranslationWithStore(store) {
  _reactI18nify.I18n.setTranslationsGetter(function () {
    try {
      return store.getState().i18n.translations;
    } catch (e) {
      console.error('Error getting translations from store!');
    }
  });
  _reactI18nify.I18n.setLocaleGetter(function () {
    try {
      return store.getState().i18n.locale;
    } catch (e) {
      console.error('Error getting locale from store!');
    }
github artisavotins / react-redux-i18n / build / index.js View on Github external
Object.defineProperty(exports, 'i18nReducer', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_reducer).default;
  }
});
exports.syncTranslationWithStore = syncTranslationWithStore;

var _reactI18nify = require('react-i18nify');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.I18n = _reactI18nify.I18n;
exports.Translate = _reactI18nify.Translate;
exports.Localize = _reactI18nify.Localize;
function syncTranslationWithStore(store) {
  _reactI18nify.I18n.setTranslationsGetter(function () {
    try {
      return store.getState().i18n.translations;
    } catch (e) {
      console.error('Error getting translations from store!');
    }
  });
  _reactI18nify.I18n.setLocaleGetter(function () {
    try {
      return store.getState().i18n.locale;
    } catch (e) {
      console.error('Error getting locale from store!');
    }
  });
}
github artisavotins / react-redux-i18n / build / index.js View on Github external
var _reducer = require('./reducer');

Object.defineProperty(exports, 'i18nReducer', {
  enumerable: true,
  get: function get() {
    return _interopRequireDefault(_reducer).default;
  }
});
exports.syncTranslationWithStore = syncTranslationWithStore;

var _reactI18nify = require('react-i18nify');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.I18n = _reactI18nify.I18n;
exports.Translate = _reactI18nify.Translate;
exports.Localize = _reactI18nify.Localize;
function syncTranslationWithStore(store) {
  _reactI18nify.I18n.setTranslationsGetter(function () {
    try {
      return store.getState().i18n.translations;
    } catch (e) {
      console.error('Error getting translations from store!');
    }
  });
  _reactI18nify.I18n.setLocaleGetter(function () {
    try {
      return store.getState().i18n.locale;
    } catch (e) {
      console.error('Error getting locale from store!');
    }
  });
github scaleflex / filerobot-uploader / projects / react-plugin / components / UploadImagesTab / PreUploadProcess.js View on Github external
as="div"
                className={`active-option${operationOpen ? ' active' : ''}`}
                onClick={() => { this.setState({ operationOpen: !this.state.operationOpen }); }}
              >
                {I18n.t(`upload.${operation}`)}
              

              <div>
                <div>{I18n.t('upload.smart_crop')}</div>
                <div>{I18n.t('upload.face_detection')} </div>

                <div>{I18n.t('upload.resize')}</div>
              </div>
            

            {I18n.t(`upload.width`)}
github decidim / decidim / decidim-comments / app / frontend / comments / add_comment_form.component.tsx View on Github external
private _renderTextArea() {
    const { commentable: { id, type }, autoFocus } = this.props;
    const { error } = this.state;
    const className = classnames({ "is-invalid-input": error });

    const textAreaProps: any = {
      ref: (textarea: HTMLTextAreaElement) =&gt; {this.bodyTextArea = textarea; },
      id: `add-comment-${type}-${id}`,
      className,
      rows: "4",
      maxLength: MAX_LENGTH,
      required: "required",
      pattern: `^(.){0,${MAX_LENGTH}}$`,
      placeholder: I18n.t("components.add_comment_form.form.body.placeholder"),
      onChange: (evt: React.ChangeEvent) =&gt; this._checkCommentBody(evt.target.value),
    };

    if (autoFocus) {
      textAreaProps.autoFocus = "autoFocus";
    }

    return (
      <textarea>    );
  }
</textarea>