1.1.2 • Published 2 years ago

@mobeuv/react-native-i18n v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

The Package

This package is a fork of (https://github.com/AlexanderZaytsev/react-native-i18n). All rights to the fork go to the proper authors under the MIT license (https://github.com/AlexanderZaytsev) We created this fork to make the package available with future fixes and new features.

Installation

yarn add @mobeuv/react-native-i18n

Usage

# i18N.ts

import i18n from '@mobeuv/react-native-i18n';
import ptBr from './translations/pt.json';
import en from './translations/en.json';

// Enable fallbacks if you want `en-US`
// and `en-GB` to fallback to `en`
i18n.defaultLocale = 'pt-BR';
i18n.fallbacks = true;
i18n.translations = {
  'pt-BR': ptBr,
  en,
};

export default i18n;
# Using in rendering
import * as React from 'react';
import {View, Text } from 'react-native';
import I18n from './i18n';

export default function App() {
  return (
    <View>
      <Text>{I18n.t(['HomeScreen', 'welcome'])}</Text>
    </View>
  );
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT