1
grunt.loadNpmTasks('grunt-angular-gettext');
grunt.initConfig({
nggettext_extract:{
  pot:{
    files:{
      'po/template.pot':['**/*.html']
    }
  }
},
nggettext_compile: {
  all:{
    files:{
      'translations.js':['po/*.po']
    }
  }
}
});

控制器

app.run(['gettextCatalog',function(gettextCatalog){
  gettextCatalog.currentLanguage='de';
  gettextCatalog.debug='true';
}])

html

<div class="row margin-bottom">
    <div ng-controller="DefCtrl">
      <p translate> Welcome!!!!</p>
      <p translate> Testing globalization and localization</p>
    </div>
  </div>

我正在运行这些命令:

grunt nggettext_extract
grunt nggettext_compile

两者都成功运行,但 translations.js 不包含 .pot 文件中的任何字符串

4

2 回答 2

0

如果有人仍在寻找您必须使用 waybackwhen 的文档。https://web.archive.org/然后粘贴链接。

于 2020-06-03T08:37:51.923 回答
0

.pot 文件是翻译模板,不应包含实际翻译。正确翻译的完整指南可以在 angular-gettext 网站上找到:https ://angular-gettext.rocketeer.be/dev-guide/translate/

于 2015-10-29T10:39:23.270 回答