react-native-localizable
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

react-native-localizable

Decrease your bundle.js size by using translation directly from native layer as native app :)

Instalation

npm install --save react-native-localizable
react-native link react-native-localizable

Instalation Android

@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new RNLocalizablePackage(R.string.class) // << Add your application R.string here!
    );
}

On strings.xml

<resources>
    <string name="STRING_FROM_NATIVE">Hello from the NATIVE side, I must've called a thousand time...</string>
</resources>

Instalation iOS

Create Localizable.strings file as a normal iOS application.

On localizable.strings

"STRING_FROM_NATIVE" = "Hello from the NATIVE side, I must've called a thousand time...";

App side

Javascript:

    import Localizable from 'react-native-localizable';
    console.log(Localizable.STRING_FROM_NATIVE);

Typescript:

   import Localizable from 'react-native-localizable';
   
   interface Strings {
       STRING_FROM_NATIVE: string
   }
   
   const strings = Localizable as String;
   console.log(strings.STRING_FROM_NATIVE);

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i react-native-localizable

      Weekly Downloads

      2

      Version

      1.0.1

      License

      Apache 2.0

      Unpacked Size

      114 kB

      Total Files

      22

      Last publish

      Collaborators

      • fabriciovergal