I want to use internationalization (i18n) from Angular 2 in my Ionic 2 project. Unfortunately, I cannot create the source translation file using the ng-xi18n tool trying to execute the following command:
./node_modules/.bin/ng-xi18n
A TypeError message appears:
TypeError: Cannot read property 'create' of undefined at Function.Extractor.create (/Users/user/Development/app/node_modules/@angular/compiler-cli/src/extractor.js:69:45) at extract (/Users/user/Development/app/node_modules/@angular/compiler-cli/src/extract_i18n.js:7:34) at Object.main (/Users/user/Development/app/node_modules/@angular/tsc-wrapped/src/main.js:47:16) at Object.<anonymous> (/Users/user/Development/app/node_modules/@angular/compiler-cli/src/extract_i18n.js:14:9) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) Extraction failed
I tried updating my packages without success. Here are my dependencies in the package.json file
"dependencies": { "@angular/common": "2.0.0-rc.4", "@angular/compiler": "2.0.0-rc.4", "@angular/compiler-cli": "^2.4.0", "@angular/core": "2.0.0-rc.4", "@angular/forms": "0.2.0", "@angular/http": "2.0.0-rc.4", "@angular/platform-browser": "2.0.0-rc.4", "@angular/platform-browser-dynamic": "2.0.0-rc.4", "@angular/platform-server": "^2.4.0", "es6-shim": "0.35.1", "ionic-angular": "2.0.0-beta.11", "ionic-native": "1.3.10", "ionicons": "3.0.0", "reflect-metadata": "0.1.8", "rxjs": "5.0.0-beta.6", "typescript": "^2.1.4", "zone.js": "0.6.12" },
Maybe someone solved the problem in the past. Thanks for the answers in extended.
source share