Seth Falco
Seth Falco

Reputation: 620

Message misses a translation when i18nMissingTranslation is set to ignore

I'm trying to serve a web application in multiple languages however despite setting i18nMissingTranslation to ignore, it's still throwing errors on missing translations.

I've tried setting the i18nMissingTranslation in the prod config, in a single locale config defined like the official i18n docs and via command argument for example:

ng build --prod --i18nFormat xlf --i18nFile src/locale/messages.fr.xlf --i18nLocale fr --baseHref /fr/ --outputPath dist/fr/

Script to export messages:

"xi18n": "ng xi18n --i18n-locale en-US --output-path ./locale/ --out-file messages.en-US.xlf"

Config containing all locales:

"config": {
  "locales": "en-US fr nl"
}

Script to build languages:

"build": "ng build --prod",
"build:loop": "for lang in ${npm_package_config_locales}; do LANG=${lang} && npm run-script build:i18n; done",
"build:i18n": "npm run-script build -- --i18nFormat xlf --i18nFile src/locale/messages.${LANG}.xlf --i18nLocale ${LANG} --baseHref /${LANG}/ --outputPath dist/${LANG}/"

I'd expect this to allow me to export sites with missing target tags if not all translations have been translated yet.

Instead, I receive an error for each missing target tag:

ERROR in xliff parse errors:
Message {} misses a translation ("

Upvotes: 1

Views: 2374

Answers (1)

Seth Falco
Seth Falco

Reputation: 620

The solution is instead of doing as instructed and copying the empty/template translations and updating the language to handle them, just manually create a new file and start putting new translations in from scratch.

You don't want to have entries with missing target tags, you just shouldn't have those entries what so ever if they haven't been translated yet.

Upvotes: 1

Related Questions