@candidosales/svelte-google-translate 0.0.1 → 0.0.3
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 +6 -0
- package/GoogleTranslate.svelte.d.ts +4 -4
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/package.json +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
elementId?: string | undefined;
|
|
4
|
+
elementId?: string | HTMLElement | undefined;
|
|
5
5
|
options?: {
|
|
6
6
|
/**
|
|
7
7
|
* This option specifies the language of the page that you want to translate. The default value is "auto", which means that Google will detect the language automatically.
|
|
8
8
|
*/
|
|
9
|
-
pageLanguage
|
|
9
|
+
pageLanguage?: string | undefined;
|
|
10
10
|
/**
|
|
11
11
|
* This option is an array of language codes that you want to include in the language selector. If you don't specify this option, Google will include all languages that are supported by the API.
|
|
12
12
|
* Supported languages: https://cloud.google.com/translate/docs/languages
|
|
13
13
|
*/
|
|
14
|
-
includedLanguages
|
|
14
|
+
includedLanguages?: string | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* This option specifies the layout of the language selector. The default value is "horizontal", which displays the language names in a row. Other options include "vertical" (displays the language names in a column) and "dropdown" (displays the language names in a dropdown menu).
|
|
17
17
|
*/
|
|
@@ -31,7 +31,7 @@ declare const __propDef: {
|
|
|
31
31
|
/**
|
|
32
32
|
* This option specifies the Google Analytics tracking ID to use if gaTrack is set to true.
|
|
33
33
|
*/
|
|
34
|
-
gaId?:
|
|
34
|
+
gaId?: string | undefined;
|
|
35
35
|
/**
|
|
36
36
|
* This option specifies whether to use a compact layout for the language selector. The default value is false.
|
|
37
37
|
*/
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-2030 The Svelte Google Translate Picker Authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1,75 @@
|
|
|
1
1
|
# Svelte Google Translate
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm i @candidosales/svelte-google-translate
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
### Usage
|
|
12
|
+
|
|
13
|
+
```svelte
|
|
14
|
+
<script>
|
|
15
|
+
import GoogleTranslate from '$lib/GoogleTranslate.svelte';
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<h1>Svelte Google Translate</h1>
|
|
19
|
+
<GoogleTranslate
|
|
20
|
+
elementId={'google-translate-element'}
|
|
21
|
+
options={{ pageLanguage: 'pt', includedLanguages: 'pt,en' }}
|
|
22
|
+
/>
|
|
23
|
+
<div id="google-translate-element">
|
|
24
|
+
<p>Test</p>
|
|
25
|
+
</div>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
| Attributes | Default value | Description |
|
|
29
|
+
| ---------- | :--------------------------: | ------------------------------------------------------------------------------------------- |
|
|
30
|
+
| elementId | `'google-translate-element'` | This option specifies the HTML element ID. The default value is `google-translate-element`. |
|
|
31
|
+
| option | | This option specifies all config that TranslateElementOptions provides. |
|
|
32
|
+
|
|
33
|
+
### Options
|
|
34
|
+
|
|
35
|
+
| Option | Default value | Description |
|
|
36
|
+
| ----------------- | :-------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
37
|
+
| pageLanguage | `'pt'` | This option specifies the language of the page that you want to translate. The default value is "auto", which means that Google will detect the language automatically. |
|
|
38
|
+
| includedLanguages | `'pt,en,es,fr,nl,ja,zh-CN'` | This option is an array of language codes that you want to include in the language selector. If you don't specify this option, Google will include all languages that are supported by the API. Supported languages: https://cloud.google.com/translate/docs/languages. |
|
|
39
|
+
| layout | `true` | This option specifies the layout of the language selector. The default value is "horizontal", which displays the language names in a row. Other options include "vertical" (displays the language names in a column) and "dropdown" (displays the language names in a dropdown menu). |
|
|
40
|
+
| autoDisplay | `true` | This option specifies whether or not to display the language selector automatically. The default value is true. |
|
|
41
|
+
| multilanguagePage | `false` | This option specifies whether or not the page being translated contains multiple languages. The default value is false. |
|
|
42
|
+
| gaTrack | `false` | This option specifies whether or not to track translation events using Google Analytics. The default value is false. |
|
|
43
|
+
| gaId | `` | This option specifies the Google Analytics tracking ID to use if gaTrack is set to true. |
|
|
44
|
+
| layoutCompact | `false` | This option specifies whether to use a compact layout for the language selector. The default value is false. |
|
|
45
|
+
| floatPosition | `TOP_LEFT` | This option specifies the position of the language selector if layoutCompact is set to true. The default value is "TOP_LEFT", other options include "TOP_RIGHT", "BOTTOM_LEFT", and "BOTTOM_RIGHT". |
|
|
46
|
+
| timeout | `5000` | This option specifies the time in milliseconds before the API returns an error if it fails to load. The default value is 5000. |
|
|
47
|
+
| newVersion | `false` | This option specifies whether to use the new version of the Google Translate API. The default value is false. |
|
|
48
|
+
| attribution | `true` | This option specifies whether to display the "Powered by Google Translate" attribution. The default value is true. |
|
|
49
|
+
|
|
50
|
+
## 👍 Contribute
|
|
51
|
+
|
|
52
|
+
If you want to say thank you and/or support the active development this project:
|
|
53
|
+
|
|
54
|
+
1. Add a [GitHub Star](https://github.com/candidosales/svelte-google-translate/stargazers) to the project.
|
|
55
|
+
2. Tweet about the project [on your Twitter](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fcandidosales%2Fsvelte-google-translate).
|
|
56
|
+
3. Write a review or tutorial on [Medium](https://medium.com/), [Dev.to](https://dev.to/) or personal blog.
|
|
57
|
+
4. Support the project by donating a [cup of coffee](https://buymeacoff.ee/candidosales).
|
|
58
|
+
|
|
59
|
+
## ☕ Supporters
|
|
60
|
+
|
|
61
|
+
If you want to support Svelte Google Translate, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/candidosales)
|
|
62
|
+
|
|
63
|
+
## Author
|
|
64
|
+
|
|
65
|
+
- Cândido Sales - [@candidosales](https://twitter.com/candidosales)
|
|
66
|
+
|
|
67
|
+
## ⚠️ Copyright and license
|
|
68
|
+
|
|
69
|
+
Code and documentation copyright 2020-2030 the [Authors](https://github.com/candidosales/svelte-google-translate/graphs/contributors) and Code released under the [MIT License](https://github.com/candidosales/svelte-google-translate/blob/master/LICENSE). Docs released under [Creative Commons](https://creativecommons.org/licenses/by/3.0/).
|
|
70
|
+
|
|
71
|
+
## Test Locally
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm run dev
|
|
75
|
+
```
|
package/package.json
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@candidosales/svelte-google-translate",
|
|
3
3
|
"description": "Google Translate component for Svelte",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "candidosg@gmail.com",
|
|
7
7
|
"name": "Cândido Sales Gomes"
|
|
8
8
|
},
|
|
9
9
|
"main": "index.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
"./package.json": "./package.json",
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./package/index.d.ts",
|
|
14
|
+
"svelte": "./package/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./GoogleTranslate.svelte": "./GoogleTranslate.svelte"
|
|
17
|
+
},
|
|
10
18
|
"keywords": [
|
|
11
19
|
"svelte",
|
|
12
20
|
"sveltekit",
|
|
@@ -36,10 +44,5 @@
|
|
|
36
44
|
"bugs": {
|
|
37
45
|
"url": "https://github.com/candidosales/svelte-google-translate/issues"
|
|
38
46
|
},
|
|
39
|
-
"
|
|
40
|
-
"./package.json": "./package.json",
|
|
41
|
-
"./GoogleTranslate.svelte": "./GoogleTranslate.svelte",
|
|
42
|
-
".": "./index.js"
|
|
43
|
-
},
|
|
44
|
-
"svelte": "./index.js"
|
|
47
|
+
"license": "MIT"
|
|
45
48
|
}
|