compiled-i18n
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -24,2 +24,4 @@ import { Plugin } from 'vite'; | ||
addMissing?: boolean; | ||
/** Automatically remove unused keys from the locale files. Defaults to false. */ | ||
removeUnusedKeys?: boolean; | ||
/** Use tabs on new JSON files */ | ||
@@ -26,0 +28,0 @@ tabs?: boolean; |
{ | ||
"name": "compiled-i18n", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Framework-independent internationalization support for Vite-built projects", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/wmertens/compiled-i18n", |
35
qwik.md
@@ -5,8 +5,10 @@ # Qwik + `compiled-i18n` | ||
- [Server code](#server-code) | ||
- [Client code](#client-code) | ||
- [Route-based locale selection](#route-based-locale-selection) | ||
- [Query-based locale selection](#query-based-locale-selection) | ||
- [Cookie-based locale selection](#cookie-based-locale-selection) | ||
- [Client UI](#client-ui) | ||
- [Qwik + `compiled-i18n`](#qwik--compiled-i18n) | ||
- [Server code](#server-code) | ||
- [Client code](#client-code) | ||
- [Route-based locale selection](#route-based-locale-selection) | ||
- [Query-based locale selection](#query-based-locale-selection) | ||
- [Cookie-based locale selection](#cookie-based-locale-selection) | ||
- [Client UI](#client-ui) | ||
- [Plugin order using older qwik versions](#plugin-order-using-older-qwik-versions) | ||
@@ -228,1 +230,22 @@ ## Server code | ||
``` | ||
## Plugin order using older qwik versions | ||
If you are using a qwik version lower than 1.8, you will need to move the i18nPlugin to the top of the plugin list. | ||
```ts | ||
import { qwikVite } from '@builder.io/qwik/optimizer'; | ||
import { qwikCity } from '@builder.io/qwik-city/vite'; | ||
import {defineConfig} from 'vite' | ||
import {i18nPlugin} from 'compiled-i18n/vite' | ||
export default defineConfig({ | ||
plugins: [ | ||
i18nPlugin({ | ||
locales: ['en_us', 'en_uk', 'en', 'nl'], | ||
}), | ||
qwikCity(), | ||
qwikVite(), | ||
], | ||
}) | ||
``` |
# compiled-i18n | ||
- [Introduction](#introduction) | ||
- [Installation](#installation) | ||
- [Qwik](#qwik) | ||
- [Usage](#usage) | ||
- [How it works](#how-it-works) | ||
- [Types](#types) | ||
- [JSON translations format](#json-translations-format) | ||
- [Client-side API](#client-side-api) | ||
- [``localize`str` `` or ``_`str` ``](#localizestr--or-_str-) | ||
- [`localize(key: I18nKey, ...params: any[])` or `_(key: I18nKey, ...params: any[])`](#localizekey-i18nkey-params-any-or-_key-i18nkey-params-any) | ||
- [`currentLocale: readonly string`](#currentlocale-readonly-string) | ||
- [`locales: readonly string[]`](#locales-readonly-string) | ||
- [`localeNames: readonly const {[key: string]: string}`](#localenames-readonly-const-key-string-string) | ||
- [`loadTranslations(translations: I18n.Data['translations'], locale?: string)`](#loadtranslationstranslations-i18ndatatranslations-locale-string) | ||
- [Server-side API](#server-side-api) | ||
- [`setLocaleGetter(getLocale: () => Locale)`](#setlocalegettergetlocale---locale) | ||
- [`setDefaultLocale(locale: string)`](#setdefaultlocalelocale-string) | ||
- [Utility API](#utility-api) | ||
- [`defaultLocale: readonly string`](#defaultlocale-readonly-string) | ||
- [`guessLocale(acceptsLanguage: string)`](#guesslocaleacceptslanguage-string) | ||
- [`interpolate(translation: I18nTranslation | I18nPlural, ...params: unknown[])`](#interpolatetranslation-i18ntranslation--i18nplural-params-unknown) | ||
- [`makeKey(...tpl: string[]): string`](#makekeytpl-string-string) | ||
- [Qwik API (from 'compiled-i18n/qwik')](#qwik-api-from-compiled-i18nqwik) | ||
- [`extractBase({serverData}: RenderOptions): string`](#extractbaseserverdata-renderoptions-string) | ||
- [`setSsrLocaleGetter(): void`](#setssrlocalegetter-void) | ||
- [Vite API (from 'compiled-i18n/vite')](#vite-api-from-compiled-i18nvite) | ||
- [Choosing a key name](#choosing-a-key-name) | ||
- [Automatic translation](#automatic-translation) | ||
- [Roadmap](#roadmap) | ||
- [compiled-i18n](#compiled-i18n) | ||
- [Introduction](#introduction) | ||
- [Installation](#installation) | ||
- [Qwik](#qwik) | ||
- [Usage](#usage) | ||
- [How it works](#how-it-works) | ||
- [Types](#types) | ||
- [JSON translations format](#json-translations-format) | ||
- [Client-side API](#client-side-api) | ||
- [``localize`str` `` or ``_`str` ``](#localizestr--or-_str-) | ||
- [`localize(key: I18nKey, ...params: any[])` or `_(key: I18nKey, ...params: any[])`](#localizekey-i18nkey-params-any-or-_key-i18nkey-params-any) | ||
- [`currentLocale: readonly string`](#currentlocale-readonly-string) | ||
- [`locales: readonly string[]`](#locales-readonly-string) | ||
- [`localeNames: readonly const {[key: string]: string}`](#localenames-readonly-const-key-string-string) | ||
- [`loadTranslations(translations: I18n.Data['translations'], locale?: string)`](#loadtranslationstranslations-i18ndatatranslations-locale-string) | ||
- [Server-side API](#server-side-api) | ||
- [`setLocaleGetter(getLocale: () => Locale)`](#setlocalegettergetlocale---locale) | ||
- [`setDefaultLocale(locale: string)`](#setdefaultlocalelocale-string) | ||
- [Utility API](#utility-api) | ||
- [`defaultLocale: readonly string`](#defaultlocale-readonly-string) | ||
- [`guessLocale(acceptsLanguage: string)`](#guesslocaleacceptslanguage-string) | ||
- [`interpolate(translation: I18nTranslation | I18nPlural, ...params: unknown[])`](#interpolatetranslation-i18ntranslation--i18nplural-params-unknown) | ||
- [`makeKey(...tpl: string[]): string`](#makekeytpl-string-string) | ||
- [Qwik API (from 'compiled-i18n/qwik')](#qwik-api-from-compiled-i18nqwik) | ||
- [`extractBase({serverData}: RenderOptions): string`](#extractbaseserverdata-renderoptions-string) | ||
- [`setSsrLocaleGetter(): void`](#setssrlocalegetter-void) | ||
- [Vite API (from 'compiled-i18n/vite')](#vite-api-from-compiled-i18nvite) | ||
- [Choosing a key name](#choosing-a-key-name) | ||
- [Automatic translation](#automatic-translation) | ||
- [Roadmap](#roadmap) | ||
@@ -147,6 +148,6 @@ ## Introduction | ||
plugins: [ | ||
// ... other plugins | ||
i18nPlugin({ | ||
locales: ['en_us', 'en_uk', 'en', 'nl'], | ||
}), | ||
// ... other plugins | ||
], | ||
@@ -156,2 +157,5 @@ }) | ||
> [!WARNING] | ||
> If you are using an older qwik version than 1.8 please see [Plugin order using older qwik versions](./qwik.md#Plugin-order-using-older-qwik-versions) | ||
You have to set up your project so the plugin knows the current locale, both on the server during SSR, and on the client. | ||
@@ -367,2 +371,4 @@ | ||
addMissing?: boolean | ||
/** Automatically remove unused keys from the locale files. Defaults to false. */ | ||
removeUnusedKeys?: boolean | ||
/** Use tabs on new JSON files */ | ||
@@ -369,0 +375,0 @@ tabs?: boolean |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
74035
1397
401