0.8.0 • Published 4 years ago

@i18n-chain/taro v0.8.0

Weekly downloads
20
License
MIT
Repository
github
Last release
4 years ago

Installation

yarn add @i18n-chain/taro

# OR

npm install @i18n-chain/taro

Create i18n instance

Visit Github Repo to get more information.

Use with Hooks

// ./src/components/App.tsx

import Taro, { FC } from '@tarojs/taro';
import { useI18n, hack } from '@i18n-chain/taro';
import i18n from '../i18n';

const App: FC = () => {
  // For re-render when i18n switch locale
  useI18n(i18n);

  return <button>{hack(i18n).button.submit}</button>;
};

export default App;

Use with Component

// ./src/components/App.tsx

import Taro, { Component } from '@tarojs/taro';
import { I18nProvider, hack } from '@i18n-chain/taro';
import i18n from '../i18n';

// Must use decorator in taro
@I18nProvider(i18n)
class App extends Component {
  return <button>{hack(i18n).button.submit}</button>;
};

// For re-render when i18n switch locale
export default App;
1.0.0

4 years ago

0.8.0

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago