@saooti/octopus-sdk 31.0.13 → 31.0.14
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 +1 -0
- package/package.json +1 -1
- package/src/components/display/comments/CommentList.vue +0 -1
- package/src/components/misc/Footer.vue +6 -1
- package/src/i18n.ts +36 -0
- package/src/main.ts +28 -30
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -185,7 +185,6 @@ export default defineComponent({
|
|
|
185
185
|
comItem.receiveCommentEvent(data);
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
|
-
const updatedStatus = data.comment.status;
|
|
189
188
|
const index = this.findCommentIndex(data.comment.comId);
|
|
190
189
|
if (-1 !== index) {
|
|
191
190
|
if ((!this.editRight && 'Valid' !== data.comment.status) ||
|
|
@@ -142,9 +142,11 @@
|
|
|
142
142
|
</template>
|
|
143
143
|
|
|
144
144
|
<script lang="ts">
|
|
145
|
+
import { cookies } from '../mixins/functions';
|
|
145
146
|
import ClassicSelect from '../form/ClassicSelect.vue';
|
|
146
147
|
import Player from './Player.vue';
|
|
147
148
|
import { state } from '../../store/paramStore';
|
|
149
|
+
import {loadLocaleMessages} from '@/i18n';
|
|
148
150
|
import octopusApi from '@saooti/octopus-api';
|
|
149
151
|
import moment from 'moment';
|
|
150
152
|
import { Category } from '@/store/class/general/category';
|
|
@@ -157,6 +159,8 @@ export default defineComponent({
|
|
|
157
159
|
ClassicSelect
|
|
158
160
|
},
|
|
159
161
|
|
|
162
|
+
mixins:[cookies],
|
|
163
|
+
|
|
160
164
|
data() {
|
|
161
165
|
return {
|
|
162
166
|
language: this.$i18n.locale as string,
|
|
@@ -199,7 +203,8 @@ export default defineComponent({
|
|
|
199
203
|
}
|
|
200
204
|
},
|
|
201
205
|
changeLanguage(): void{
|
|
202
|
-
this
|
|
206
|
+
this.setCookie('octopus-language', this.language);
|
|
207
|
+
loadLocaleMessages(this.$i18n, this.language, this.$store.state.general.isEducation);
|
|
203
208
|
moment.locale(this.$i18n.locale);
|
|
204
209
|
octopusApi.fetchCategories({ lang: this.$i18n.locale }).then((data: Array<Category>) => {
|
|
205
210
|
this.$store.commit('categoriesSet', data);
|
package/src/i18n.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { nextTick } from 'vue'
|
|
3
|
+
import { createI18n } from 'vue-i18n';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export function setupI18n(options = { locale: 'en' }, isEducation: boolean) {
|
|
7
|
+
const i18n = createI18n(options)
|
|
8
|
+
loadLocaleMessages(i18n.global, options.locale, isEducation);
|
|
9
|
+
return i18n;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function setI18nLanguage(i18n: any, locale: string) {
|
|
13
|
+
i18n.locale = locale;
|
|
14
|
+
const html= document.querySelector('html');
|
|
15
|
+
if(html){
|
|
16
|
+
html.setAttribute('lang', locale);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function loadLocaleMessages(i18n: any, locale:string, isEducation: boolean) {
|
|
21
|
+
if(!i18n.messages[locale] || 0===Object.keys(i18n.messages[locale]).length){
|
|
22
|
+
let messages = await import(
|
|
23
|
+
`./locale/${locale}.ts`
|
|
24
|
+
)
|
|
25
|
+
messages = messages.default;
|
|
26
|
+
if(isEducation && ('fr'===locale || 'en'===locale)){
|
|
27
|
+
const messagesEdu = await import(
|
|
28
|
+
`./locale/education${locale}.ts`
|
|
29
|
+
);
|
|
30
|
+
messages ={...messages, ...messagesEdu.default};
|
|
31
|
+
}
|
|
32
|
+
i18n.setLocaleMessage(locale, messages);
|
|
33
|
+
}
|
|
34
|
+
setI18nLanguage(i18n, locale)
|
|
35
|
+
return nextTick();
|
|
36
|
+
}
|
package/src/main.ts
CHANGED
|
@@ -2,50 +2,48 @@ import { createApp } from 'vue';
|
|
|
2
2
|
import { VueReCaptcha } from 'vue-recaptcha-v3';
|
|
3
3
|
import VueLazyLoad from 'vue3-lazyload';
|
|
4
4
|
import App from './App.vue';
|
|
5
|
-
import {
|
|
6
|
-
import I18nResources from './locale/messages';
|
|
5
|
+
import {setupI18n} from './i18n';
|
|
7
6
|
import router from '@/router/router';
|
|
8
7
|
import moment from 'moment';
|
|
9
8
|
import store from '@/store/AppStore';
|
|
10
9
|
import paramStore from '@/store/paramStore';
|
|
11
|
-
import { LocaleMessage } from '@intlify/core-base';
|
|
12
10
|
/* import 'popper.js/dist/popper.min.js'; */
|
|
13
11
|
/* import 'jquery/src/jquery.js'; */
|
|
14
12
|
/* import 'jquery';
|
|
15
13
|
import 'bootstrap/dist/js/bootstrap.bundle.min.js';
|
|
16
14
|
*/
|
|
17
15
|
|
|
16
|
+
|
|
18
17
|
//TODO
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}else if(navigatorLang.includes('de')){
|
|
30
|
-
language = 'de';
|
|
18
|
+
const nameEQ = 'octopus-language=';
|
|
19
|
+
const ca = document.cookie.split(';');
|
|
20
|
+
let language = "";
|
|
21
|
+
for (let i = 0; i < ca.length; i++) {
|
|
22
|
+
let c = ca[i];
|
|
23
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
24
|
+
if (0 === c.indexOf(nameEQ)){
|
|
25
|
+
language = c.substring(nameEQ.length, c.length);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
29
|
+
if(0===language.length){
|
|
30
|
+
const navigatorLang = navigator.language /* || navigator.userLanguage */;
|
|
31
|
+
language = 'fr';
|
|
32
|
+
if(navigatorLang.includes('en')){
|
|
33
|
+
language = 'en';
|
|
34
|
+
}else if(navigatorLang.includes('it')){
|
|
35
|
+
language = 'it';
|
|
36
|
+
}else if(navigatorLang.includes('sl')){
|
|
37
|
+
language = 'sl';
|
|
38
|
+
}else if(navigatorLang.includes('es')){
|
|
39
|
+
language = 'es';
|
|
40
|
+
}else if(navigatorLang.includes('de')){
|
|
41
|
+
language = 'de';
|
|
42
|
+
}
|
|
42
43
|
}
|
|
43
|
-
const i18n = createI18n({
|
|
44
|
-
locale: language,
|
|
45
|
-
messages: messages,
|
|
46
|
-
});
|
|
47
|
-
moment.locale(language);
|
|
48
44
|
|
|
45
|
+
const i18n = setupI18n({locale: language}, store.state.general.education);
|
|
46
|
+
moment.locale(language);
|
|
49
47
|
|
|
50
48
|
paramStore.initialize({
|
|
51
49
|
generalParameters: {},
|