JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q35150F
  • License ISC

Vite Plugin to transpile JSON into TypeScript for Sveltekit.

Package Exports

  • @abineo/sveltekit-i18n
  • @abineo/sveltekit-i18n/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@abineo/sveltekit-i18n) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

⚠️ Archived and Unmaintained ⚠️

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Sveltekit Auto-Typed i18n

npm

Vite Plugin to transpile translations from JSON into TypeScript for Sveltekit.

📖 Documentation

Notice

Use this library with causion. There are lot of tests that need to be written and possibly some bugs to be fixed. But we do not expect to introduce breaking changes.

Found a bug? -> Contributing

Installation

npm install --save-dev @abineo/sveltekit-i18n

Usage

// vite.config.ts
import { sveltekit } from '@sveltejs/kit/vite';
import type { UserConfig } from 'vite';
import i18n from '@abineo/sveltekit-i18n';

const config: UserConfig = {
    plugins: [i18n({
        {
            src: './src/lib/i18n/src',
            out: './src/lib/i18n',
            folder: 'dist',
            defaultParamType: 'string',
            createGitignore: true,
            createSummary: true,
            defaultLanguage: 'de-CH',
        }
    }), sveltekit()],
};

export default config;
// src/lib/i18n/src/de-CH.jsonc
{
    "strongly": {
        "typed": {
            "translations": "Lorem ipsum dolor sit amet."
        }
    },
    "even": {
        "supports": "what? { thing: string }!"
    }
}
<script lang="ts">
    import { selectedLanguage, t } from '$lib/i18n';
    selectedLanguage.set('de-CH');
</script>

<main>
    <p>{$t.strongly.typed.translations}</p>
    <p>{$t.even supports('parameters')}</p>
    <!-- Output: <p>what? parameters!</p> -->
</main>

Contributing

If you think you found a bug: open a issue. Feature request are also welcome.

License

This library is distributed under the terms of the ISC License.
Find an easy explanation on choosealicense.com/licenses/isc.