@afeefa/vue-app 0.0.277 → 0.0.279
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/.afeefa/package/release/version.txt +1 -1
- package/package.json +1 -1
- package/src/components/AInfo.vue +1 -1
- package/src-admin/AfeefaAdmin.js +4 -0
- package/src-admin/config/AdminConfig.js +3 -1
- package/src-admin/plugins/translation/TranslationPlugin.js +2 -2
- package/src-admin/services/TranslationService.js +14 -2
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.279
|
package/package.json
CHANGED
package/src/components/AInfo.vue
CHANGED
package/src-admin/AfeefaAdmin.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import './config/components'
|
2
2
|
import './directives'
|
3
3
|
|
4
|
+
import { translationPlugin } from '@a-admin/plugins/translation/TranslationPlugin'
|
4
5
|
import { apiResourcesPlugin } from '@a-vue/plugins/api-resources/ApiResourcesPlugin'
|
5
6
|
import { eventBusPlugin } from '@a-vue/plugins/event-bus/EventBusPlugin'
|
6
7
|
import { hasOptionsPlugin } from '@a-vue/plugins/has-options/HasOptionsPlugin'
|
@@ -69,8 +70,11 @@ export class AfeefaAdmin {
|
|
69
70
|
// set app config
|
70
71
|
adminConfig.app = this._appConfig
|
71
72
|
|
73
|
+
translationPlugin.setTranslations(this._appConfig.translations)
|
74
|
+
|
72
75
|
Vue.use(configPlugin)
|
73
76
|
Vue.use(iconsPlugin)
|
77
|
+
Vue.use(translationPlugin)
|
74
78
|
|
75
79
|
// authenticate current user before doing any gui-voodo
|
76
80
|
if (this._authService) {
|
@@ -9,8 +9,8 @@ class TranslationPlugin {
|
|
9
9
|
install (Vue) {
|
10
10
|
Vue.mixin({
|
11
11
|
created () {
|
12
|
-
this.$t = (
|
13
|
-
return translationService.translate(
|
12
|
+
this.$t = (...args) => {
|
13
|
+
return translationService.translate(...args)
|
14
14
|
}
|
15
15
|
}
|
16
16
|
})
|
@@ -1,6 +1,12 @@
|
|
1
1
|
class TranslationService {
|
2
|
+
lang = null
|
3
|
+
|
2
4
|
translations = {}
|
3
5
|
|
6
|
+
setLang (lang) {
|
7
|
+
this.lang = lang
|
8
|
+
}
|
9
|
+
|
4
10
|
setTranslations (translations) {
|
5
11
|
translations.forEach(t => {
|
6
12
|
const key = JSON.stringify([
|
@@ -14,13 +20,19 @@ class TranslationService {
|
|
14
20
|
})
|
15
21
|
}
|
16
22
|
|
17
|
-
translate (
|
23
|
+
translate (...args) {
|
24
|
+
let realm, objectType, objectId, key, lang
|
25
|
+
|
26
|
+
if (args.length === 1) {
|
27
|
+
key = args[0]
|
28
|
+
}
|
29
|
+
|
18
30
|
const tKey = JSON.stringify([
|
19
31
|
realm,
|
20
32
|
objectType,
|
21
33
|
objectId,
|
22
34
|
key,
|
23
|
-
lang
|
35
|
+
lang || this.lang
|
24
36
|
])
|
25
37
|
|
26
38
|
if (!this.translations[tKey]) {
|