Get the language module out of spot.js

This commit is contained in:
2026-04-25 19:36:03 +02:00
parent ff4bc26381
commit 7dc2b28c44
11 changed files with 89 additions and 106 deletions

View File

@@ -9,7 +9,7 @@ export default {
SpotButton,
AdminInput
},
inject: ['spot'],
inject: ['spot', 'lang'],
data() {
return {
elems: {},
@@ -22,7 +22,7 @@ export default {
},
methods: {
l(id) {
return this.spot.lang(id);
return this.lang.get(id);
},
setEvents() {
this.spot.addPage('admin', {
@@ -57,7 +57,7 @@ export default {
for(const [iKey, oNewElem] of Object.entries(aoNewElems)) {
oNewElem.type = sType;
this.elems[sType][oNewElem.id] = oNewElem;
this.spot.onFeedback('success', this.spot.lang('admin_create_success'), {'create':sType});
this.spot.onFeedback('success', this.lang.get('admin_create_success'), {'create':sType});
}
}
})
@@ -73,7 +73,7 @@ export default {
'admin_delete',
(asData) => {
delete this.elems[asInputs.type][asInputs.id];
this.spot.onFeedback('success', this.spot.lang('admin_delete_success'), asInputs);
this.spot.onFeedback('success', this.lang.get('admin_delete_success'), asInputs);
},
asInputs,
(sError) => {
@@ -97,7 +97,7 @@ export default {
this.spot.get2('admin_set', asInputs)
.then((asData) => {
this.elems[oElem.type][oElem.id][oEvent.target.name] = sNewVal;
this.spot.onFeedback('success', this.spot.lang('admin_save_success'), asInputs);
this.spot.onFeedback('success', this.lang.get('admin_save_success'), asInputs);
})
.catch((sError) => {
oEvent.target.value = sOldVal;
@@ -232,4 +232,4 @@ export default {
<p v-for="feedback in feedbacks" :class="feedback.type">{{ feedback.msg }}</p>
</div>
</div>
</template>
</template>