quipper / i18n-dts

A d.ts file generator for i18n-js.
Apache License 2.0
48 stars 6 forks source link

Support react-native-languages(i18n-js) #6

Closed hotchemi closed 5 years ago

hotchemi commented 5 years ago

Issue

resolves https://github.com/quipper/react-native-i18n-ts/issues/5

Overview

https://github.com/AlexanderZaytsev/react-native-i18n has become obsolete and https://github.com/react-community/react-native-languages would be the next popular i18n library among RN community.

Actually react-native-languages doesn't support exact i18n translation directly..it just delegates works to other i18n library(https://github.com/fnando/i18n-js is quoted in README), so I've modified the namespace of generated file and update example module to use react-native-languages.

Then...should we rename the lib name to i18n-ts? 🤔

declare module "i18n-js" {
    var fallbacks: boolean;
    var translations: {
        [keys: string]: any;
    };
    var defaultLocale: string;
    var locale: string;
    function currentLocale(): string;
    function t(key: "title"): string;
}

declare module "*.json" {
    const value: any;
    export default value;
}
hotchemi commented 5 years ago

Go Bold