https://github.com/i18n-pro/react
Lightweight, simple, flexible, automatic translation internationalization tool for React(适用于 React 的轻量、简单、灵活、自动翻译的国际化工具)
https://github.com/i18n-pro/react
auto-translation automatic-translation i18n i18n-pro machine-translation react react-i18n react-intl react-native translator
Last synced: 6 months ago
JSON representation
Lightweight, simple, flexible, automatic translation internationalization tool for React(适用于 React 的轻量、简单、灵活、自动翻译的国际化工具)
- Host: GitHub
- URL: https://github.com/i18n-pro/react
- Owner: i18n-pro
- License: mit
- Created: 2023-02-11T12:23:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-21T13:11:47.000Z (about 1 year ago)
- Last Synced: 2025-03-17T14:59:02.294Z (7 months ago)
- Topics: auto-translation, automatic-translation, i18n, i18n-pro, machine-translation, react, react-i18n, react-intl, react-native, translator
- Language: TypeScript
- Homepage:
- Size: 868 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Lightweight, simple, flexible, automatic translation internationalization tool for React
English | [简体中文](https://github.com/i18n-pro/react/blob/v1.0.1/README_zh-CN.md)
[](https://www.npmjs.com/package/@i18n-pro/react "npm")
[](https://www.npmjs.com/package/@i18n-pro/react "npm")[](https://github.com/i18n-pro/react/stargazers "github-stars")
[](https://github.com/i18n-pro/react/commits/main "last-commit")
[](https://github.com/i18n-pro/react/issues "github-issues")
[](https://codecov.io/gh/i18n-pro/react "codecov")
Table of Contents
[Vision](#vision)
[Requirement](#requirement)
[Features](#features)
[Live Demo](#live-demo)
[Principle](#principle)
[License](#license)# Vision
To make internationalization easy and enjoyable 😄💪🏻
# Requirement* react >= **16.8.0**
* react-dom >= **16.8.0**
* react-native >= **0.59.0**
* i18n-pro >= **2.0.0**# Features
* **lightweight**:[](https://bundlephobia.com/package/i18n-pro "i18n-pro-bundlesize") + [](https://bundlephobia.com/package/@i18n-pro/react "bundlesize")
* The following features are inherited from [i18n-pro](https://github.com/i18n-pro/core "i18n-pro")
* **simple**
* **flexible**
* **automatic-translation**
* **keyless**# Live Demo
* [Open in CodeSandbox](https://codesandbox.io/p/github/i18n-pro/react-demo/main?file=README.md)
* [](https://stackblitz.com/github/i18n-pro/react-demo?file=README.md)# Principle
This library is implemented based on [i18n-pro](https://github.com/i18n-pro/core "i18n-pro") combined with `React` 's `context` featureMainly composed of `2` parts
* I18nProvider
* useI18n**I18nProvider**:Configure container components for internationalization initialization properties
**useI18n**:Hook method for obtaining internationalization API and state
A simple example is as follows
```typescript react
import React from 'react'
import { render } from 'react-dom'
import { I18nProvider, useI18n } from '@i18n-pro/react'function App() {
const { t } = useI18n()return <>{t('hello world')}>
}render(
,
document.getElementById('root'),
)
```# Help Document
>To avoid unnecessary duplicate document content, some of the documents in this library are linked to the content in `i18n-pro`
The `i18n-pro` related link in the current document is based on the `2.1.1` version. If you are using a different version, you need to check the document corresponding to the version you are using to avoid inconsistent usage
* Current Library
* [Quick Start](https://github.com/i18n-pro/react/blob/v1.0.1/docs/dist/USAGE.md)
* [API](https://github.com/i18n-pro/react/blob/v1.0.1/docs/dist/API.md)
* [Changelog](https://github.com/i18n-pro/react/blob/v1.0.1/docs/dist/CHANGELOG.md)
* i18n-pro
* [Command Line](https://github.com/i18n-pro/core/blob/v2.1.1/docs/dist/COMMAND_LINE.md)
* [Matching Rules](https://github.com/i18n-pro/core/blob/v2.1.1/docs/dist/MATCH_RULE.md)
* [Q&A](https://github.com/i18n-pro/core/blob/v2.1.1/docs/dist/Q&A.md)
* [Translation log](https://github.com/i18n-pro/core/blob/v2.1.1/docs/dist/OUTPUT_LOG.md)# License
[MIT](./LICENSE)Copyright (c) 2023-present Eyelly Wu