@mi18n/web v5.13.0
{% import "../../readmeMacros/macros.njk.md" as macros %}
{{ macros.header('Mi18n JS Web', 'The base of Mi18n JS integrations for Web platform', packageName) }}
What is Mi18n JS Web?
It's the core library of Mi18n JS integrations containing the parts supporting the web platform. For more information about Mi18n JS integrations, visit the docs({{ macros.v5link() }}).
{{ macros.links() }}
{{ macros.installation('web') }}
Usage
First, create a Mi18n instance and run it.
import { Mi18n, DevTools, FormatSimple } from "@mi18n/web";
const tg = Mi18n()
.use(DevTools())
.use(FormatSimple())
.init({
apiKey: "your_api_key",
apiUrl: "https://app.mi18n.io",
})
tg.run();
Then, use it to translate your strings.
tg.onLangLoaded.subscribe(() => {
document.title = tg.translate("hello_world");
});
{{ macros.why() }}
Development
{{ macros.developmentInstallation() }} {{ macros.developmentCore() }}
{{ macros.developmentTesting('/packages/core') }}
End-to-end (e2e) testing
Each integration is end-to-end tested via cypress. The tests are defined in /e2e/cypress/e2e
directory.
To run the e2e tests, simply run the following:
pnpm run e2e run <integration>
E.g.
pnpm run e2e run web
To open and play with e2e tests, run:
pnpm run e2e open <integration>
{{ macros.contributors() }}