9

I have old legacy site translated of 4 different languages with Gettext and .po files.

Now I am starting rebuilding of the site, and trying to use those files in new Angular2 site.

Is there any way I could directly use .po files?

I have tried https://github.com/ocombe/ng2-translate with https://www.npmjs.com/package/@biesbjerg/ng2-translate-po-loader but It's not working properly when passing params to string.

Then I tried some converters, to convert .po to JSON, but they are adding some nulls and arrays...

For example converting:

msgid "meta:Reporting"
msgstr "Reporting"

I get:

"meta:Reporting": [
    null,
    "Reporting"
]

Instead of

"meta:Reporting" : "Reporting"

Is there way to use directly .po files in Angular2?

Nutic
  • 1,407
  • 4
  • 16
  • 31

1 Answers1

9

I use ngx-translate together with ngx-translate-po-http-loader. I use them together with ngx-translate-extract to extract text from my .ts-fies to one or more .pot-files

Challe
  • 866
  • 12
  • 26