easy-language-change 0.1.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/README.md +96 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# easy-language-change
|
|
2
|
+
|
|
3
|
+
**Professional, lightweight, multi-language support for websites**
|
|
4
|
+
Includes Tailwind CSS ready **modals** and optional **toasts**.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- ✅ Global multi-language switching
|
|
11
|
+
- ✅ Promise-based modal API
|
|
12
|
+
- ✅ Tailwind CSS styling ready
|
|
13
|
+
- ✅ Lightweight, dependency-free
|
|
14
|
+
- ✅ Mobile responsive
|
|
15
|
+
- ✅ Framework-agnostic (React, Vue, Svelte, plain JS)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install easy-language-change
|
|
23
|
+
npm install tailwindcss
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
import { setLanguage, t, showModal, showToast } from "easy-language-change";
|
|
32
|
+
|
|
33
|
+
// Add translations
|
|
34
|
+
import { translations } from "easy-language-change";
|
|
35
|
+
|
|
36
|
+
translations.en = {
|
|
37
|
+
welcome: "Welcome!",
|
|
38
|
+
goodbye: "Goodbye",
|
|
39
|
+
confirm: "Are you sure?",
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
translations.bn = {
|
|
43
|
+
welcome: "স্বাগতম!",
|
|
44
|
+
goodbye: "বিদায়",
|
|
45
|
+
confirm: "আপনি কি নিশ্চিত?",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Switch language
|
|
49
|
+
setLanguage("bn");
|
|
50
|
+
|
|
51
|
+
// Use in modals
|
|
52
|
+
showModal({
|
|
53
|
+
titleKey: "confirm",
|
|
54
|
+
contentKey: "welcome",
|
|
55
|
+
buttonsKeys: ["ok", "cancel"],
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Use toasts
|
|
59
|
+
showToast({
|
|
60
|
+
messageKey: "welcome",
|
|
61
|
+
type: "success",
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Translate text
|
|
65
|
+
const text = t("welcome"); // 'স্বাগতম!'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## API Reference
|
|
71
|
+
|
|
72
|
+
### `setLanguage(lang)`
|
|
73
|
+
|
|
74
|
+
Switch the current language.
|
|
75
|
+
|
|
76
|
+
### `getLanguage()`
|
|
77
|
+
|
|
78
|
+
Get the current language code.
|
|
79
|
+
|
|
80
|
+
### `t(key)`
|
|
81
|
+
|
|
82
|
+
Get translation for a key.
|
|
83
|
+
|
|
84
|
+
### `showModal(options)`
|
|
85
|
+
|
|
86
|
+
Show a promise-based modal.
|
|
87
|
+
|
|
88
|
+
### `showToast(options)`
|
|
89
|
+
|
|
90
|
+
Show a toast notification.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT | Ahteshamul Hasan
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "easy-language-change",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Professional, lightweight, multi-language support for websites with Tailwind CSS ready modals and toasts.",
|
|
6
|
+
"main": "dist/easy-language-change.cjs.js",
|
|
7
|
+
"module": "dist/easy-language-change.esm.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"keywords": [
|
|
12
|
+
"i18n",
|
|
13
|
+
"multi-language",
|
|
14
|
+
"modal",
|
|
15
|
+
"toast",
|
|
16
|
+
"tailwind",
|
|
17
|
+
"UI",
|
|
18
|
+
"vanilla-js"
|
|
19
|
+
],
|
|
20
|
+
"author": "Hasan",
|
|
21
|
+
"license": "MIT | Ahteshamul Hasan",
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"tailwindcss": "^3.0.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"rollup": "^3.0.0",
|
|
27
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
28
|
+
"@rollup/plugin-terser": "^0.3.0"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "rollup -c"
|
|
32
|
+
}
|
|
33
|
+
}
|