@nice2dev/i18n 1.1.9 → 1.2.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.
Files changed (98) hide show
  1. package/README.md +74 -35
  2. package/dist/all.cjs +1 -0
  3. package/dist/all.d.ts +136 -0
  4. package/dist/all.mjs +25 -0
  5. package/dist/calendar-systems.cjs +1 -0
  6. package/dist/calendar-systems.mjs +412 -0
  7. package/dist/dictionaries/ar.cjs +1 -0
  8. package/dist/dictionaries/ar.mjs +375 -0
  9. package/dist/dictionaries/bg.cjs +1 -0
  10. package/dist/dictionaries/bg.mjs +67 -0
  11. package/dist/dictionaries/bn.cjs +1 -0
  12. package/dist/dictionaries/bn.mjs +23 -0
  13. package/dist/dictionaries/cs.cjs +1 -0
  14. package/dist/dictionaries/cs.mjs +375 -0
  15. package/dist/dictionaries/da.cjs +1 -0
  16. package/dist/dictionaries/da.mjs +75 -0
  17. package/dist/dictionaries/de.cjs +1 -0
  18. package/dist/dictionaries/de.mjs +4405 -0
  19. package/dist/dictionaries/en.cjs +1 -0
  20. package/dist/dictionaries/en.mjs +4450 -0
  21. package/dist/dictionaries/es.cjs +1 -0
  22. package/dist/dictionaries/es.mjs +4403 -0
  23. package/dist/dictionaries/fi.cjs +1 -0
  24. package/dist/dictionaries/fi.mjs +75 -0
  25. package/dist/dictionaries/fil.cjs +1 -0
  26. package/dist/dictionaries/fil.mjs +19 -0
  27. package/dist/dictionaries/fr.cjs +1 -0
  28. package/dist/dictionaries/fr.mjs +4405 -0
  29. package/dist/dictionaries/hi.cjs +1 -0
  30. package/dist/dictionaries/hi.mjs +23 -0
  31. package/dist/dictionaries/hu.cjs +1 -0
  32. package/dist/dictionaries/hu.mjs +75 -0
  33. package/dist/dictionaries/id.cjs +1 -0
  34. package/dist/dictionaries/id.mjs +23 -0
  35. package/dist/dictionaries/index.cjs +1 -0
  36. package/dist/dictionaries/index.mjs +95 -0
  37. package/dist/dictionaries/it.cjs +1 -0
  38. package/dist/dictionaries/it.mjs +297 -0
  39. package/dist/dictionaries/ja.cjs +1 -0
  40. package/dist/dictionaries/ja.mjs +375 -0
  41. package/dist/dictionaries/ko.cjs +1 -0
  42. package/dist/dictionaries/ko.mjs +375 -0
  43. package/dist/dictionaries/ms.cjs +1 -0
  44. package/dist/dictionaries/ms.mjs +23 -0
  45. package/dist/dictionaries/nl.cjs +1 -0
  46. package/dist/dictionaries/nl.mjs +97 -0
  47. package/dist/dictionaries/no.cjs +1 -0
  48. package/dist/dictionaries/no.mjs +75 -0
  49. package/dist/dictionaries/pl.cjs +1 -0
  50. package/dist/dictionaries/pl.mjs +4411 -0
  51. package/dist/dictionaries/pt.cjs +1 -0
  52. package/dist/dictionaries/pt.mjs +375 -0
  53. package/dist/dictionaries/ro.cjs +1 -0
  54. package/dist/dictionaries/ro.mjs +67 -0
  55. package/dist/dictionaries/sk.cjs +1 -0
  56. package/dist/dictionaries/sk.mjs +75 -0
  57. package/dist/dictionaries/sv.cjs +1 -0
  58. package/dist/dictionaries/sv.mjs +82 -0
  59. package/dist/dictionaries/sw.cjs +1 -0
  60. package/dist/dictionaries/sw.mjs +23 -0
  61. package/dist/dictionaries/th.cjs +1 -0
  62. package/dist/dictionaries/th.mjs +23 -0
  63. package/dist/dictionaries/uk.cjs +1 -0
  64. package/dist/dictionaries/uk.mjs +4403 -0
  65. package/dist/dictionaries/vi.cjs +1 -0
  66. package/dist/dictionaries/vi.mjs +23 -0
  67. package/dist/dictionaries/zh.cjs +1 -0
  68. package/dist/dictionaries/zh.mjs +375 -0
  69. package/dist/dynamic-loading.cjs +1 -0
  70. package/dist/dynamic-loading.mjs +274 -0
  71. package/dist/i18n.cjs +1 -0
  72. package/dist/i18n.mjs +16 -0
  73. package/dist/i18nContext.cjs +1 -0
  74. package/dist/i18nContext.mjs +11 -0
  75. package/dist/i18nDictionaries.cjs +1 -0
  76. package/dist/i18nDictionaries.mjs +61 -0
  77. package/dist/icu.cjs +1 -0
  78. package/dist/icu.mjs +242 -0
  79. package/dist/index.cjs +1 -24
  80. package/dist/index.d.ts +67 -121
  81. package/dist/index.mjs +109 -25811
  82. package/dist/languages.cjs +1 -0
  83. package/dist/languages.mjs +56 -0
  84. package/dist/lazyDictionaries.cjs +1 -0
  85. package/dist/lazyDictionaries.mjs +96 -0
  86. package/dist/locale.cjs +1 -0
  87. package/dist/locale.mjs +94 -0
  88. package/dist/pseudo-localization.cjs +1 -0
  89. package/dist/pseudo-localization.mjs +272 -0
  90. package/dist/rtl.cjs +1 -0
  91. package/dist/rtl.mjs +155 -0
  92. package/dist/timezone.cjs +1 -0
  93. package/dist/timezone.mjs +195 -0
  94. package/dist/translate-pipeline.cjs +24 -0
  95. package/dist/translate-pipeline.mjs +79 -0
  96. package/dist/translationMemory.cjs +1 -0
  97. package/dist/translationMemory.mjs +207 -0
  98. package/package.json +6 -1
