Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:skolmer/i18n-tag-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
skolmer committed Jul 3, 2016
2 parents 218b52e + 5508a5a commit ae6004e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
42 changes: 31 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ i18nTagSchema('./src', '\\.jsx?', './translation.schema.json', false, (output, t
})
```

### Commandline
### Via npm

#### package.json
```json
{
"scripts": {
"schema": "i18n-tag-schema ./src"
}
}
```
Usage: i18n-tag-schema <path> [options]
Options:
-h, --help output usage information
-V, --version output the version number
-s, --schema <path> set schema path. defaults to ./translation.schema.json
-f, --filter <regex> a regular expression to filter source files. defaults to \\.jsx?
-g, --groups group translations by module filenames
```sh
$ npm run schema
```

### Gulp Task
### Via Gulp
```js
var gulp = require('gulp')
var i18nTagSchema = require('i18n-tag-schema').default
Expand All @@ -47,6 +47,26 @@ gulp.task('generate-translation-schema', function (cb) {
})
```

### Via Command-line

Install i18n-tag-schema as global package to use it as command-line tool

```sh
$ npm install i18n-tag-schema -g
```

```
Usage: i18n-tag-schema <path> [options]
Options:
-h, --help output usage information
-V, --version output the version number
-s, --schema <path> set schema path. defaults to ./translation.schema.json
-f, --filter <regex> a regular expression to filter source files. defaults to \.jsx?
-g, --groups group translations by module filenames
```

### Reference schema in translation.json file
```json
{
Expand Down
2 changes: 1 addition & 1 deletion cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ program
.version('0.0.1')
.usage('<path> [options]')
.option('-s, --schema <path>', 'set schema path. defaults to ./translation.schema.json')
.option('-f, --filter <regex>', 'a regular expression to filter source files. defaults to \\\\.jsx?')
.option('-f, --filter <regex>', 'a regular expression to filter source files. defaults to \\.jsx?')
.option('-g, --groups', 'group translations by module filenames')
.action(function (path) {
i18nTagSchema(path, program.filter || '\\.jsx?', program.schema || './translation.schema.json', program.groups, (output, type) => {
Expand Down

0 comments on commit ae6004e

Please sign in to comment.