Skip to content

Translation tools to extract/generate/compile translation files for your Svelte App (must be used with the package svelte-translate) at build time.

License

Notifications You must be signed in to change notification settings

noelmugnier/svelte-translate-tools

Repository files navigation

Svelte Translate Tool (inspired by angular i18n and svelte-i18n)

Translation tools to extract/generate/compile translation files for your Svelte App (must be used with the package svelte-translate) at build time.

Installation

npm install svelte-translate-tools -D

Dynamic translations usages

plugins: [
		extracti18n({languages:['en-GB','fr-FR'], defaultLanguage:'en-GB'}),
		generatei18n(),,
		svelte({
			preprocess: [	
				sveltePreprocess({ sourceMap: !production })	
			],
			...
		}),
		...
]

Precompiled translations usages

plugins: [
		extracti18n({languages:['en-GB','fr-FR'], defaultLanguage:'en-GB'}),
		generatei18n(),,
		svelte({
			preprocess: [	
				preprocess_compilei18n({language:"fr-FR"}),
				sveltePreprocess({ sourceMap: !production })	
			],
			...
		}),
		...
]

then replace your

<DynamicTranslatedApp>	
</DynamicTranslatedApp>

with

<PreTranslatedApp>	
</PreTranslatedApp>

TODO

  • support context/description in def() helper in order to extract them and complete xlf files require a fork on xliff library to use custom attributes

About

Translation tools to extract/generate/compile translation files for your Svelte App (must be used with the package svelte-translate) at build time.

Resources

License

Stars

Watchers

Forks

Packages

No packages published