@tolgee/svelte 4.2.1 → 4.3.0-rc.10eeecf.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +9 -7
- package/T.svelte +0 -0
- package/T.svelte.d.ts +0 -0
- package/TolgeeProvider.svelte +5 -0
- package/TolgeeProvider.svelte.d.ts +0 -0
- package/getLanguageStore.d.ts +0 -0
- package/getLanguageStore.js +0 -0
- package/getTolgeeContext.d.ts +0 -0
- package/getTolgeeContext.js +0 -0
- package/getTranslate.d.ts +0 -0
- package/getTranslate.js +0 -0
- package/index.d.ts +0 -0
- package/index.js +0 -0
- package/package.json +4 -3
- package/types.d.ts +0 -0
- package/types.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 4.3.0-rc.10eeecf.0 (2022-03-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* ui is now included automatically ([10eeecf](https://github.com/tolgee/tolgee-js/commit/10eeecfd72908391045dc30876fe20387c4f995d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [4.2.1](https://github.com/tolgee/tolgee-js/compare/v4.2.0...v4.2.1) (2022-03-14)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @tolgee/svelte
|
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Tolgee for Svelte
|
|
2
|
+
|
|
2
3
|

|
|
3
4
|

|
|
4
5
|

|
|
@@ -27,7 +28,7 @@ Lokalize (translate) your Svelte projects to multiple languages with Tolgee. Int
|
|
|
27
28
|
|
|
28
29
|
First, install the package.
|
|
29
30
|
|
|
30
|
-
npm install @tolgee/svelte
|
|
31
|
+
npm install @tolgee/svelte
|
|
31
32
|
|
|
32
33
|
Then use the library in your app:
|
|
33
34
|
|
|
@@ -35,17 +36,14 @@ Then use the library in your app:
|
|
|
35
36
|
|
|
36
37
|
<script lang="ts">
|
|
37
38
|
import { TolgeeProvider } from "@tolgee/svelte";
|
|
38
|
-
import UI from "@tolgee/ui";
|
|
39
39
|
import type { TolgeeConfig } from "@tolgee/core";
|
|
40
40
|
|
|
41
41
|
const tolgeeConfig = {
|
|
42
42
|
preloadFallback: true,
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
// when using SvelteKit and .env, otherwise you can set those params directly or use some dotenv library
|
|
45
45
|
apiUrl: import.meta.env.VITE_TOLGEE_API_KEY,
|
|
46
|
-
|
|
47
|
-
ui: import.meta.env.VITE_TOLGEE_API_KEY ? UI : undefined,
|
|
48
|
-
apiKey: import.meta.env.VITE_TOLGEE_API_KEY
|
|
46
|
+
apiKey: import.meta.env.VITE_TOLGEE_API_KEY
|
|
49
47
|
} as TolgeeConfig;
|
|
50
48
|
</script>
|
|
51
49
|
|
|
@@ -60,6 +58,7 @@ Then use the library in your app:
|
|
|
60
58
|
To translate texts using Tolgee Svelte integration, you can use `T` component or `getTranslate` function.
|
|
61
59
|
|
|
62
60
|
### T component
|
|
61
|
+
|
|
63
62
|
```sveltehtml
|
|
64
63
|
|
|
65
64
|
<script>
|
|
@@ -71,7 +70,9 @@ To translate texts using Tolgee Svelte integration, you can use `T` component or
|
|
|
71
70
|
```
|
|
72
71
|
|
|
73
72
|
### getTranslate function
|
|
73
|
+
|
|
74
74
|
The `getTranslate` function returns store containing the function, which actually translates your key.
|
|
75
|
+
|
|
75
76
|
```sveltehtml
|
|
76
77
|
<script>
|
|
77
78
|
import { getTranslate } from "@tolgee/svelte";
|
|
@@ -84,6 +85,7 @@ The `getTranslate` function returns store containing the function, which actuall
|
|
|
84
85
|
```
|
|
85
86
|
|
|
86
87
|
### Changing the language
|
|
88
|
+
|
|
87
89
|
To change the current language, use `getLanguageStore` method. For example, you can bind it to select value.
|
|
88
90
|
|
|
89
91
|
```sveltehtml
|
|
@@ -108,4 +110,4 @@ To change the current language, use `getLanguageStore` method. For example, you
|
|
|
108
110
|
|
|
109
111
|
## Quick integration guide
|
|
110
112
|
|
|
111
|
-
Learn more at our [documentation website 📖](https://tolgee.io).
|
|
113
|
+
Learn more at our [documentation website 📖](https://tolgee.io).
|
package/T.svelte
CHANGED
|
File without changes
|
package/T.svelte.d.ts
CHANGED
|
File without changes
|
package/TolgeeProvider.svelte
CHANGED
|
@@ -3,6 +3,11 @@ import { IcuFormatter, Tolgee, TolgeeConfig } from '@tolgee/core';
|
|
|
3
3
|
export let config;
|
|
4
4
|
const tolgee = Tolgee.use(IcuFormatter).init({
|
|
5
5
|
wrapperMode: 'invisible',
|
|
6
|
+
ui: process.env.NODE_ENV !== 'development'
|
|
7
|
+
? undefined
|
|
8
|
+
: typeof require !== 'undefined'
|
|
9
|
+
? require('@tolgee/ui')
|
|
10
|
+
: import('@tolgee/ui'),
|
|
6
11
|
...(config || new TolgeeConfig()),
|
|
7
12
|
});
|
|
8
13
|
let tolgeeRunPromise;
|
|
File without changes
|
package/getLanguageStore.d.ts
CHANGED
|
File without changes
|
package/getLanguageStore.js
CHANGED
|
File without changes
|
package/getTolgeeContext.d.ts
CHANGED
|
File without changes
|
package/getTolgeeContext.js
CHANGED
|
File without changes
|
package/getTranslate.d.ts
CHANGED
|
File without changes
|
package/getTranslate.js
CHANGED
|
File without changes
|
package/index.d.ts
CHANGED
|
File without changes
|
package/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tolgee/svelte",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-rc.10eeecf.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"
|
|
5
|
+
"@tolgee/core": "^4.3.0-rc.10eeecf.0",
|
|
6
|
+
"@tolgee/ui": "^4.3.0-rc.10eeecf.0"
|
|
6
7
|
},
|
|
7
8
|
"devDependencies": {
|
|
8
9
|
"@sveltejs/kit": "next",
|
|
9
10
|
"@testing-library/jest-dom": "5.16.2",
|
|
10
11
|
"@testing-library/svelte": "3.0.3",
|
|
11
|
-
"@tolgee/core": "^4.2.1",
|
|
12
12
|
"@types/jest": "27.4.1",
|
|
13
13
|
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
|
14
14
|
"@typescript-eslint/parser": "^5.14.0",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"eslint-config-prettier": "^8.5.0",
|
|
17
17
|
"eslint-plugin-svelte3": "^3.4.1",
|
|
18
18
|
"jest": "27.5.1",
|
|
19
|
+
"jest-fetch-mock": "^3.0.3",
|
|
19
20
|
"nodemon": "^2.0.15",
|
|
20
21
|
"prettier": "^2.5.1",
|
|
21
22
|
"prettier-plugin-svelte": "^2.6.0",
|
package/types.d.ts
CHANGED
|
File without changes
|
package/types.js
CHANGED
|
File without changes
|