每次执行 gettext.extract() 时都会覆盖 .pot 文件 - 旧翻译丢失
.pot file is overwritten everytime gettext.extract() is executed - old translations lost
我正在使用 angular-gettext 在 AngularJS
中安装多语言应用
我找不到维护旧翻译并且每次提取它们时都不会覆盖它们的方法。
这是我的 gulpfile.js
var gulp = require('gulp');
var gettext = require('gulp-angular-gettext');
gulp.task('translations:parse', function () {
return gulp.src([conf.paths.src + '/app/**/*.html', conf.paths.src + '/app/**/*.js'])
.pipe(gettext.extract('translations.pot', {}))
.pipe(gulp.dest(conf.paths.src + '/app/translations/'));
});
所以第一次生成文件"translations.pot"。如果我直接在这个文件中进行翻译,然后再次 运行 gulp translations:parse
,保存在 "translations.pot" 中的翻译将会丢失。
假设我有 translations.pot
#: partials/home.html:3
msgid "Welcome"
msgstr "Bienvenido"
再次运行宁gulp translations:parse
后,翻译丢失
#: partials/home.html:3
msgid "Welcome"
msgstr ""
有什么可能的解决方案吗?我怎样才能保存旧的翻译?
非常感谢
阿德里安·博洛尼奥
我在 GitHub
收到了开发人员的答复
You're not meant to edit the .pot file, it's a template for updating your .po files.
Here's a guide on how to do translations correctly: https://angular-gettext.rocketeer.be/dev-guide/translate/
所以问题解决了:)
我正在使用 angular-gettext 在 AngularJS
中安装多语言应用我找不到维护旧翻译并且每次提取它们时都不会覆盖它们的方法。
这是我的 gulpfile.js
var gulp = require('gulp');
var gettext = require('gulp-angular-gettext');
gulp.task('translations:parse', function () {
return gulp.src([conf.paths.src + '/app/**/*.html', conf.paths.src + '/app/**/*.js'])
.pipe(gettext.extract('translations.pot', {}))
.pipe(gulp.dest(conf.paths.src + '/app/translations/'));
});
所以第一次生成文件"translations.pot"。如果我直接在这个文件中进行翻译,然后再次 运行 gulp translations:parse
,保存在 "translations.pot" 中的翻译将会丢失。
假设我有 translations.pot
#: partials/home.html:3
msgid "Welcome"
msgstr "Bienvenido"
再次运行宁gulp translations:parse
后,翻译丢失
#: partials/home.html:3
msgid "Welcome"
msgstr ""
有什么可能的解决方案吗?我怎样才能保存旧的翻译?
非常感谢 阿德里安·博洛尼奥
我在 GitHub
收到了开发人员的答复You're not meant to edit the .pot file, it's a template for updating your .po files.
Here's a guide on how to do translations correctly: https://angular-gettext.rocketeer.be/dev-guide/translate/
所以问题解决了:)