【发布时间】:2014-09-24 20:43:01
【问题描述】:
我正在使用Angular-gettext to extract strings from .html 和.js files 使用Gruntfile.js 进行多语言翻译:
grunt.initConfig({
nggettext_extract: {
pot: {
files: {
'po/template.pot': ['**/*.html', '**/*.cshtml', '**/controller.caseload.js']
}
},
}
但是当我尝试从 .cshtml 文件中提取时,它并没有被提取。
我需要从我的 Header.cshtml 文件中提取,因为我将它用作我的 Angular 应用程序的布局。该布局基本上在每个页面的顶部显示一个标题栏,其中包含用户信息(个人资料、首选项、注销等)。
当我尝试将<div translate>Preferences<div> 之类的行添加到我的 Header.cshtml 文件中时,它不会提取到我的 .pot 文件中。但是,如果我将同一行添加到我的 index.html 文件中,它会正确提取,然后我就可以为其定义翻译。
对于 .cshtml 文件是否有使用 angular-gettext 的好方法?
【问题讨论】:
-
如果您找到解决方案,请发布您的解决方案。我在同一条船上。
标签: asp.net-mvc angularjs razor gettext po