Giter VIP home page Giter VIP logo

react-i18n-helper's People

Contributors

nunopinheiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

malixsys

react-i18n-helper's Issues

Why jquery?

If all you need is the ability to fetch a document on a server you could use simply fetch and a polyfill or something like axios

Can't install

Running 'npm install --save react-i18n-helper' gives me an npm error 'Refusing to install react-i18n-helper as a dependency of itself'.

*edit

Adding it to package dependencies worked. But now I get this on npm start:
'Failed at the [email protected] start script 'rackt server'.

forceUpdate is not a function

It seems that react doesn't have built in support for mixins when using ES6 style classes.
So I'm importing react-mixin which should help me. But I'm getting an error on changeLocale forceUpdate is not a function.
The initialData is loaded fine and I can see the right json being loaded on changeLocale. This is my component:

import React, {Component} from 'react';
import {changeLocale, i18nEventsListenerMixin, setupI18NConfiguration, i18n } from 'react-i18n-helper';
import reactMixin from 'react-mixin';

export default class Locale extends Component {

  constructor(props) {
    const initialData = {HelloWorld: 'Hello, World!'};
    super(props);
    setupI18NConfiguration({clientPath: 'static/i18n', fallBackLocale: 'en-GB', initialState: {locale: 'en-GB', data: initialData}});
  }


  state = {
    desktop: true
  };


  render() {
    return (
      <div>
        <span>{i18n('HelloWorld')}</span>
        <button onClick={() => changeLocale('pt-PT')}>pt-PT</button>
        <button onClick={() => changeLocale('en-GB')}>en-GB</button>
      </div>
    );
  }
}

reactMixin(Locale.prototype, i18nEventsListenerMixin);

Do you have an idea about what I'm doing wrong?...thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.