angular-course
angular-course copied to clipboard
Schema validation failed with the following errors: Data path "" must NOT have additional properties(i18nFile).
Hello,
I followed the guide on internationalization and I'm sad to inform you, that it is outdated. You already updated this repo to angular v13, but the i18n fields in the angular.json don't work anymore since v11. I tested out your current master, then I also tested out some older commits to find out why it doesn't work.
When you run "ng build -c fr" it fails with the error:
Schema validation failed with the following errors: Data path "" must NOT have additional properties(i18nFile).
Then I tested the same command with commit "77a89a4226cc90e55dd1a8352f2e237b3e78d1b9" labeled "upgrade to angular 12" and I got the same result.
Commit: "88288b6f03384ff1ef916c5310cdd58609908f48" labeled "upgrade to Angular 11 and Node 14" worked, but it told me:
Option "i18nFile" is deprecated: Use 'locales' object in the project metadata instead.
Option "i18nLocale" is deprecated: Use 'localize' instead.
At the start when I was building the fr configuration.
Commit: "ec06a6131bd1c37a95d797002727d7ce6a502a6d" labeled "upgrade to angular 10" also worked, but without warning.
The way Angular handles i18n now is actually through adding locales to the workspace. It is very confusing to me at the moment, so I sadly can't point you to resources that will help you update your course.
I made the current master (fd09f9574663cb6202d8b05ac00ab7b8d8674a95) work. I don't know if this is now the expected solution, but here is how I did it:
In Angular.json:
- delete lines:
"i18nFile": "src/locale/messages.fr.xlf", "i18nLocale": "fr", - insert:
"localize": ["fr"],instead.
Then "ng serve -c fr" works and the translations are available.
The "fr" config should look like this then:
"fr": { "budgets": [ { "type": "anyComponentStyle", "maximumWarning": "6kb" } ], "outputPath": "dist/angular-course-fr/", "localize": ["fr"], "i18nMissingTranslation": "ignore" }