package/dist/rtl.mjs ADDED
@@ -0,0 +1,155 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { useEffect as c, useMemo as g, useContext as s, createContext as p } from "react";
3
+ const b = [
4
+ "ar",
5
+ // Arabic
6
+ "he",
7
+ // Hebrew
8
+ "fa",
9
+ // Persian/Farsi
10
+ "ur",
11
+ // Urdu
12
+ "yi",
13
+ // Yiddish
14
+ "ps"
15
+ // Pashto
16
+ ];
17
+ function f(t) {
18
+ return b.includes(t);
19
+ }
20
+ function h(t) {
21
+ return f(t) ? "rtl" : "ltr";
22
+ }
23
+ function m(t) {
24
+ if (typeof document > "u")
25
+ return;
26
+ const e = h(t);
27
+ document.documentElement.setAttribute("dir", e), document.documentElement.setAttribute("lang", t);
28
+ }
29
+ function S() {
30
+ return typeof document > "u" ? "ltr" : document.documentElement.getAttribute("dir") || "ltr";
31
+ }
32
+ function x(t, e) {
33
+ return e ? t.rtl : t.ltr;
34
+ }
35
+ function A(t) {
36
+ return t === "left" ? "right" : "left";
37
+ }
38
+ function L(t, e) {
39
+ return e && {
40
+ left: "right",
41
+ right: "left",
42
+ start: "end",
43
+ end: "start",
44
+ "flex-start": "flex-end",
45
+ "flex-end": "flex-start"
46
+ }[t] || t;
47
+ }
48
+ function R(t) {
49
+ return {
50
+ // Margins
51
+ "margin-left": "margin-inline-start",
52
+ "margin-right": "margin-inline-end",
53
+ // Padding
54
+ "padding-left": "padding-inline-start",
55
+ "padding-right": "padding-inline-end",
56
+ // Position
57
+ left: "inset-inline-start",
58
+ right: "inset-inline-end",
59
+ // Border
60
+ "border-left": "border-inline-start",
61
+ "border-right": "border-inline-end",
62
+ "border-left-width": "border-inline-start-width",
63
+ "border-right-width": "border-inline-end-width",
64
+ "border-left-color": "border-inline-start-color",
65
+ "border-right-color": "border-inline-end-color",
66
+ "border-left-style": "border-inline-start-style",
67
+ "border-right-style": "border-inline-end-style",
68
+ // Border radius
69
+ "border-top-left-radius": "border-start-start-radius",
70
+ "border-top-right-radius": "border-start-end-radius",
71
+ "border-bottom-left-radius": "border-end-start-radius",
72
+ "border-bottom-right-radius": "border-end-end-radius",
73
+ // Text
74
+ "text-align: left": "text-align: start",
75
+ "text-align: right": "text-align: end"
76
+ }[t] || t;
77
+ }
78
+ const d = p({
79
+ dir: "ltr",
80
+ isRTL: !1,
81
+ flip: (t) => t,
82
+ value: (t) => t.ltr
83
+ }), E = ({
84
+ lang: t,
85
+ autoSetDocument: e = !0,
86
+ children: n
87
+ }) => {
88
+ const r = f(t), i = r ? "rtl" : "ltr";
89
+ c(() => {
90
+ e && m(t);
91
+ }, [t, e]);
92
+ const u = g(
93
+ () => ({
94
+ dir: i,
95
+ isRTL: r,
96
+ flip: (o) => L(o, r),
97
+ value: (o) => x(o, r)
98
+ }),
99
+ [i, r]
100
+ );
101
+ return /* @__PURE__ */ a(d.Provider, { value: u, children: n });
102
+ };
103
+ function v() {
104
+ return s(d);
105
+ }
106
+ function C() {
107
+ return s(d).isRTL;
108
+ }
109
+ function w(t) {
110
+ const e = [], n = [
111
+ "left",
112
+ "right",
113
+ "margin-left",
114
+ "margin-right",
115
+ "padding-left",
116
+ "padding-right",
117
+ "border-left",
118
+ "border-right"
119
+ ];
120
+ for (const [r, i] of Object.entries(t))
121
+ n.includes(r) && e.push(`Use logical property instead of '${r}' → '${R(r)}'`), r === "text-align" && (i === "left" || i === "right") && e.push(`Use 'text-align: start/end' instead of 'text-align: ${i}'`), r === "float" && (i === "left" || i === "right") && e.push(`Use flexbox or grid instead of 'float: ${i}' for RTL support`);
122
+ return e;
123
+ }
124
+ const l = {
125
+ // Direction multiplier: 1 for LTR, -1 for RTL
126
+ dirMultiplier: "--nice-dir-multiplier",
127
+ // Inline start (left in LTR, right in RTL)
128
+ inlineStart: "--nice-inline-start",
129
+ // Inline end (right in LTR, left in RTL)
130
+ inlineEnd: "--nice-inline-end"
131
+ };
132
+ function D(t) {
133
+ return {
134
+ [l.dirMultiplier]: t ? "-1" : "1",
135
+ [l.inlineStart]: t ? "right" : "left",
136
+ [l.inlineEnd]: t ? "left" : "right"
137
+ };
138
+ }
139
+ export {
140
+ E as RTLProvider,
141
+ l as RTL_CSS_VARS,
142
+ b as RTL_LANGUAGES,
143
+ w as analyzeStylesForRTL,
144
+ L as flipAlignment,
145
+ A as flipHorizontal,
146
+ S as getDocumentDirection,
147
+ R as getLogicalProperty,
148
+ D as getRTLCSSVars,
149
+ h as getTextDirection,
150
+ f as isRTLLanguage,
151
+ x as rtlValue,
152
+ m as setDocumentDirection,
153
+ C as useIsRTL,
154
+ v as useRTL
155
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("./locale.cjs"),d=require("react"),w={UTC:["UTC","Etc/UTC","Etc/GMT"],NorthAmerica:["America/New_York","America/Chicago","America/Denver","America/Los_Angeles","America/Toronto","America/Vancouver","America/Mexico_City"],SouthAmerica:["America/Sao_Paulo","America/Buenos_Aires","America/Lima","America/Bogota","America/Santiago"],Europe:["Europe/London","Europe/Paris","Europe/Berlin","Europe/Rome","Europe/Madrid","Europe/Amsterdam","Europe/Warsaw","Europe/Moscow","Europe/Kiev","Europe/Stockholm","Europe/Prague","Europe/Budapest","Europe/Bucharest"],Asia:["Asia/Tokyo","Asia/Shanghai","Asia/Hong_Kong","Asia/Singapore","Asia/Seoul","Asia/Kolkata","Asia/Dubai","Asia/Riyadh","Asia/Tehran","Asia/Bangkok","Asia/Jakarta"],Africa:["Africa/Cairo","Africa/Lagos","Africa/Johannesburg","Africa/Nairobi","Africa/Casablanca"],Oceania:["Australia/Sydney","Australia/Melbourne","Australia/Perth","Pacific/Auckland","Pacific/Fiji"]};function T(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"UTC"}}function P(e){try{return new Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}}function m(e,o="en",t=new Date){var b,E;const n=O.getLocaleTag(o),a=new Intl.DateTimeFormat(n,{timeZone:e,timeZoneName:"long"}),r=new Intl.DateTimeFormat(n,{timeZone:e,timeZoneName:"short"}),i=a.formatToParts(t),s=r.formatToParts(t),l=((b=i.find(S=>S.type==="timeZoneName"))==null?void 0:b.value)||e,g=((E=s.find(S=>S.type==="timeZoneName"))==null?void 0:E.value)||e,c=new Date(t.toLocaleString("en-US",{timeZone:"UTC"})),A=new Date(t.toLocaleString("en-US",{timeZone:e})),u=Math.round((A.getTime()-c.getTime())/6e4),D=new Date(t.getFullYear(),0,1),M=new Date(t.getFullYear(),6,1),Z=h(e,D),U=h(e,M),v=h(e,t),N=Math.min(Z,U),z=v!==N&&Z!==U;return{id:e,displayName:l,shortName:g,offsetMinutes:u,offsetString:_(u),isDST:z}}function I(e="en",o=new Date){return Object.values(w).flat().map(n=>m(n,e,o))}function L(e="en",o=new Date){const t={};for(const[n,a]of Object.entries(w))t[n]=a.map(r=>m(r,e,o));return t}function p(e,o,t){const n=e.toLocaleString("en-US",{timeZone:o}),a=new Date(n),r=e.toLocaleString("en-US",{timeZone:t}),i=new Date(r),s=a.getTime()-i.getTime();return new Date(e.getTime()+s)}function F(e,o){const t=o||T();return p(e,t,"UTC")}function y(e,o){const t=o||T();return p(e,"UTC",t)}function C(e,o,t={}){const n=O.getLocaleTag(e),{dateStyle:a="medium",timeStyle:r="short",nameStyle:i="short"}=t,s=new Intl.DateTimeFormat(n,{timeZone:o,dateStyle:a,timeStyle:r}),l=new Intl.DateTimeFormat(n,{timeZone:o,dateStyle:a,timeStyle:r,timeZoneName:i}),g=new Intl.DateTimeFormat(n,{timeZone:o,timeZoneName:"short"});return{format:c=>s.format(c),formatWithZone:c=>l.format(c),getOffset:c=>m(o,e,c).offsetString,getAbbreviation:c=>{var u;return((u=g.formatToParts(c).find(D=>D.type==="timeZoneName"))==null?void 0:u.value)||""}}}function f(e,o=new Date){return m(e,"en",o).isDST}function k(e,o=new Date){const t=f(e,o),n=new Date(o),a=new Date(o);for(a.setFullYear(a.getFullYear()+1);n<a;)if(n.setDate(n.getDate()+1),f(e,n)!==t){n.setDate(n.getDate()-1);const r=new Date(n);r.setHours(0,0,0,0);const i=new Date(n);for(i.setDate(i.getDate()+2);i.getTime()-r.getTime()>6e4;){const s=new Date((r.getTime()+i.getTime())/2);f(e,s)===t?r.setTime(s.getTime()):i.setTime(s.getTime())}return i}return null}function j(e,o,t){const[n]=d.useState(()=>T()),a=o||n,r=d.useMemo(()=>C(e,a,t),[e,a,t]),i=d.useMemo(()=>m(a,e),[a,e]);return{timezone:a,info:i,format:r.format,formatWithZone:r.formatWithZone,getOffset:r.getOffset,getAbbreviation:r.getAbbreviation,toUTC:s=>F(s,a),fromUTC:s=>y(s,a)}}function h(e,o){const t=o.toLocaleString("en-US",{timeZone:"UTC"}),n=o.toLocaleString("en-US",{timeZone:e}),a=new Date(t),r=new Date(n);return Math.round((r.getTime()-a.getTime())/6e4)}function _(e){const o=e>=0?"+":"-",t=Math.abs(e),n=Math.floor(t/60),a=t%60;return`${o}${n.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}exports.TIMEZONE_GROUPS=w;exports.convertTimezone=p;exports.createTimezoneFormatter=C;exports.detectTimezone=T;exports.fromUTC=y;exports.getAllTimezones=I;exports.getNextDSTTransition=k;exports.getTimezoneInfo=m;exports.getTimezonesGrouped=L;exports.isDSTActive=f;exports.isValidTimezone=P;exports.toUTC=F;exports.useTimezone=j;
@@ -0,0 +1,195 @@
1
+ import { getLocaleTag as b } from "./locale.mjs";
2
+ import { useState as v, useMemo as U } from "react";
3
+ const E = {
4
+ UTC: ["UTC", "Etc/UTC", "Etc/GMT"],
5
+ NorthAmerica: [
6
+ "America/New_York",
7
+ "America/Chicago",
8
+ "America/Denver",
9
+ "America/Los_Angeles",
10
+ "America/Toronto",
11
+ "America/Vancouver",
12
+ "America/Mexico_City"
13
+ ],
14
+ SouthAmerica: [
15
+ "America/Sao_Paulo",
16
+ "America/Buenos_Aires",
17
+ "America/Lima",
18
+ "America/Bogota",
19
+ "America/Santiago"
20
+ ],
21
+ Europe: [
22
+ "Europe/London",
23
+ "Europe/Paris",
24
+ "Europe/Berlin",
25
+ "Europe/Rome",
26
+ "Europe/Madrid",
27
+ "Europe/Amsterdam",
28
+ "Europe/Warsaw",
29
+ "Europe/Moscow",
30
+ "Europe/Kiev",
31
+ "Europe/Stockholm",
32
+ "Europe/Prague",
33
+ "Europe/Budapest",
34
+ "Europe/Bucharest"
35
+ ],
36
+ Asia: [
37
+ "Asia/Tokyo",
38
+ "Asia/Shanghai",
39
+ "Asia/Hong_Kong",
40
+ "Asia/Singapore",
41
+ "Asia/Seoul",
42
+ "Asia/Kolkata",
43
+ "Asia/Dubai",
44
+ "Asia/Riyadh",
45
+ "Asia/Tehran",
46
+ "Asia/Bangkok",
47
+ "Asia/Jakarta"
48
+ ],
49
+ Africa: [
50
+ "Africa/Cairo",
51
+ "Africa/Lagos",
52
+ "Africa/Johannesburg",
53
+ "Africa/Nairobi",
54
+ "Africa/Casablanca"
55
+ ],
56
+ Oceania: [
57
+ "Australia/Sydney",
58
+ "Australia/Melbourne",
59
+ "Australia/Perth",
60
+ "Pacific/Auckland",
61
+ "Pacific/Fiji"
62
+ ]
63
+ };
64
+ function h() {
65
+ try {
66
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
67
+ } catch {
68
+ return "UTC";
69
+ }
70
+ }
71
+ function z(t) {
72
+ try {
73
+ return new Intl.DateTimeFormat("en", { timeZone: t }), !0;
74
+ } catch {
75
+ return !1;
76
+ }
77
+ }
78
+ function u(t, o = "en", e = /* @__PURE__ */ new Date()) {
79
+ var d, Z;
80
+ const n = b(o), a = new Intl.DateTimeFormat(n, {
81
+ timeZone: t,
82
+ timeZoneName: "long"
83
+ }), r = new Intl.DateTimeFormat(n, {
84
+ timeZone: t,
85
+ timeZoneName: "short"
86
+ }), i = a.formatToParts(e), s = r.formatToParts(e), f = ((d = i.find((A) => A.type === "timeZoneName")) == null ? void 0 : d.value) || t, l = ((Z = s.find((A) => A.type === "timeZoneName")) == null ? void 0 : Z.value) || t, c = new Date(e.toLocaleString("en-US", { timeZone: "UTC" })), T = new Date(e.toLocaleString("en-US", { timeZone: t })), m = Math.round((T.getTime() - c.getTime()) / 6e4), g = new Date(e.getFullYear(), 0, 1), O = new Date(e.getFullYear(), 6, 1), p = S(t, g), w = S(t, O), y = S(t, e), C = Math.min(p, w), M = y !== C && p !== w;
87
+ return {
88
+ id: t,
89
+ displayName: f,
90
+ shortName: l,
91
+ offsetMinutes: m,
92
+ offsetString: I(m),
93
+ isDST: M
94
+ };
95
+ }
96
+ function _(t = "en", o = /* @__PURE__ */ new Date()) {
97
+ return Object.values(E).flat().map((n) => u(n, t, o));
98
+ }
99
+ function B(t = "en", o = /* @__PURE__ */ new Date()) {
100
+ const e = {};
101
+ for (const [n, a] of Object.entries(E))
102
+ e[n] = a.map((r) => u(r, t, o));
103
+ return e;
104
+ }
105
+ function F(t, o, e) {
106
+ const n = t.toLocaleString("en-US", { timeZone: o }), a = new Date(n), r = t.toLocaleString("en-US", { timeZone: e }), i = new Date(r), s = a.getTime() - i.getTime();
107
+ return new Date(t.getTime() + s);
108
+ }
109
+ function N(t, o) {
110
+ const e = o || h();
111
+ return F(t, e, "UTC");
112
+ }
113
+ function P(t, o) {
114
+ const e = o || h();
115
+ return F(t, "UTC", e);
116
+ }
117
+ function L(t, o, e = {}) {
118
+ const n = b(t), { dateStyle: a = "medium", timeStyle: r = "short", nameStyle: i = "short" } = e, s = new Intl.DateTimeFormat(n, {
119
+ timeZone: o,
120
+ dateStyle: a,
121
+ timeStyle: r
122
+ }), f = new Intl.DateTimeFormat(n, {
123
+ timeZone: o,
124
+ dateStyle: a,
125
+ timeStyle: r,
126
+ timeZoneName: i
127
+ }), l = new Intl.DateTimeFormat(n, {
128
+ timeZone: o,
129
+ timeZoneName: "short"
130
+ });
131
+ return {
132
+ format: (c) => s.format(c),
133
+ formatWithZone: (c) => f.format(c),
134
+ getOffset: (c) => u(o, t, c).offsetString,
135
+ getAbbreviation: (c) => {
136
+ var m;
137
+ return ((m = l.formatToParts(c).find((g) => g.type === "timeZoneName")) == null ? void 0 : m.value) || "";
138
+ }
139
+ };
140
+ }
141
+ function D(t, o = /* @__PURE__ */ new Date()) {
142
+ return u(t, "en", o).isDST;
143
+ }
144
+ function Y(t, o = /* @__PURE__ */ new Date()) {
145
+ const e = D(t, o), n = new Date(o), a = new Date(o);
146
+ for (a.setFullYear(a.getFullYear() + 1); n < a; )
147
+ if (n.setDate(n.getDate() + 1), D(t, n) !== e) {
148
+ n.setDate(n.getDate() - 1);
149
+ const r = new Date(n);
150
+ r.setHours(0, 0, 0, 0);
151
+ const i = new Date(n);
152
+ for (i.setDate(i.getDate() + 2); i.getTime() - r.getTime() > 6e4; ) {
153
+ const s = new Date((r.getTime() + i.getTime()) / 2);
154
+ D(t, s) === e ? r.setTime(s.getTime()) : i.setTime(s.getTime());
155
+ }
156
+ return i;
157
+ }
158
+ return null;
159
+ }
160
+ function W(t, o, e) {
161
+ const [n] = v(() => h()), a = o || n, r = U(() => L(t, a, e), [t, a, e]), i = U(() => u(a, t), [a, t]);
162
+ return {
163
+ timezone: a,
164
+ info: i,
165
+ format: r.format,
166
+ formatWithZone: r.formatWithZone,
167
+ getOffset: r.getOffset,
168
+ getAbbreviation: r.getAbbreviation,
169
+ toUTC: (s) => N(s, a),
170
+ fromUTC: (s) => P(s, a)
171
+ };
172
+ }
173
+ function S(t, o) {
174
+ const e = o.toLocaleString("en-US", { timeZone: "UTC" }), n = o.toLocaleString("en-US", { timeZone: t }), a = new Date(e), r = new Date(n);
175
+ return Math.round((r.getTime() - a.getTime()) / 6e4);
176
+ }
177
+ function I(t) {
178
+ const o = t >= 0 ? "+" : "-", e = Math.abs(t), n = Math.floor(e / 60), a = e % 60;
179
+ return `${o}${n.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}`;
180
+ }
181
+ export {
182
+ E as TIMEZONE_GROUPS,
183
+ F as convertTimezone,
184
+ L as createTimezoneFormatter,
185
+ h as detectTimezone,
186
+ P as fromUTC,
187
+ _ as getAllTimezones,
188
+ Y as getNextDSTTransition,
189
+ u as getTimezoneInfo,
190
+ B as getTimezonesGrouped,
191
+ D as isDSTActive,
192
+ z as isValidTimezone,
193
+ N as toUTC,
194
+ W as useTimezone
195
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./languages.cjs"),a=require("./dictionaries/index.cjs");function u(){return Object.keys(a.NICE_I18N_DICTIONARIES.en)}function o(s){if(s==="en")return[];const t=a.NICE_I18N_DICTIONARIES.en,e=a.NICE_I18N_DICTIONARIES[s],n=[];for(const[r,c]of Object.entries(t))e[r]||n.push({key:r,englishValue:c});return n}function i(s){const t=Object.keys(a.NICE_I18N_DICTIONARIES.en).length,e=Object.keys(a.NICE_I18N_DICTIONARIES[s]).length,n=t-e,r=Math.round(e/t*100);return{lang:s,totalKeys:t,translatedKeys:e,missingKeys:n,coverage:r}}function g(){return l.NICE_SUPPORTED_LANGS.map(s=>i(s))}function I(s,t){const e=t.map(n=>{const r=n.translated.replace(/'/g,"\\'");return` '${n.key}': '${r}',`});return`// Auto-translated additions for ${s} (review before merging)
2
+ // Generated on ${new Date().toISOString()}
3
+ {
4
+ ${e.join(`
5
+ `)}
6
+ }`}function f(){const s=g();let t=`# Translation Coverage Report
7
+
8
+ Generated: ${new Date().toISOString()}
9
+
10
+ ## Summary
11
+
12
+ | Language | Translated | Missing | Coverage |
13
+ |----------|------------|---------|----------|
14
+ `;for(const e of s){const n="█".repeat(Math.floor(e.coverage/10))+"░".repeat(10-Math.floor(e.coverage/10));t+=`| ${e.lang} | ${e.translatedKeys} | ${e.missingKeys} | ${n} ${e.coverage}% |
15
+ `}t+=`
16
+ ## Languages with Missing Translations
17
+
18
+ `;for(const e of s.filter(n=>n.missingKeys>0)){t+=`### ${e.lang.toUpperCase()} (${e.coverage}% complete)
19
+
20
+ `;const n=o(e.lang);t+=`Missing ${n.length} keys:
21
+
22
+ `,t+="```\n",t+=n.slice(0,10).map(r=>r.key).join(`
23
+ `),n.length>10&&(t+=`
24
+ ... and ${n.length-10} more`),t+="\n```\n\n"}return t}exports.generateCoverageReport=f;exports.generateTranslationCode=I;exports.getAllTranslationStats=g;exports.getMissingTranslations=o;exports.getSourceKeys=u;exports.getTranslationStats=i;
@@ -0,0 +1,79 @@
1
+ import { NICE_SUPPORTED_LANGS as i } from "./languages.mjs";
2
+ import { NICE_I18N_DICTIONARIES as o } from "./dictionaries/index.mjs";
3
+ function m() {
4
+ return Object.keys(o.en);
5
+ }
6
+ function g(s) {
7
+ if (s === "en")
8
+ return [];
9
+ const t = o.en, e = o[s], n = [];
10
+ for (const [r, a] of Object.entries(t))
11
+ e[r] || n.push({ key: r, englishValue: a });
12
+ return n;
13
+ }
14
+ function c(s) {
15
+ const t = Object.keys(o.en).length, e = Object.keys(o[s]).length, n = t - e, r = Math.round(e / t * 100);
16
+ return {
17
+ lang: s,
18
+ totalKeys: t,
19
+ translatedKeys: e,
20
+ missingKeys: n,
21
+ coverage: r
22
+ };
23
+ }
24
+ function l() {
25
+ return i.map((s) => c(s));
26
+ }
27
+ function p(s, t) {
28
+ const e = t.map((n) => {
29
+ const r = n.translated.replace(/'/g, "\\'");
30
+ return ` '${n.key}': '${r}',`;
31
+ });
32
+ return `// Auto-translated additions for ${s} (review before merging)
33
+ // Generated on ${(/* @__PURE__ */ new Date()).toISOString()}
34
+ {
35
+ ${e.join(`
36
+ `)}
37
+ }`;
38
+ }
39
+ function y() {
40
+ const s = l();
41
+ let t = `# Translation Coverage Report
42
+
43
+ Generated: ${(/* @__PURE__ */ new Date()).toISOString()}
44
+
45
+ ## Summary
46
+
47
+ | Language | Translated | Missing | Coverage |
48
+ |----------|------------|---------|----------|
49
+ `;
50
+ for (const e of s) {
51
+ const n = "█".repeat(Math.floor(e.coverage / 10)) + "░".repeat(10 - Math.floor(e.coverage / 10));
52
+ t += `| ${e.lang} | ${e.translatedKeys} | ${e.missingKeys} | ${n} ${e.coverage}% |
53
+ `;
54
+ }
55
+ t += `
56
+ ## Languages with Missing Translations
57
+
58
+ `;
59
+ for (const e of s.filter((n) => n.missingKeys > 0)) {
60
+ t += `### ${e.lang.toUpperCase()} (${e.coverage}% complete)
61
+
62
+ `;
63
+ const n = g(e.lang);
64
+ t += `Missing ${n.length} keys:
65
+
66
+ `, t += "```\n", t += n.slice(0, 10).map((r) => r.key).join(`
67
+ `), n.length > 10 && (t += `
68
+ ... and ${n.length - 10} more`), t += "\n```\n\n";
69
+ }
70
+ return t;
71
+ }
72
+ export {
73
+ y as generateCoverageReport,
74
+ p as generateTranslationCode,
75
+ l as getAllTranslationStats,
76
+ g as getMissingTranslations,
77
+ m as getSourceKeys,
78
+ c as getTranslationStats
79
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./dictionaries/index.cjs"),u=[{en:"Save",translations:{pl:"Zapisz",de:"Speichern",fr:"Enregistrer",es:"Guardar",uk:"Зберегти",cs:"Uložit",ja:"保存",ko:"저장",zh:"保存",ar:"حفظ"}},{en:"Cancel",translations:{pl:"Anuluj",de:"Abbrechen",fr:"Annuler",es:"Cancelar",uk:"Скасувати",cs:"Zrušit",ja:"キャンセル",ko:"취소",zh:"取消",ar:"إلغاء"}},{en:"Delete",translations:{pl:"Usuń",de:"Löschen",fr:"Supprimer",es:"Eliminar",uk:"Видалити",cs:"Smazat",ja:"削除",ko:"삭제",zh:"删除",ar:"حذف"}},{en:"Edit",translations:{pl:"Edytuj",de:"Bearbeiten",fr:"Modifier",es:"Editar",uk:"Редагувати",cs:"Upravit",ja:"編集",ko:"편집",zh:"编辑",ar:"تعديل"}},{en:"Add",translations:{pl:"Dodaj",de:"Hinzufügen",fr:"Ajouter",es:"Añadir",uk:"Додати",cs:"Přidat",ja:"追加",ko:"추가",zh:"添加",ar:"إضافة"}},{en:"Search",translations:{pl:"Szukaj",de:"Suchen",fr:"Rechercher",es:"Buscar",uk:"Шукати",cs:"Hledat",ja:"検索",ko:"검색",zh:"搜索",ar:"بحث"}},{en:"Settings",translations:{pl:"Ustawienia",de:"Einstellungen",fr:"Paramètres",es:"Configuración",uk:"Налаштування",cs:"Nastavení",ja:"設定",ko:"설정",zh:"设置",ar:"إعدادات"}},{en:"Loading",translations:{pl:"Ładowanie",de:"Laden",fr:"Chargement",es:"Cargando",uk:"Завантаження",cs:"Načítání",ja:"読み込み中",ko:"로딩 중",zh:"加载中",ar:"جاري التحميل"}},{en:"Error",translations:{pl:"Błąd",de:"Fehler",fr:"Erreur",es:"Error",uk:"Помилка",cs:"Chyba",ja:"エラー",ko:"오류",zh:"错误",ar:"خطأ"}},{en:"Success",translations:{pl:"Sukces",de:"Erfolg",fr:"Succès",es:"Éxito",uk:"Успіх",cs:"Úspěch",ja:"成功",ko:"성공",zh:"成功",ar:"نجاح"}}];function h(e,n){const t=u.find(r=>r.en.toLowerCase()===e.toLowerCase());return t==null?void 0:t.translations[n]}function k(e,n,t=.8){const r=l.NICE_I18N_DICTIONARIES.en,s=l.NICE_I18N_DICTIONARIES[n],o=e.toLowerCase().trim();let a;for(const[i,d]of Object.entries(r)){const f=s[i];if(!f)continue;const c=I(o,d.toLowerCase().trim());c>=t&&(!a||c>a.similarity)&&(a={key:i,english:d,translated:f,similarity:c})}return a}function S(e){return u.filter(n=>n.translations[e]!=null).map(n=>({en:n.en,translation:n.translations[e]}))}function p(e){const n=l.NICE_I18N_DICTIONARIES[e],t=l.NICE_I18N_DICTIONARIES.en,r=[];for(const[s,o]of Object.entries(t)){const a=h(o,e),i=n[s];a&&i&&i!==a&&r.push({key:s,currentTranslation:i,glossaryTranslation:a})}return r}function g(e){const n=new Set;for(let t=0;t<e.length-1;t++)n.add(e.substring(t,t+2));return n}function I(e,n){if(e===n)return 1;if(e.length<2||n.length<2)return 0;const t=g(e),r=g(n);let s=0;for(const o of t)r.has(o)&&s++;return 2*s/(t.size+r.size)}exports.NICE_GLOSSARY=u;exports.findSimilarTranslation=k;exports.getGlossaryForLanguage=S;exports.lookupGlossary=h;exports.validateAgainstGlossary=p;
@@ -0,0 +1,207 @@
1
+ import { NICE_I18N_DICTIONARIES as c } from "./dictionaries/index.mjs";
2
+ const h = [
3
+ {
4
+ en: "Save",
5
+ translations: {
6
+ pl: "Zapisz",
7
+ de: "Speichern",
8
+ fr: "Enregistrer",
9
+ es: "Guardar",
10
+ uk: "Зберегти",
11
+ cs: "Uložit",
12
+ ja: "保存",
13
+ ko: "저장",
14
+ zh: "保存",
15
+ ar: "حفظ"
16
+ }
17
+ },
18
+ {
19
+ en: "Cancel",
20
+ translations: {
21
+ pl: "Anuluj",
22
+ de: "Abbrechen",
23
+ fr: "Annuler",
24
+ es: "Cancelar",
25
+ uk: "Скасувати",
26
+ cs: "Zrušit",
27
+ ja: "キャンセル",
28
+ ko: "취소",
29
+ zh: "取消",
30
+ ar: "إلغاء"
31
+ }
32
+ },
33
+ {
34
+ en: "Delete",
35
+ translations: {
36
+ pl: "Usuń",
37
+ de: "Löschen",
38
+ fr: "Supprimer",
39
+ es: "Eliminar",
40
+ uk: "Видалити",
41
+ cs: "Smazat",
42
+ ja: "削除",
43
+ ko: "삭제",
44
+ zh: "删除",
45
+ ar: "حذف"
46
+ }
47
+ },
48
+ {
49
+ en: "Edit",
50
+ translations: {
51
+ pl: "Edytuj",
52
+ de: "Bearbeiten",
53
+ fr: "Modifier",
54
+ es: "Editar",
55
+ uk: "Редагувати",
56
+ cs: "Upravit",
57
+ ja: "編集",
58
+ ko: "편집",
59
+ zh: "编辑",
60
+ ar: "تعديل"
61
+ }
62
+ },
63
+ {
64
+ en: "Add",
65
+ translations: {
66
+ pl: "Dodaj",
67
+ de: "Hinzufügen",
68
+ fr: "Ajouter",
69
+ es: "Añadir",
70
+ uk: "Додати",
71
+ cs: "Přidat",
72
+ ja: "追加",
73
+ ko: "추가",
74
+ zh: "添加",
75
+ ar: "إضافة"
76
+ }
77
+ },
78
+ {
79
+ en: "Search",
80
+ translations: {
81
+ pl: "Szukaj",
82
+ de: "Suchen",
83
+ fr: "Rechercher",
84
+ es: "Buscar",
85
+ uk: "Шукати",
86
+ cs: "Hledat",
87
+ ja: "検索",
88
+ ko: "검색",
89
+ zh: "搜索",
90
+ ar: "بحث"
91
+ }
92
+ },
93
+ {
94
+ en: "Settings",
95
+ translations: {
96
+ pl: "Ustawienia",
97
+ de: "Einstellungen",
98
+ fr: "Paramètres",
99
+ es: "Configuración",
100
+ uk: "Налаштування",
101
+ cs: "Nastavení",
102
+ ja: "設定",
103
+ ko: "설정",
104
+ zh: "设置",
105
+ ar: "إعدادات"
106
+ }
107
+ },
108
+ {
109
+ en: "Loading",
110
+ translations: {
111
+ pl: "Ładowanie",
112
+ de: "Laden",
113
+ fr: "Chargement",
114
+ es: "Cargando",
115
+ uk: "Завантаження",
116
+ cs: "Načítání",
117
+ ja: "読み込み中",
118
+ ko: "로딩 중",
119
+ zh: "加载中",
120
+ ar: "جاري التحميل"
121
+ }
122
+ },
123
+ {
124
+ en: "Error",
125
+ translations: {
126
+ pl: "Błąd",
127
+ de: "Fehler",
128
+ fr: "Erreur",
129
+ es: "Error",
130
+ uk: "Помилка",
131
+ cs: "Chyba",
132
+ ja: "エラー",
133
+ ko: "오류",
134
+ zh: "错误",
135
+ ar: "خطأ"
136
+ }
137
+ },
138
+ {
139
+ en: "Success",
140
+ translations: {
141
+ pl: "Sukces",
142
+ de: "Erfolg",
143
+ fr: "Succès",
144
+ es: "Éxito",
145
+ uk: "Успіх",
146
+ cs: "Úspěch",
147
+ ja: "成功",
148
+ ko: "성공",
149
+ zh: "成功",
150
+ ar: "نجاح"
151
+ }
152
+ }
153
+ ];
154
+ function k(e, n) {
155
+ const t = h.find((r) => r.en.toLowerCase() === e.toLowerCase());
156
+ return t == null ? void 0 : t.translations[n];
157
+ }
158
+ function m(e, n, t = 0.8) {
159
+ const r = c.en, s = c[n], o = e.toLowerCase().trim();
160
+ let a;
161
+ for (const [i, u] of Object.entries(r)) {
162
+ const f = s[i];
163
+ if (!f)
164
+ continue;
165
+ const l = g(o, u.toLowerCase().trim());
166
+ l >= t && (!a || l > a.similarity) && (a = { key: i, english: u, translated: f, similarity: l });
167
+ }
168
+ return a;
169
+ }
170
+ function j(e) {
171
+ return h.filter((n) => n.translations[e] != null).map((n) => ({
172
+ en: n.en,
173
+ translation: n.translations[e]
174
+ }));
175
+ }
176
+ function z(e) {
177
+ const n = c[e], t = c.en, r = [];
178
+ for (const [s, o] of Object.entries(t)) {
179
+ const a = k(o, e), i = n[s];
180
+ a && i && i !== a && r.push({ key: s, currentTranslation: i, glossaryTranslation: a });
181
+ }
182
+ return r;
183
+ }
184
+ function d(e) {
185
+ const n = /* @__PURE__ */ new Set();
186
+ for (let t = 0; t < e.length - 1; t++)
187
+ n.add(e.substring(t, t + 2));
188
+ return n;
189
+ }
190
+ function g(e, n) {
191
+ if (e === n)
192
+ return 1;
193
+ if (e.length < 2 || n.length < 2)
194
+ return 0;
195
+ const t = d(e), r = d(n);
196
+ let s = 0;
197
+ for (const o of t)
198
+ r.has(o) && s++;
199
+ return 2 * s / (t.size + r.size);
200
+ }
201
+ export {
202
+ h as NICE_GLOSSARY,
203
+ m as findSimilarTranslation,
204
+ j as getGlossaryForLanguage,
205
+ k as lookupGlossary,
206
+ z as validateAgainstGlossary
207
+ };