svelte-translate-tools Svelte Themes

Svelte Translate Tools

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

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

Top categories

Loading Svelte Themes