
SDK for SvelteKit
inlang provides an SDK that integrates seamlessly with SvelteKit.
Getting Started
Add
@inlang/sdk-js
dependency to your projectAdd the inlang plugin to the
plugins
section ofvite.config.js
Note: the inlang plugin must be added before the sveltekit plugin
That's it. You have now completed the setup and can output Messages everywhere in your SvelteKit project.
Usage
Wherever you want to output a message, you can use the inlang-function.
Take a look at the Usage to learn more about how to use inlang in your project.
Configuration
You can configure the inlang SDK depending on your needs. You can learn more in the Configuration section.
Further reading
The sdk is using the json-plugin as a default interface to parse the language strings. To use this code, you need to have language resources in JSON format in a languages
folder in the root of your project. Each file should have the language ID as the file name. If that doesn't match your requirements check out the other plugins.
A valid JSON file would look like this.
Is something unclear or do you have questions? Reach out to us in our Discord channel or open a Discussion or an Issue on Github.