grunt-wiredep在使用环境中通过bower安装angular-i18n后,无法注入的错误消息

我读完了AngularJS参考书。这本书很好。

所以,我查看了filter的i18n部分,并且立即尝试安装了它。然后发现,在使用grunt-wiredep的Grunt任务中无法注入该插件,并且在HTML文件的注释之间没有插入指向i18n的script标签。

顺便说一下,这是在使用generator-angular创建的项目中,通过bower安装了i18n插件后发生的问题。

% bower install angular-i18n --save

% grunt serve

# .......略...............

Running "wiredep:app" (wiredep) task
app/index.html modified.

angular-i18n was not injected in your file.
Please go take a look in "/home/vagrant/myApp/client/bower_components/angular-i18n" for the file you need, then manually include it in your file.

Running "wiredep:sass" (wiredep) task

angular-i18n was not injected in your file.
Please go take a look in "/home/vagrant/myApp/client/bower_components/angular-i18n" for the file you need, then manually include it in your file.
  <!-- bower:js -->
  <!-- 略 -->
  <script src="bower_components/angular-i18n/angular-locale_ja-jp.js"></script>
  <!-- ↑これが入って欲しいが入らない -->
  <!-- endbower -->

当检查angular-i18n的bower.json文件时,发现没有指定main。
因为包含了各种语言的包,并且无法自动解决区域设置,所以可以理解这样。
因此,在bower.json中作出了如下修改。

  "overrides": {
    "angular-i18n": {
      "main": "angular-locale_ja-jp.js"
    }
  }

执行包含grunt serve或wiredep任务的任务…好的。已注入。

  <!-- bower:js -->
  <!-- 略 -->  
  <script src="bower_components/angular-i18n/angular-locale_ja-jp.js"></script>
  <!-- endbower -->
bannerAds