@live-change/vue3-components 0.8.11 → 0.8.13
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/logic/locale.js +40 -19
- package/package.json +6 -6
package/logic/locale.js
CHANGED
|
@@ -7,6 +7,8 @@ let localeRef = ref()
|
|
|
7
7
|
|
|
8
8
|
export async function getOtherOwnerLocale(owner, context) {
|
|
9
9
|
if(localeObservable) localeObservable.unbindProperty(localeRef, 'value')
|
|
10
|
+
context = context ?? getCurrentInstance().appContext
|
|
11
|
+
const api = useApi(context)
|
|
10
12
|
if(typeof window === 'undefined') {
|
|
11
13
|
const value = await api.get(api.views.localeSettings.localeSettings(owner))
|
|
12
14
|
localeObservable = new ObservableValue(value)
|
|
@@ -64,31 +66,50 @@ export function captureLocale(context) {
|
|
|
64
66
|
if(typeof navigator === 'undefined') return
|
|
65
67
|
return (async () => {
|
|
66
68
|
const localeSettings = await getLocale(context)
|
|
67
|
-
console.log("LOCALE SETTINGS", localeSettings)
|
|
69
|
+
//console.log("LOCALE SETTINGS", JSON.stringify(localeSettings, null, ' '))
|
|
70
|
+
|
|
71
|
+
const capturedLanguage = navigator.language
|
|
72
|
+
const capturedDateTime = new Intl.DateTimeFormat().resolvedOptions()
|
|
73
|
+
const capturedList = new Intl.ListFormat().resolvedOptions()
|
|
74
|
+
const capturedNumber = new Intl.NumberFormat().resolvedOptions()
|
|
75
|
+
const capturedPlural = new Intl.PluralRules().resolvedOptions()
|
|
76
|
+
const capturedRelativeTime = new Intl.RelativeTimeFormat().resolvedOptions()
|
|
77
|
+
|
|
78
|
+
const capturedLocaleSettings = {
|
|
79
|
+
capturedLanguage,
|
|
80
|
+
capturedDateTime,
|
|
81
|
+
capturedList,
|
|
82
|
+
capturedNumber,
|
|
83
|
+
capturedPlural,
|
|
84
|
+
capturedRelativeTime
|
|
85
|
+
}
|
|
68
86
|
|
|
69
|
-
|
|
70
|
-
const listOptions = new Intl.ListFormat().resolvedOptions()
|
|
71
|
-
const numberOptions = new Intl.NumberFormat().resolvedOptions()
|
|
72
|
-
const pluralOptions = new Intl.PluralRules().resolvedOptions()
|
|
73
|
-
const relativeTimeOptions = new Intl.RelativeTimeFormat().resolvedOptions()
|
|
87
|
+
//console.log("CAPTURED LOCALE SETTINGS", JSON.stringify(capturedLocaleSettings, null, ' '))
|
|
74
88
|
|
|
89
|
+
/*console.log("language", localeSettings.capturedLanguage !== capturedLanguage)
|
|
90
|
+
console.log("dateTime", JSON.stringify(capturedDateTime) !== JSON.stringify(localeSettings.capturedDateTime))
|
|
91
|
+
console.log("list", JSON.stringify(capturedList) !== JSON.stringify(localeSettings.capturedList))
|
|
92
|
+
console.log("number", JSON.stringify(capturedNumber) !== JSON.stringify(localeSettings.capturedNumber))
|
|
93
|
+
console.log("plural", JSON.stringify(capturedPlural) !== JSON.stringify(localeSettings.capturedPlural))
|
|
94
|
+
console.log("relativeTime", JSON.stringify(capturedRelativeTime) !== JSON.stringify(localeSettings.capturedRelativeTime))
|
|
95
|
+
*/
|
|
75
96
|
if(!localeSettings
|
|
76
|
-
|| localeSettings.capturedLanguage !==
|
|
77
|
-
|| JSON.stringify(localeSettings.capturedDateTime) !== JSON.stringify(
|
|
78
|
-
|| JSON.stringify(localeSettings.capturedList) !== JSON.stringify(
|
|
79
|
-
|| JSON.stringify(localeSettings.capturedNumber) !== JSON.stringify(
|
|
80
|
-
|| JSON.stringify(localeSettings.capturedPlural) !== JSON.stringify(
|
|
81
|
-
|| JSON.stringify(localeSettings.capturedRelativeTime) !== JSON.stringify(
|
|
97
|
+
|| localeSettings.capturedLanguage !== capturedLanguage
|
|
98
|
+
|| JSON.stringify(localeSettings.capturedDateTime) !== JSON.stringify(capturedDateTime)
|
|
99
|
+
|| JSON.stringify(localeSettings.capturedList) !== JSON.stringify(capturedList)
|
|
100
|
+
|| JSON.stringify(localeSettings.capturedNumber) !== JSON.stringify(capturedNumber)
|
|
101
|
+
|| JSON.stringify(localeSettings.capturedPlural) !== JSON.stringify(capturedPlural)
|
|
102
|
+
|| JSON.stringify(localeSettings.capturedRelativeTime) !== JSON.stringify(capturedRelativeTime)
|
|
82
103
|
) {
|
|
83
104
|
const update = {
|
|
84
|
-
capturedLanguage
|
|
85
|
-
capturedDateTime
|
|
86
|
-
capturedList
|
|
87
|
-
capturedNumber
|
|
88
|
-
capturedPlural
|
|
89
|
-
capturedRelativeTime
|
|
105
|
+
capturedLanguage,
|
|
106
|
+
capturedDateTime,
|
|
107
|
+
capturedList,
|
|
108
|
+
capturedNumber,
|
|
109
|
+
capturedPlural,
|
|
110
|
+
capturedRelativeTime
|
|
90
111
|
}
|
|
91
|
-
console.log("
|
|
112
|
+
console.log("UPDATE LOCALE SETTINGS", update)
|
|
92
113
|
await updateLocale(update, context)
|
|
93
114
|
}
|
|
94
115
|
})()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/vue3-components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.13",
|
|
4
4
|
"description": "Live Change Framework - vue components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/live-change/live-change-
|
|
11
|
+
"url": "git+https://github.com/live-change/live-change-stack.git"
|
|
12
12
|
},
|
|
13
13
|
"author": {
|
|
14
14
|
"email": "m8@em8.pl",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"bugs": {
|
|
20
|
-
"url": "https://github.com/live-change/live-change-
|
|
20
|
+
"url": "https://github.com/live-change/live-change-stack/issues"
|
|
21
21
|
},
|
|
22
|
-
"homepage": "https://github.com/live-change/live-change-
|
|
22
|
+
"homepage": "https://github.com/live-change/live-change-stack",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/vue3-ssr": "^0.8.
|
|
24
|
+
"@live-change/vue3-ssr": "^0.8.13",
|
|
25
25
|
"debug": "^4.3.4",
|
|
26
26
|
"mitt": "3.0.1",
|
|
27
27
|
"vue": "^3.4.19"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "4453aa639a9fe1a857d93d73ebd28a82c97fdd87"
|
|
30
30
|
}
|