0
votes

I am trying to port an app from angularJS to angular4.

I am slowly moving component from one to another, and have issue with the translation.

I am trying to use the old angularjs translation, and the ngx-translator together.

before I had

$translateProvider.useStaticFilesLoader({
            files: [{
                prefix: 'languages/locale-',
                suffix: '.json'
            },{
                prefix: 'languages/' + 'beee' + '/locale-',
                suffix: '.json'
            }]
        });

But it looks like ngx-translate do not allow static file? Is there any solution other than httprequest ?

1

1 Answers

0
votes

You can try using require() function to load files instead of HTTP calls.

EX:

var data=require('assets/data.'+CULTURE+'.json');
switch(rName){
case("resourses"):
this.resourses=data[rName];
break;
}