yarn xliffmerge argument parser broken
See original GitHub issueusing your latest version from today:
My Environment:
- ubuntu 19.04
- node 12.4
- angular 8.0.0.1
- yarn 1.16.0 and 1.17.0
- ngx-i18nsupport: 1.1.6
yarn xliffmerge fails to run, it seems to get an extra parameter which it interprets as a language this paramer is the path of xliffmerge (i redacted the paths a little bit)
yarn xliffmerge -p xliffmerge.json -v en
xliffmerge -p xliffmerge.json -v en
* xliffmerge version 1.1.6
* xliffmerge Used Parameters:
* usedProfilePath: "xliffmerge.json"
* defaultLanguage: "en"
* srcDir: "src/locale"
* genDir: "src/locale"
* i18nBaseFile: "messages"
* i18nFile: "src/locale/messages.xlf"
* languages: /home/XYZ/src/node_modules/.bin/xliffmerge,en,de,fr,it
* outputFile[/home/XYZ/src//node_modules/.bin/xliffmerge]: src/locale/messages./homeXYZ/src/node_modules/.bin/xliffmerge.xlf
* outputFile[en]: src/locale/messages.en.xlf
* outputFile[de]: src/locale/messages.de.xlf
* outputFile[fr]: src/locale/messages.fr.xlf
* outputFile[it]: src/locale/messages.it.xlf
* removeUnusedIds: true
* supportNgxTranslate: false
* useSourceAsTarget: true
* targetPraefix: ""
* targetSuffix: ""
* allowIdChange: true
* beautifyOutput: false
* preserveOrder: true
* autotranslate: false
ERROR: language "/home/XYZ/src/node_modules/.bin/xliffmerge" is not valid
error Command failed with exit code 255.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
in your file xliff-merge.js where the command line arguments are parsed
static parseArgs(argv) {
const options = {
languages: []
};
for (let i = 1; i < argv.length; i++) {
const arg = argv[i];
its starting from 1, From what I read here: (found in the internet 😉)
// print process.argv
process.argv.forEach(function (val, index, array) {
console.log(index + ': ' + val);
});
This will generate:
$ node process-2.js one two=three four
0: node
1: /Users/mjr/work/node/process-2.js
2: one
3: two=th
the “real” arguments also should start from 2 not 1.
So if i change line 53 to
for (let i = 2; i < argv.length; i++) {
it works for me.
As an alternative: addind to the parseArgs something like
else if (arg.length > 0 && arg.charAt(0) === '/') {
console.log('ignore this');
}
works too, but i guess thats not generic enough.
Not sure whether this is specific to using yarn or my setup.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
xliffmerge with angular what does profile.json contain
My configuration file (xliffmerge.json) is in the same folder as package.json ... "extract-i18n": "ng xi18n --output-path i18n && xliffmerge ...
Read more >@peertube/xliffmerge - npm
Merge XLIFF used by PeerTube. Latest version: 2.0.3, last published: a year ago. Start using @peertube/xliffmerge in your project by running ...
Read more >Front-end - personeltest.ru
$this->_twigEnvironment->render( $template, $args );} catch ( Exception $ex ) ... will generate ean exception if a template doesn't exist OR broken // also...
Read more >Martin Roob ngx-i18nsupport Issues - Giters
yarn xliffmerge argument parser broken ... xliffmerge: use official Angular v9 i18n config ... Arabic auto translate problem with xliffmerge.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

As a workaround for Angular 10+, I created a small script to directly call the xliffmerge function
I call it from package.json
This issue is still present, I can only run
xliffmergefrom the commandline when discarding the first argument. Otherwise the path to thexliffmerge“binary” entry file is mistaken as a language.Is there any chance of a hotfix specifically for
xliffmerge? I do understand that keeping up with Angulars Builder API is an invidious task, but this neat little tool works quite fine on its own.