Skip to content

Commit ab3d7ca

Browse files
author
Nikos Vasileiou
authored
Merge pull request #12 from transifex/react
@transifex/react library
2 parents 3e64343 + a727f73 commit ab3d7ca

19 files changed

+23879
-47
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
node_modules
22
coverage
3+
dist
34
test_dist
45
.DS_store
56
.nyc_output
67
.idea
8+
npm-debug.log*

README.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,24 @@
33

44
# Transifex Javascript Toolkit
55

6-
Transifex Javascript Toolkit is a collection of tools that allow you to easily localize your Javascript applications using Transifex. The toolkit features fetching translations over the air (OTA) to your apps.
6+
Transifex Javascript Toolkit is a collection of tools to easily localize your Javascript applications using [Transifex Native](https://www.transifex.com/native/).
7+
The toolkit features fetching translations over the air (OTA) to your apps.
78

89
This project adheres to the Contributor Covenant [code of conduct](/CODE_OF_CONDUCT.md). To contribute to Transifex Javascript Toolkit, please check out the [contribution guidelines](/CONTRIBUTING.md).
910

10-
## Javascript Native Library
11+
## Transifex Native for Javascript
1112

1213
Vanilla Javascript library to localize web apps using Transifex Native.
1314
[Read more](https://github.com/transifex/transifex-javascript/tree/master/packages/native)
1415

15-
## Javascript CLI tools
16+
## Transifex Native for React
1617

17-
CLI tools for extracting phrases from source files and pushing content to Transifex.
18+
Transifex Native support for localizing React components.
19+
[Read more](https://github.com/transifex/transifex-javascript/tree/master/packages/react)
20+
21+
## Transifex Native CLI
22+
23+
Command line tool for extracting phrases from source files and pushing content to Transifex.
1824
[Read more](https://github.com/transifex/transifex-javascript/tree/master/packages/cli)
1925

2026
# License

RELEASE_HOWTO.md

+4-12
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@
22

33
To release a new version to NPM follow those steps:
44

5-
## Step 1: Build and commit the source code
6-
7-
Build the source code using:
8-
9-
```npm run build```
10-
11-
and commit the build output found in the `dist` folder if not done already.
12-
13-
## Step 2: Bump the version and tag the commit
5+
## Step 1: Bump the version and tag the commit
146

157
From the `master` branch (requires administrative permissions) execute the
168
following command:
@@ -23,7 +15,7 @@ select the next version (major, minor or patch).
2315
Upon finish, lerna will **create a version commit and push it directly to master and
2416
tag the release**, e.g. `v0.10.0`.
2517

26-
## Step 3: Create a github release
18+
## Step 2: Create a github release
2719

2820
The next step involves creating a Github release. Go to Github releases and
2921
**Draft a new release** by using the tag lerna created:
@@ -34,7 +26,7 @@ Release title: `[v0.10.0]`
3426

3527
Description: `[Details on what changed during this release]`
3628

37-
## Step 4: Automatic publishing using Github actions
29+
## Step 3: Automatic publishing using Github actions
3830

3931
When the release is created, a Github action will be automatically triggered
40-
and the packages will be deployed to NPM.
32+
and the packages will be built and deployed to NPM.

packages/cli/README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# @transifex/cli
1+
# Transifex Native CLI
22

3-
Transifex Native Javascript CLI.
4-
5-
Parse `.js` or `.jsx` files and scan for Transifex Native phrases.
6-
Push phrases to Transifex for localization.
3+
A command line tool that parses `.js` or `.jsx` source files, extracts phrases marked for localization by [Transifex Native](https://www.transifex.com/native/) and pushes them to [Transifex](https:/www.transifex.com) for translation.
74

85
Related packages:
9-
[@transifex/native](https://www.npmjs.com/package/@transifex/native)
6+
* [@transifex/native](https://www.npmjs.com/package/@transifex/native)
7+
* [@transifex/react](https://www.npmjs.com/package/@transifex/react)
108

119
# Usage
1210

packages/cli/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"transifex",
88
"i18n",
99
"l10n",
10-
"localization"
10+
"localization",
11+
"cli"
1112
],
1213
"homepage": "https://github.com/transifex/transifex-javascript/tree/master/packages/cli",
1314
"repository": "git://github.com/transifex/transifex-javascript.git",

packages/native/README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
# Transifex Javascript Native
1+
# Transifex Native for Javascript
22

3-
A general purpose Javascript library for localizing web apps using Transifex Native.
3+
A general purpose Javascript library for localizing web apps using [Transifex Native](https://www.transifex.com/native/).
44

55
Requires a Transifex Native Project Token.
66

7-
Supported Node.js versions >= 10.x.x
7+
Supported Node.js versions >= `10.x.x`
8+
9+
Related packages:
10+
* [@transifex/react](https://www.npmjs.com/package/@transifex/react)
11+
* [@transifex/cli](https://www.npmjs.com/package/@transifex/native)
812

913
## Quick starting guide
1014

packages/native/dist/browser.native.js

-9
This file was deleted.

packages/native/dist/browser.native.js.map

-1
This file was deleted.

packages/native/dist/node.native.js

-9
This file was deleted.

packages/native/dist/node.native.js.map

-1
This file was deleted.

packages/native/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@transifex/native",
33
"version": "0.1.0",
4-
"description": "Transifex Native",
4+
"description": "Transifex Native for Javascript",
55
"keywords": [
66
"transifex",
77
"i18n",

packages/react/.babelrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"targets": {
7+
"node": "10"
8+
}
9+
}
10+
],
11+
"@babel/preset-react"
12+
]
13+
}

packages/react/.eslintrc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": ["airbnb"],
3+
"rules": {
4+
}
5+
}

packages/react/README.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Transifex Native for React
2+
3+
React component for localizing React application using [Transifex Native](https://www.transifex.com/native/).
4+
5+
Related packages:
6+
* [@transifex/native](https://www.npmjs.com/package/@transifex/native)
7+
* [@transifex/cli](https://www.npmjs.com/package/@transifex/native)
8+
9+
## Install
10+
11+
Install the library and its dependencies using:
12+
13+
```npm install @transifex/native @transifex/react --save```
14+
15+
## Usage
16+
17+
```jsx
18+
import React, { Component } from 'react'
19+
20+
import T from '@transifex/react'
21+
22+
class Example extends Component {
23+
render() {
24+
const user = 'Joe';
25+
return (
26+
<div>
27+
<T _str="Hello world" />
28+
<T _str="Hello {username}" username={user} />
29+
<T
30+
_str="Hello <b>{username}</b>"
31+
_html
32+
username={user}
33+
/>
34+
<p>
35+
<T
36+
_str="Hello <b>{username}</b>"
37+
_html _inline
38+
username={user}
39+
/>
40+
</p>
41+
</div>
42+
)
43+
}
44+
}
45+
```
46+
47+
Available optional props:
48+
| Prop | Type | Description |
49+
| ---------- | ------- | ---------------------------------------------- |
50+
| _str | String | Source string |
51+
| _html | Boolean | Render source string as HTML inside a `div` tag|
52+
| _inline | Boolean | Wrap translation in `span` when `_html` is used|
53+
| _context | String | String context, affects key generation |
54+
| _key | String | Custom string key |
55+
| _comment | String | Developer comment |
56+
| _charlimit | Number | Character limit instruction for translators |
57+
| _tags | String | Comma separated list of tags |
58+
59+
# License
60+
61+
Licensed under Apache License 2.0, see [LICENSE](https://github.com/transifex/transifex-javascript/blob/HEAD/LICENSE) file.

0 commit comments

Comments
 (0)