-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add docs for react-trans and mit license
- Loading branch information
1 parent
48a818a
commit 4e90455
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2017 Tomáš Ehrlich | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
| master | next | | ||
| :---: | :---: | | ||
| [![CircleCI](https://circleci.com/gh/lingui/js-lingui/tree/master.svg?style=svg)](https://circleci.com/gh/lingui/js-lingui/tree/master) | [![CircleCI](https://circleci.com/gh/lingui/js-lingui/tree/next.svg?style=svg)](https://circleci.com/gh/lingui/js-lingui/tree/next) | | ||
|
||
Lingui - javascript tools for internationalization | ||
================================================== | ||
|
||
`js-lingui` is a set of tools to help translate UI and maintain translations. | ||
|
||
Tools | ||
----- | ||
|
||
### `babel-plugin-transform-react-trans` | ||
|
||
Status: *in progress* | ||
|
||
Write strings for translation in human-readable format and let `babel` to preprocess it. | ||
|
||
Example: | ||
|
||
```js | ||
/* Variable interpolation & inlined components */ | ||
<Trans>Hello world, my name is <strong>{joe}</strong></Trans> | ||
/* <Trans id="Hello world, my name is <0>{joe}</0>" params={{joe}} /> */ | ||
|
||
/* ICU format messages */ | ||
<Trans> | ||
<Plural | ||
count={count} | ||
zero="There're no bottles left" | ||
one="There's 1 bottle hanging" | ||
many="There're # bottles hanging" | ||
/> on the wall. | ||
</Trans> | ||
/* <Trans id="{plural, count, zero {...} one {...} many {...}}" params={{count}} /> */ | ||
``` | ||
|
||
### `babel-plugin-extract-messages` | ||
|
||
Status: *upcoming* | ||
|
||
Extract all messages for translation to external file. | ||
|
||
### `react-trans` | ||
|
||
Status: *in progress* | ||
|
||
React bindings for message formating. | ||
|
||
#### Components | ||
- `Trans` – component for message formating and translation | ||
- `I18nProvider` – context provider of all i18n data (messages, current language, etc) | ||
- `InjectI18n` - HOC for passing i18n data from context to props of wrapped component | ||
|
||
## License | ||
|
||
[MIT](./LICENSE.md) |