ngx-translate-po-http-loader
ngx-translate-po-http-loader copied to clipboard
Add Angular 7 support
With Angular 7, I get the following warnings:
npm i @biesbjerg/ngx-translate-po-http-loader --save
npm WARN @biesbjerg/[email protected] requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @biesbjerg/[email protected] requires a peer of @angular/common@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @biesbjerg/[email protected] requires a peer of @ngx-translate/core@^10.0.0 but none is installed. You must install peer dependencies yourself.
I am using Angular 7 with ngx-translate/core 11.x and ngx-translate/http-loader 4.x.
ERROR in ./node_modules/@biesbjerg/ngx-translate-po-http-loader/node_modules/gettext-parser/lib/poparser.js
Module not found: Error: Can't resolve 'stream' in '...\node_modules\@biesbjerg\ngx-translate-po-http-loader\node_modules\gettext-parser\lib'
It is strange because it was with the only package that did not work (there were 2 more with the same error), I added the following configuration to tsconfig.json
and for the others it worked:
{
...
"compilerOptions": {
...
"paths": {
"stream": ["../node_modules/readable-stream/readable.js"]
}
}
}
Try installing directly npm install stream
and compile. But during the deployment in the browser comes out another error. Despite this, try the solution seen in the PR requested for update with angle 6, but unfortunately it did not work either (see thread #26 )
I habe to admit, I abbandoned the idea of using ngx-translate with the po-loader since I could not work around this problem. Since it seems that @biesbjerg has abandoned this project I went ahead and used angular-l10n instead. I had to jump through a few hoops but got it up & running, even working with the ngx-translate-extractor, which wasn't built for angular-l10n at all. It doesn't with the full angular-l10n featureset, but good enough to extract .po files. I convert these .po files on the fly with a small server-side python script, but working with .mo files should work as well. I hope @biesbjerg will find the time someday to maintain this project again.
@Mohl @daniel-bikemap meanwhile can go trying the solution provided in #22 (https://github.com/biesbjerg/ngx-translate-po-http-loader/issues/22#issuecomment-389494302), so far, I compiled as much as I ran in the browser!
ERROR in ./node_modules/@biesbjerg/ngx-translate-po-http-loader/node_modules/gettext-parser/lib/poparser.js Module not found: Error: Can't resolve 'stream' in '...\node_modules\@biesbjerg\ngx-translate-po-http-loader\node_modules\gettext-parser\lib'
It is strange because it was with the only package that did not work (there were 2 more with the same error), I added the following configuration to
tsconfig.json
and for the others it worked:{ ... "compilerOptions": { ... "paths": { "stream": ["../node_modules/readable-stream/readable.js"] } } }
Try installing directly
npm install stream
and compile. But during the deployment in the browser comes out another error. Despite this, try the solution seen in the PR requested for update with angle 6, but unfortunately it did not work either (see thread #26 )
You should probably change
"stream": ["../node_modules/readable-stream/readable.js"]
to
"stream": ["./node_modules/readable-stream/readable.js"]
That worked for me.