AngularJS load different css files depending on locale -
i've got multilingual application supports farsi , english, might know farsi rtl, used css-flipper in gulp files create version of whole css files in rtl, problems cannot inject them (with gulp-inject, obvious reasons!) have manually insert them index.html best way this? use angular-css add css files depending on locale (i use angular-local) in it's constructor (i used typescript swiip's angular generator)
also, should able remove ltr css file , add rtl css file , vice versa
export class maincontroller { private $translate: angular.translate.itranslateprovider; private $css; public constructor($translate: angular.translate.itranslateprovider, $css: object) { this.$translate = $translate; this.$css = $css; if (this.getlang() === 'en') { this.$css.add('app/index.min.css'); } else { this.$css.add('app/index.rtl.min.css'); } } public getlang() { return this.$translate.use(); } public changelang() { if (this.getlang() === 'fa') { this.$translate.use('en'); this.$css.remove('app/index.rtl.min.css'); this.$css.add('app/index.min.css'); } else { this.$translate.use('fa'); this.$css.remove('app/index.min.css'); this.$css.add('app/index.rtl.min.css'); } } }
Comments
Post a Comment