-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Lexical error on line 1. Unrecognized text. #49
Comments
Could you post the whole command (including parameters) which you use to run xgettext-template? |
2 thoughts on this:
|
I had some issues with the command from the SO above, but this worked for me: find views -name "*.handlebars" \
| xargs xgettext-template -L Handlebars --from-code utf8 --force-po -o en.po (I guess you should remove the slash and write it as one line in package.json) |
Indeed the above command worked just fine! Thanks! "scripts": {
"po": "find views -name '*.handlebars' | xargs xgettext-template -L Handlebars --from-code utf8 --force-po -o en.po"
}, |
You're welcome! |
I've ended up using a Grunt task to handle the .pot / .po / .json transformations. Here is the sample of code: // node_modules required:
// xargs - for compatibility
// po2json - generate json file from a .po to be used by Jed
// grunt-shell - execute shell commands
// tasks/po.js
var locales = ["en_US", "es_US", "fr_CA"];
module.exports = {
shell: {
options: {
failOnError: true,
preferLocal: true
},
xgettext: {
command: "find js/receipt/templates -name '*.hbs' | xargs xgettext-template -L Handlebars -o js/receipt/po/ref.pot --from-code utf8 -j --force-po"
},
msgmerge: {
command: locales.map(function (locale) {
return "msgmerge js/receipt/po/" + locale + ".po js/receipt/po/ref.pot -U\n";
}).join("")
},
po2json: {
command: locales.map(function (locale) {
return "po2json js/receipt/po/" + locale + ".po js/receipt/json/" + locale + ".json -f jed1.x -p true\n";
}).join("")
}
}
}
//Gruntfile.js
grunt.registerTask(
'po', [
'shell:xgettext',
'shell:msgmerge',
'shell:po2json'
]
); |
Working on Mac when creating folders it also creates a bunch of extra invisible files such as .DS_Store, these files then gets included by the xgettext package and obviously throws an error because they are invalid handlebars files.
Could the
-D
parameter references and parse only.hbs
or.handlebars
files?Had to clear extra files using the commands described inside mikeal/tako#4 but then as soon as something is modified, the file gets created again
The text was updated successfully, but these errors were encountered: