@sswroom/sswr 1.6.11 → 1.6.12
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 +4 -0
- package/dummy/i18next.d.ts +183 -0
- package/dummy/i18next.js +2 -0
- package/dummy/olayer2.js +1 -1
- package/olayer2.js +1 -1
- package/package.json +1 -1
- package/web.d.ts +3 -1
- package/web.js +53 -13
package/Changelog
CHANGED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default export of the i18next module is an i18next instance ready to be initialized by calling init. You can create additional instances using the createInstance function.
|
|
3
|
+
*
|
|
4
|
+
* Please read the options page for details on configuration options.
|
|
5
|
+
*
|
|
6
|
+
* The callback will be called after all translations were loaded or with an error when failed (in case of using a backend).
|
|
7
|
+
* @param options
|
|
8
|
+
* @param callback
|
|
9
|
+
*/
|
|
10
|
+
export function init(options?: object, callback?: Function): void;
|
|
11
|
+
/**
|
|
12
|
+
* Please have a look at the translation functions like interpolation, formatting and plurals for more details on using it.
|
|
13
|
+
*
|
|
14
|
+
* You can specify either one key as a String or multiple keys as an Array of String. The first one that resolves will be returned.
|
|
15
|
+
*/
|
|
16
|
+
export function t(keys: string|string[], options?: object): string;
|
|
17
|
+
/**
|
|
18
|
+
* Uses the same resolve functionality as the t function and returns true if a key exists.
|
|
19
|
+
* @param key
|
|
20
|
+
* @param options
|
|
21
|
+
*/
|
|
22
|
+
export function exists(key: string|string[], options?: object): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Returns a t function that defaults to given language or namespace.
|
|
25
|
+
*
|
|
26
|
+
* All arguments can be optional/null.
|
|
27
|
+
*
|
|
28
|
+
* lng and ns params could be arrays of languages or namespaces and will be treated as fallbacks in that case.
|
|
29
|
+
*
|
|
30
|
+
* The optional keyPrefix will be automatically applied to the returned t function.
|
|
31
|
+
* @param lng
|
|
32
|
+
* @param ns
|
|
33
|
+
* @param keyPrefix
|
|
34
|
+
*/
|
|
35
|
+
export function getFixedT(lng?: string|string[]|null, ns?: string|string[]|null, keyPrefix?: string|string[]|null): (keys: string|string[], options?: object) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Changes the language. The callback will be called as soon translations were loaded or an error occurs while loading.
|
|
38
|
+
*
|
|
39
|
+
* Calling changeLanguage without lng uses the language detector to choose the language to set.
|
|
40
|
+
*
|
|
41
|
+
* HINT: For easy testing—setting lng to 'cimode' will cause the t function to always return the key.
|
|
42
|
+
* @param lng
|
|
43
|
+
* @param callback
|
|
44
|
+
*/
|
|
45
|
+
export function changeLanguage(lng?: string, callback?: Function): void;
|
|
46
|
+
/**
|
|
47
|
+
* Is set to the current detected or set language.
|
|
48
|
+
*
|
|
49
|
+
* If you need the primary used language depending on your configuration (supportedLngs, load) you will prefer using i18next.resolvedLanguage or i18next.languages[0].
|
|
50
|
+
*/
|
|
51
|
+
export let language: string;
|
|
52
|
+
/**
|
|
53
|
+
* Is set to an array of language codes that will be used to look up the translation value.
|
|
54
|
+
*
|
|
55
|
+
* When the language is set, this array is populated with the new language codes. Unless overridden, this array is populated with less-specific versions of that code for fallback purposes, followed by the list of fallback languages.
|
|
56
|
+
*/
|
|
57
|
+
export let languages: string[];
|
|
58
|
+
/**
|
|
59
|
+
* Is set to the current resolved language.
|
|
60
|
+
* It can be used as primary used language, for example in a language switcher.
|
|
61
|
+
* @since v21.0.0
|
|
62
|
+
*/
|
|
63
|
+
export let resolvedLanguage: string;
|
|
64
|
+
/**
|
|
65
|
+
* Checks if namespace has loaded yet. i.e. used by react-i18next
|
|
66
|
+
* @param ns
|
|
67
|
+
* @param options
|
|
68
|
+
*/
|
|
69
|
+
export function hasLoadedNamespace(ns: string, options?: object): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Loads additional namespaces not defined in init options.
|
|
72
|
+
* @param ns
|
|
73
|
+
* @param callback
|
|
74
|
+
*/
|
|
75
|
+
export function loadNamespaces(ns: string, callback?: Function): void;
|
|
76
|
+
/**
|
|
77
|
+
* Loads additional languages not defined in init options (preload).
|
|
78
|
+
* @param lngs
|
|
79
|
+
* @param callback
|
|
80
|
+
*/
|
|
81
|
+
export function loadLanguages(lngs: string|string[], callback?: Function): void;
|
|
82
|
+
/**
|
|
83
|
+
* Reloads resources on given state. Optionally you can pass an array of languages and namespaces as params if you don't want to reload all.
|
|
84
|
+
* @param lng
|
|
85
|
+
* @param ns
|
|
86
|
+
* @param callback
|
|
87
|
+
*/
|
|
88
|
+
export function reloadResources(lng?: string|string[]|null, ns?: string|string[]|null, callback?: Function): void;
|
|
89
|
+
/**
|
|
90
|
+
* Changes the default namespace.
|
|
91
|
+
* @param ns
|
|
92
|
+
*/
|
|
93
|
+
export function setDefaultNamespace(ns: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* Returns rtl or ltr depending on languages read direction.
|
|
96
|
+
* @param lng undefined for current language
|
|
97
|
+
*/
|
|
98
|
+
export function dir(lng?: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* @since v8.4.0
|
|
101
|
+
* @deprecated v21.3.0
|
|
102
|
+
* Exposes interpolation.formatt function added on init.
|
|
103
|
+
*
|
|
104
|
+
* For formatting used in translation files checkout the formatting doc.
|
|
105
|
+
* @param data
|
|
106
|
+
* @param format
|
|
107
|
+
* @param lng
|
|
108
|
+
*/
|
|
109
|
+
export function format(data: string, format: string, lng?: string): string;
|
|
110
|
+
/**
|
|
111
|
+
* Will return a new i18next instance.
|
|
112
|
+
*
|
|
113
|
+
* Please read the options page for details on configuration options.
|
|
114
|
+
*
|
|
115
|
+
* Providing a callback will automatically call init.
|
|
116
|
+
*
|
|
117
|
+
* The callback will be called after all translations were loaded or with an error when failed (in case of using a backend).
|
|
118
|
+
* @param options
|
|
119
|
+
* @param callback
|
|
120
|
+
*/
|
|
121
|
+
export function createInstance(options?: object, callback?: Function): ThisType;
|
|
122
|
+
/**
|
|
123
|
+
* Creates a clone of the current instance. Shares store, plugins and initial configuration. Can be used to create an instance sharing storage but being independent on set language or default namespaces.
|
|
124
|
+
* @param options
|
|
125
|
+
*/
|
|
126
|
+
export function cloneInstance(options?: object): ThisType;
|
|
127
|
+
export function on(name: string, callback: Function): void;
|
|
128
|
+
export function off(name: string, callback?: Function): void;
|
|
129
|
+
/**
|
|
130
|
+
* Gets one value by given key.
|
|
131
|
+
* @param lng
|
|
132
|
+
* @param ns
|
|
133
|
+
* @param key
|
|
134
|
+
* @param options
|
|
135
|
+
*/
|
|
136
|
+
export function getResource(lng: string, ns: string, key: string, options?: object): string;
|
|
137
|
+
/**
|
|
138
|
+
* Adds one key/value.
|
|
139
|
+
* @param lng
|
|
140
|
+
* @param ns
|
|
141
|
+
* @param key
|
|
142
|
+
* @param value
|
|
143
|
+
* @param options
|
|
144
|
+
*/
|
|
145
|
+
export function addResource(lng: string, ns: string, key: string, value: string, options?: object): void;
|
|
146
|
+
/**
|
|
147
|
+
* Adds multiple key/values.
|
|
148
|
+
* @param lng
|
|
149
|
+
* @param ns
|
|
150
|
+
* @param resources
|
|
151
|
+
*/
|
|
152
|
+
export function addResources(lng: string, ns: string, resources: any): void;
|
|
153
|
+
/**
|
|
154
|
+
* Adds a complete bundle.
|
|
155
|
+
*
|
|
156
|
+
* Setting deep (default false) param to true will extend existing translations in that file. Setting deep and overwrite (default false) to true it will overwrite existing translations in that file.
|
|
157
|
+
*
|
|
158
|
+
* So omitting deep and overwrite will overwrite all existing translations with the one provided in resources. Using deep you can choose to keep existing nested translation and to overwrite those with the new ones.
|
|
159
|
+
*/
|
|
160
|
+
export function addResourceBundle(lng: string, ns: string, resources: any, deep?: boolean, overwrite?: boolean): void;
|
|
161
|
+
/**
|
|
162
|
+
* Checks if a resource bundle exists.
|
|
163
|
+
* @param lng
|
|
164
|
+
* @param ns
|
|
165
|
+
*/
|
|
166
|
+
export function hasResourceBundle(lng: string, ns: string): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Returns a resource data by language.
|
|
169
|
+
* @param lng
|
|
170
|
+
*/
|
|
171
|
+
export function getDataByLanguage(lng: string): object;
|
|
172
|
+
/**
|
|
173
|
+
* Returns a resource bundle.
|
|
174
|
+
* @param lng
|
|
175
|
+
* @param ns
|
|
176
|
+
*/
|
|
177
|
+
export function getResourceBundle(lng: string, ns: string): object;
|
|
178
|
+
/**
|
|
179
|
+
* Removes an existing bundle.
|
|
180
|
+
* @param lng
|
|
181
|
+
* @param ns
|
|
182
|
+
*/
|
|
183
|
+
export function removeResourceBundle(lng: string, ns: string): void;
|
package/dummy/i18next.js
ADDED
package/dummy/olayer2.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
//@ts-ignore
|
|
2
2
|
export default window.OpenLayers;
|
package/olayer2.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as math from "./math.js";
|
|
|
6
6
|
import * as osm from "./osm.js";
|
|
7
7
|
import * as text from "./text.js";
|
|
8
8
|
import * as web from "./web.js";
|
|
9
|
-
import
|
|
9
|
+
import OpenLayers from "./dummy/olayer2.js";
|
|
10
10
|
|
|
11
11
|
export function toPointArray(numArr, options)
|
|
12
12
|
{
|
package/package.json
CHANGED
package/web.d.ts
CHANGED
|
@@ -110,9 +110,11 @@ export function mimeFromExt(ext: string): string;
|
|
|
110
110
|
export function getImageInfo(url: string): Promise<ImageInfo|null>;
|
|
111
111
|
export function propertiesToHTML(prop: object, nameMap?: object, timeFormat?: string): string;
|
|
112
112
|
export function getCacheSize(name: string): Promise<number>;
|
|
113
|
-
export function getInputOrSelectElement(id: string): HTMLInputElement|HTMLSelectElement;
|
|
114
113
|
export function getInputElement(id: string): HTMLInputElement;
|
|
115
114
|
export function getSelectElement(id: string): HTMLSelectElement;
|
|
115
|
+
export function getButtonElement(id: string): HTMLButtonElement;
|
|
116
|
+
export function getDivElement(id: string): HTMLDivElement;
|
|
117
|
+
export function getSpanElement(id: string): HTMLSpanElement;
|
|
116
118
|
export function getBrowserInfo(): Promise<BrowserInfo>;
|
|
117
119
|
export function parseUserAgent(userAgent: string): BrowserInfo;
|
|
118
120
|
|
package/web.js
CHANGED
|
@@ -149,7 +149,14 @@ export function buildTable(o)
|
|
|
149
149
|
ret.push("<tr>");
|
|
150
150
|
for (name in o[0])
|
|
151
151
|
{
|
|
152
|
-
|
|
152
|
+
if (typeof obj[name] == "object")
|
|
153
|
+
{
|
|
154
|
+
ret.push("<td>"+text.toHTMLText(JSON.stringify(obj[name]))+"</td>");
|
|
155
|
+
}
|
|
156
|
+
else
|
|
157
|
+
{
|
|
158
|
+
ret.push("<td>"+text.toHTMLText(""+obj[name])+"</td>");
|
|
159
|
+
}
|
|
153
160
|
}
|
|
154
161
|
ret.push("</tr>");
|
|
155
162
|
i++;
|
|
@@ -161,7 +168,14 @@ export function buildTable(o)
|
|
|
161
168
|
{
|
|
162
169
|
ret.push("<tr>");
|
|
163
170
|
ret.push("<td>"+text.toHTMLText(name)+"</td>");
|
|
164
|
-
|
|
171
|
+
if (typeof o[name] == "object")
|
|
172
|
+
{
|
|
173
|
+
ret.push("<td>"+text.toHTMLText(JSON.stringify(o[name]))+"</td>");
|
|
174
|
+
}
|
|
175
|
+
else
|
|
176
|
+
{
|
|
177
|
+
ret.push("<td>"+text.toHTMLText(""+o[name])+"</td>");
|
|
178
|
+
}
|
|
165
179
|
ret.push("</tr>");
|
|
166
180
|
}
|
|
167
181
|
}
|
|
@@ -924,46 +938,72 @@ export async function getCacheSize(name)
|
|
|
924
938
|
|
|
925
939
|
/**
|
|
926
940
|
* @param {string} id
|
|
927
|
-
* @returns {HTMLInputElement
|
|
941
|
+
* @returns {HTMLInputElement}
|
|
928
942
|
*/
|
|
929
|
-
export function
|
|
943
|
+
export function getInputElement(id)
|
|
930
944
|
{
|
|
931
945
|
let ele = document.getElementById(id);
|
|
932
946
|
if (ele == null)
|
|
933
947
|
throw new Error("Element with id \""+id+"\" not found");
|
|
934
948
|
if (ele instanceof HTMLInputElement)
|
|
935
949
|
return ele;
|
|
950
|
+
throw new Error("Element with id \""+id+"\" is not an input");
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* @param {string} id
|
|
955
|
+
* @returns {HTMLSelectElement}
|
|
956
|
+
*/
|
|
957
|
+
export function getSelectElement(id)
|
|
958
|
+
{
|
|
959
|
+
let ele = document.getElementById(id);
|
|
960
|
+
if (ele == null)
|
|
961
|
+
throw new Error("Element with id \""+id+"\" not found");
|
|
936
962
|
if (ele instanceof HTMLSelectElement)
|
|
937
963
|
return ele;
|
|
938
|
-
throw new Error("Element with id \""+id+"\" is not
|
|
964
|
+
throw new Error("Element with id \""+id+"\" is not a select");
|
|
939
965
|
}
|
|
940
966
|
|
|
941
967
|
/**
|
|
942
968
|
* @param {string} id
|
|
943
|
-
* @returns {
|
|
969
|
+
* @returns {HTMLButtonElement}
|
|
944
970
|
*/
|
|
945
|
-
export function
|
|
971
|
+
export function getButtonElement(id)
|
|
946
972
|
{
|
|
947
973
|
let ele = document.getElementById(id);
|
|
948
974
|
if (ele == null)
|
|
949
975
|
throw new Error("Element with id \""+id+"\" not found");
|
|
950
|
-
if (ele instanceof
|
|
976
|
+
if (ele instanceof HTMLButtonElement)
|
|
951
977
|
return ele;
|
|
952
|
-
throw new Error("Element with id \""+id+"\" is not
|
|
978
|
+
throw new Error("Element with id \""+id+"\" is not a button");
|
|
953
979
|
}
|
|
954
980
|
|
|
955
981
|
/**
|
|
956
982
|
* @param {string} id
|
|
957
|
-
* @returns {
|
|
983
|
+
* @returns {HTMLDivElement}
|
|
958
984
|
*/
|
|
959
|
-
export function
|
|
985
|
+
export function getDivElement(id)
|
|
960
986
|
{
|
|
961
987
|
let ele = document.getElementById(id);
|
|
962
988
|
if (ele == null)
|
|
963
989
|
throw new Error("Element with id \""+id+"\" not found");
|
|
964
|
-
if (ele instanceof
|
|
990
|
+
if (ele instanceof HTMLDivElement)
|
|
965
991
|
return ele;
|
|
966
|
-
throw new Error("Element with id \""+id+"\" is not a
|
|
992
|
+
throw new Error("Element with id \""+id+"\" is not a div");
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* @param {string} id
|
|
997
|
+
* @returns {HTMLSpanElement}
|
|
998
|
+
*/
|
|
999
|
+
export function getSpanElement(id)
|
|
1000
|
+
{
|
|
1001
|
+
let ele = document.getElementById(id);
|
|
1002
|
+
if (ele == null)
|
|
1003
|
+
throw new Error("Element with id \""+id+"\" not found");
|
|
1004
|
+
if (ele instanceof HTMLSpanElement)
|
|
1005
|
+
return ele;
|
|
1006
|
+
throw new Error("Element with id \""+id+"\" is not a span");
|
|
967
1007
|
}
|
|
968
1008
|
|
|
969
1009
|
/**
|