Streamline javascript translation by improving translationRunner (#2808)

* package.json: Add "build:*" targets

* Improve react-intl-translations-manager workflow.
  * Added "build:production" to build production bundle.
  * Added "build:development" to build development bundle.

* Fix json translation files

* Run `yarn manage:translations` to fix translation files.
* Fix `pl.json` for syntax error.

* translationRunner: auto detect existing languages

* Auto detect existing rfc5646 language tag in *.json filenames
  in `app/javascript/mastodon/locale` folder. No need to manually
  define every new language in the languages array here.

* translationRunner: add more functionality

* Allow script user to specify language code to check.
* Added available language check.
* Added --force flag to force creation of unexists language.
* Added --help flag and help messages.

* gitignore: ignore npm-debug.log

* Fix webpack error if NODE_ENV is not defined

Default to use 'development' in config/webpack/configuration.js
This commit is contained in:
Koala Yeung 2017-05-06 10:05:38 +08:00 committed by Eugen Rochko
parent ddc34feb58
commit cf0b753209
8 changed files with 101 additions and 41 deletions

View file

@ -3,6 +3,8 @@
"license": "AGPL-3.0",
"scripts": {
"postversion": "git push --tags",
"build:development": "NODE_ENV=development yarn webpack -- --config config/webpack/development.js",
"build:production": "NODE_ENV=production yarn webpack -- --config config/webpack/production.js",
"manage:translations": "node ./config/webpack/translationRunner.js",
"start": "babel-node ./streaming/index.js --presets es2015,stage-2",
"storybook": "start-storybook -p 9001 -c storybook",
@ -113,6 +115,7 @@
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.10.3",
"jsdom": "^9.11.0",
"minimist": "^1.2.0",
"mocha": "^3.2.0",
"react-intl-translations-manager": "^5.0.0",
"webpack-dev-server": "^2.4.5"