stefalda / react-localization

Simple module to localize the React interface using the same syntax used in the ReactNativeLocalization module.
MIT License
373 stars 58 forks source link

Apply Flowtype for react-localization #55

Open hprobotic opened 6 years ago

hprobotic commented 6 years ago

Hi guys

We working applied both react-localization and flow type in our project. But we faced some error between flow-type. Please check below

So is react-localization supported flow-type yet? screen shot 2017-11-23 at 10 27 32 am

hprobotic commented 6 years ago

For someone who get stuck with this package. Here is the solution

type I18nType = {
  setLanguage: (language: string) => void,
  getLanguage: () => string,
  getInterfaceLanguage: () => string,
  formatString: (str: string, ...values: any[]) => string,
  getAvailableLanguages: () => string[],
  getString: (key: string, language: string) => string,
  setContent: (props: any) => void,
  [_: string]: string | { [_: string]: string | number }
}