@live-change/vue3-components 0.9.175 → 0.9.177
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 +17 -2
- package/package.json +3 -3
package/logic/locale.js
CHANGED
|
@@ -58,6 +58,21 @@ export class Locale {
|
|
|
58
58
|
return this.localeObservable.getValue()
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
async getOtherUserOrSessionLocale(user, session) {
|
|
62
|
+
if(this.localeObservable) this.localeObservable.unbindProperty(this.localeRef, 'value')
|
|
63
|
+
const path = this.api.views.localeSettings.userOrSessionLocaleSettings({ user, session })
|
|
64
|
+
if(typeof window === 'undefined') {
|
|
65
|
+
const value = await this.api.get(path)
|
|
66
|
+
this.localeObservable = new ObservableValue(value)
|
|
67
|
+
} else {
|
|
68
|
+
this.localeObservable = this.api.observable(path)
|
|
69
|
+
}
|
|
70
|
+
this.localeObservable.bindProperty(this.localeRef, 'value')
|
|
71
|
+
this.localeObservable.wait()
|
|
72
|
+
return this.localeObservable.getValue()
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
61
76
|
getLanguage() {
|
|
62
77
|
const language = this.localeRef.value?.language ?? this.localeRef.value?.capturedLanguage
|
|
63
78
|
return language && language.slice(0, 2)
|
|
@@ -103,7 +118,7 @@ export class Locale {
|
|
|
103
118
|
return this.api.actions.localeSettings.setOrUpdateMyLocaleSettings(localSettingsUpdate)
|
|
104
119
|
}
|
|
105
120
|
|
|
106
|
-
async captureLocale() {
|
|
121
|
+
async captureLocale(force = false) {
|
|
107
122
|
if(typeof window === 'undefined') return // capture only on client
|
|
108
123
|
if(typeof navigator === 'undefined') return // capture only on client
|
|
109
124
|
return (async () => {
|
|
@@ -135,7 +150,7 @@ export class Locale {
|
|
|
135
150
|
console.log("plural", JSON.stringify(capturedPlural) !== JSON.stringify(localeSettings.capturedPlural))
|
|
136
151
|
console.log("relativeTime", JSON.stringify(capturedRelativeTime) !== JSON.stringify(localeSettings.capturedRelativeTime))
|
|
137
152
|
*/
|
|
138
|
-
if(!localeSettings
|
|
153
|
+
if(force || !localeSettings
|
|
139
154
|
|| localeSettings.capturedLanguage !== capturedLanguage
|
|
140
155
|
|| JSON.stringify(localeSettings.capturedDateTime) !== JSON.stringify(capturedDateTime)
|
|
141
156
|
|| JSON.stringify(localeSettings.capturedList) !== JSON.stringify(capturedList)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/vue3-components",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.177",
|
|
4
4
|
"description": "Live Change Framework - vue components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/live-change/live-change-stack",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/vue3-ssr": "^0.9.
|
|
24
|
+
"@live-change/vue3-ssr": "^0.9.177",
|
|
25
25
|
"debug": "^4.3.4",
|
|
26
26
|
"mitt": "3.0.1",
|
|
27
27
|
"vue": "^3.5.12",
|
|
28
28
|
"vue3-scroll-border": "0.1.7"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "d75c8c63935b7b78623248d255820b1da2676929"
|
|
31
31
|
}
|