How to use the angular-l10n.ProviderType.Fallback function in angular-l10n

To help you get started, we’ve selected a few angular-l10n 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 citizenfx / fivem / ext / cfx-ui / src / app / app.module.ts View on Github external
import { Languages } from './languages';
import { ServerTagsService } from './servers/server-tags.service';

const localePrefix = (environment.web) ? 'https://servers.fivem.net/' : './';

const l10nConfig: L10nConfig = {
	locale: {
		languages: Languages.toList(),
		language: 'en'
	},
	translation: {
		//providers: [] // see AppModule constructor
					  // broke on Angular 8, here again
		providers: [
			{ type: ProviderType.Fallback, prefix: localePrefix + 'assets/languages/locale-en', fallbackLanguage: [] },
			{ type: ProviderType.Static, prefix: localePrefix + 'assets/languages/locale-' }
		]
	}
};

export function localStorageFactory() {
	return (typeof window !== 'undefined') ? window.localStorage : null;
}

export function metaFactory(): MetaLoader {
	return new MetaStaticLoader({
		pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
		pageTitleSeparator: ' / ',
		applicationName: 'FiveM server list'
	});
}