How to use the @nationalbankbelgium/stark-core.mergeTranslations function in @nationalbankbelgium/stark-core

To help you get started, we’ve selected a few @nationalbankbelgium/stark-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NationalBankBelgium / stark / showcase / src / app / translation.config.ts View on Github external
export function initializeTranslation(translateService: TranslateService, dateAdapter: DateAdapter): void {
	translateService.addLangs(["en", "fr", "nl"]);
	translateService.setDefaultLang("en");
	translateService.use("en");

	// set the Moment language, otherwise it is set by the last imported locale!
	moment.locale("en"); // in fact Moment default language is US English
	dateAdapter.setLocale("en"); // US English locale in Moment is just "en"

	const english: StarkLocale = { languageCode: "en", translations: translationsEn };
	const french: StarkLocale = { languageCode: "fr", translations: translationsFr };
	const dutch: StarkLocale = { languageCode: "nl", translations: translationsNl };

	mergeTranslations(translateService, english, french, dutch);
}
github NationalBankBelgium / stark / packages / stark-ui / src / common / translations / merge-translations.ts View on Github external
export function mergeUiTranslations(translateService: TranslateService, ...localesToMerge: StarkLocale[]): void {
	const allLocalesToMerge: StarkLocale[] = [];

	// the common UI translations are merged with the given locales before calling the mergeTranslations from Stark-Core
	for (const locale of localesToMerge) {
		allLocalesToMerge.push({
			languageCode: locale.languageCode,
			translations: merge({}, commonUiTranslations[locale.languageCode], locale.translations)
		});
	}

	// finally the mergeTranslations from Stark-Core merges all the locales (common UI + given locales)
	mergeTranslations(translateService, ...allLocalesToMerge);
}
github NationalBankBelgium / stark / starter / src / app / translation.config.ts View on Github external
* The English StarkLocale, composed of the "en" language code
	 * and an object that retrieves all the English translations for the application in a json file
	 */
	const english: StarkLocale = { languageCode: "en", translations: translationsEn };
	/**
	 * The French StarkLocale, composed of the "fr" language code
	 * and an object that retrieves all the French translations for the application in a json file
	 */
	const french: StarkLocale = { languageCode: "fr", translations: translationsFr };
	/**
	 * The Dutch StarkLocale, composed of the "nl" language code
	 * and an object that retrieves all the Dutch translations for the application in a json file
	 */
	const dutch: StarkLocale = { languageCode: "nl", translations: translationsNl };

	mergeTranslations(translateService, english, french, dutch);
}