Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include specific locale from AngularJS I18n files using bower?

I've downloaded the angular I18n repo using bower install angular-i18n which pulls it into my bower_compontents and updates the bower.json file with angular-i18n : 1.5.3, which is expected behavior.

I want to include a specific locale(ex. de-de.js) in my build process so that it gets included along with the other angular scripts, every time I run grunt serve which isn't happening at the moment. Any ideas how this can be achieved?

Thanks.

like image 874
SinSync Avatar asked Jun 21 '26 18:06

SinSync


2 Answers

In my case, I added in my bower file the specific version that i need using the link of the raw version of the file angular-locale_es.js. bower.json

"dependencies": {
    "angular": "^1.5.0",
    "angular-mocks": "^1.5.0",
    ...
    "angular-locale_es": "https://raw.githubusercontent.com/angular/bower-angular-i18n/master/angular-locale_es.js",
     ...
  }
like image 153
Gonzalo Pincheira Arancibia Avatar answered Jun 23 '26 06:06

Gonzalo Pincheira Arancibia


In your bower.json you can add an overrides section and specify the i18n script you want to include.

{
  "name": "your application",
  "version": "1.1.2",
  "dependencies": {
    "angular": "#1.5.7",
    "angular-i18n": "#1.5.7",
	"moment": "#2.13.0",
  },
  "overrides": {
    "angular-i18n":{
      "main":[
        "angular-locale_de-ch.js"
      ]

    },
    "moment": {
      "main": [
        "moment.js",
        "locale/de.js"
      ]
    },
  }
}
like image 39
RenRen Avatar answered Jun 23 '26 07:06

RenRen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!