angularjs - Angular translate static files loader with html-backend -
i have json traslations page gets loaded static files loader works fine, when use $httpbackend simulate api calls doesnt load. config looks this:
$translateprovider.usestaticfilesloader({ prefix: "assets/lang-", suffix: ".json" });*/ $translateprovider.useinterpolation('textbreaksinterpolation'); $translateprovider.preferredlanguage('en');
i have whitelisted assets in htmlbackend this:
$httpbackend.whenget(/assets.*/).respond(200, '');
any suggestions? thanks.
i suggest not use lazy loading @ all. (of course, if don't have many languages).
just build text json file bundle:
import textsen 'texts.en.json'; import textsde 'texts.de.json'; import textses 'texts.es.json'; .config($translateprovider => { $translateprovider.translations('en', textsen); $translateprovider.translations('de', textsde); $translateprovider.translations('es', textses); })
Comments
Post a Comment