biesbjerg / ngx-translate-extract

Extract translatable (using ngx-translate) strings and save as a JSON or Gettext pot file
MIT License
524 stars 196 forks source link

my steps and how solve my error #259

Closed johnfelipe closed 2 years ago

johnfelipe commented 2 years ago
git clone https://github.com/biesbjerg/ngx-translate-extract
cd ngx-translate-extract/
npm install @biesbjerg/ngx-translate-extract --save-dev

nano

##
  "scripts": {
    "build": "npm run clean && tsc",
    "watch": "npm run clean && tsc --watch",
    "clean": "rimraf ./dist",
    "lint": "tslint --force './src/**/*.ts'",
    "test": "mocha -r ts-node/register tests/**/*.spec.ts"
    "i18n:init": "ngx-translate-extract --input ./src --output ./src/assets/i18n/template.json --key-as-default-value --replace --format json",
    "i18n:extract": "ngx-translate-extract --input ./src --output ./src/assets/i18n/{en,da,de,fi,nb,nl,sv}.json --clean --format json"
  },

##

cp -r /root/XREngine/packages/ /root/ngx-translate-extract/src

SNAG-1193

root@ubuntu21:~/ngx-translate-extract# npm run i18n:extract
npm ERR! code EJSONPARSE
npm ERR! path /root/ngx-translate-extract/package.json
npm ERR! JSON.parse Unexpected string in JSON at position 532 while parsing '{
npm ERR! JSON.parse   "name": "@biesbjerg/ngx-translate-ex'
npm ERR! JSON.parse Failed to parse JSON data.
npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-06-05T14_54_51_651Z-debug-0.log

and now this

root@ubuntu21:~/ngx-translate-extract# ngx-translate-extract --input ./src --output ./src/assets/i18n/strings.json
ngx-translate-extract: command not found
johnfelipe commented 2 years ago
  "scripts": {
    "build": "npm run clean && tsc",
    "watch": "npm run clean && tsc --watch",
    "clean": "rimraf ./dist",
    "lint": "tslint --force './src/**/*.ts'",
    "test": "mocha -r ts-node/register tests/**/*.spec.ts",
    "i18n:init": "ngx-translate-extract --input ./src --output ./src/assets/i18n/template.json --key-as-default-value --replace --format json",
    "i18n:extract": "ngx-translate-extract --input ./src --output ./src/assets/i18n/{en,da,de,fi,nb,nl,sv}.json --clean --format json"
  },