Using the new translation helper on all components.

Using array_dot, on translations
parent 8ffaf496
......@@ -3,7 +3,10 @@
</template>
<script>
import TranslationHelper from '../../../../Core/Assets/js/mixins/TranslationHelper'
export default {
mixins: [TranslationHelper],
props: {
rows: {default: null},
scope: {default: null},
......@@ -17,8 +20,8 @@
methods: {
deleteRow(event) {
this.$confirm(this.deleteMessage, this.deleteTitle, {
confirmButtonText: this.$t('core.button.delete'),
cancelButtonText: this.$t('core.button.cancel'),
confirmButtonText: this.trans('core.button.delete'),
cancelButtonText: this.trans('core.button.cancel'),
type: 'warning'
}).then(() => {
let vm = this;
......@@ -42,14 +45,14 @@
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('core.delete-cancelled')
message: this.trans('core.delete-cancelled')
});
});
}
},
mounted() {
this.deleteMessage = this.$t('core.modal.confirmation-message');
this.deleteTitle = this.$t('core.modal.title');
this.deleteMessage = this.trans('core.modal.confirmation-message');
this.deleteTitle = this.trans('core.modal.title');
}
}
</script>
......@@ -2,15 +2,15 @@
<div class="div">
<div class="content-header">
<h1>
{{ $t(`page.${pageTitle}`) }}
{{ trans(`page.${pageTitle}`) }}
</h1>
<el-breadcrumb separator="/">
<el-breadcrumb-item>
<a href="/backend">Home</a>
</el-breadcrumb-item>
<el-breadcrumb-item :to="{name: 'admin.page.page.index'}">{{ $t('page.pages') }}
<el-breadcrumb-item :to="{name: 'admin.page.page.index'}">{{ trans('page.pages') }}
</el-breadcrumb-item>
<el-breadcrumb-item :to="{name: 'admin.page.page.create'}">{{ $t(`page.${pageTitle}`) }}
<el-breadcrumb-item :to="{name: 'admin.page.page.create'}">{{ trans(`page.${pageTitle}`) }}
</el-breadcrumb-item>
</el-breadcrumb>
</div>
......@@ -27,14 +27,14 @@
:key="localeArray.name">
<span slot="label" :class="{'error' : form.errors.has(locale)}">{{ localeArray.name
}}</span>
<el-form-item :label="$t('page.title')"
<el-form-item :label="trans('page.title')"
:class="{'el-form-item is-error': form.errors.has(locale + '.title') }">
<el-input v-model="page[locale].title"></el-input>
<div class="el-form-item__error" v-if="form.errors.has(locale + '.title')"
v-text="form.errors.first(locale + '.title')"></div>
</el-form-item>
<el-form-item :label="$t('page.slug')"
<el-form-item :label="trans('page.slug')"
:class="{'el-form-item is-error': form.errors.has(locale + '.slug') }">
<el-input v-model="page[locale].slug">
<el-button slot="prepend" @click="generateSlug($event, locale)">Generate</el-button>
......@@ -43,7 +43,7 @@
v-text="form.errors.first(locale + '.slug')"></div>
</el-form-item>
<el-form-item :label="$t('page.body')"
<el-form-item :label="trans('page.body')"
:class="{'el-form-item is-error': form.errors.has(locale + '.body') }">
<ckeditor v-model="page[locale].body" :value="page[locale].body">
</ckeditor>
......@@ -56,17 +56,17 @@
<h4 class="box-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion"
:href="`#collapseMeta-${locale}`">
{{ $t('page.meta_data') }}
{{ trans('page.meta_data') }}
</a>
</h4>
</div>
<div style="height: 0px;" :id="`collapseMeta-${locale}`"
class="panel-collapse collapse">
<div class="box-body">
<el-form-item :label="$t('page.meta_title')">
<el-form-item :label="trans('page.meta_title')">
<el-input v-model="page[locale].meta_title"></el-input>
</el-form-item>
<el-form-item :label="$t('page.meta_description')">
<el-form-item :label="trans('page.meta_description')">
<el-input type="textarea"
v-model="page[locale].meta_description"></el-input>
</el-form-item>
......@@ -79,28 +79,28 @@
<h4 class="box-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion"
:href="`#collapseFacebook-${locale}`">
{{ $t('page.facebook_data') }}
{{ trans('page.facebook_data') }}
</a>
</h4>
</div>
<div style="height: 0px;" :id="`collapseFacebook-${locale}`"
class="panel-collapse collapse">
<div class="box-body">
<el-form-item :label="$t('page.og_title')">
<el-form-item :label="trans('page.og_title')">
<el-input v-model="page[locale].og_title"></el-input>
</el-form-item>
<el-form-item :label="$t('page.og_description')">
<el-form-item :label="trans('page.og_description')">
<el-input type="textarea"
v-model="page[locale].og_description"></el-input>
</el-form-item>
<el-form-item :label="$t('page.og_type')">
<el-form-item :label="trans('page.og_type')">
<el-select v-model="page[locale].og_type"
:placeholder="$t('page.og_type')">
<el-option :label="$t('page.facebook-types.website')"
:placeholder="trans('page.og_type')">
<el-option :label="trans('page.facebook-types.website')"
value="website"></el-option>
<el-option :label="$t('page.facebook-types.product')"
<el-option :label="trans('page.facebook-types.product')"
value="product"></el-option>
<el-option :label="$t('page.facebook-types.article')"
<el-option :label="trans('page.facebook-types.article')"
value="article"></el-option>
</el-select>
</el-form-item>
......@@ -110,9 +110,9 @@
<el-form-item>
<el-button type="primary" @click="onSubmit()" :loading="loading">
{{ $t('core.save') }}
{{ trans('core.save') }}
</el-button>
<el-button @click="onCancel()">{{ $t('core.button.cancel') }}
<el-button @click="onCancel()">{{ trans('core.button.cancel') }}
</el-button>
</el-form-item>
......@@ -126,9 +126,9 @@
<div class="box-body">
<el-form-item label="">
<el-checkbox v-model="page.is_home" :true-label="1" :false-label="0" name="is_home"
:label="$t('page.is_homepage')"></el-checkbox>
:label="trans('page.is homepage')"></el-checkbox>
</el-form-item>
<el-form-item :label="$t('page.template')"
<el-form-item :label="trans('page.template')"
:class="{'el-form-item is-error': form.errors.has('template') }">
<el-select v-model="page.template" filterable>
<el-option v-for="(template, key) in templates" :key="template"
......@@ -149,10 +149,11 @@
<script>
import axios from 'axios'
import Slugify from '../../../../Core/Assets/js/mixins/Slugify'
import TranslationHelper from '../../../../Core/Assets/js/mixins/TranslationHelper'
import Form from 'form-backend-validation'
export default {
mixins: [Slugify],
mixins: [Slugify, TranslationHelper],
props: {
locales: {default: null},
pageTitle: {default: null, String},
......
......@@ -6,7 +6,7 @@
<data-tables :data="data" :actions-def="actionsDef">
<el-table-column prop="id" label="Id" width="100">
</el-table-column>
<el-table-column prop="title" :label="$t('page.title')">
<el-table-column prop="title" :label="trans('page.title')">
</el-table-column>
<el-table-column prop="slug" label="Slug">
</el-table-column>
......@@ -30,10 +30,12 @@
<script>
import axios from 'axios'
import TranslationHelper from '../../../../Core/Assets/js/mixins/TranslationHelper'
let data;
export default {
mixins: [TranslationHelper],
data() {
return {
data,
......@@ -42,7 +44,7 @@
links: {},
actionsDef: {
def: [{
name: this.$t('page.create-page'),
name: this.trans('page.create-page'),
icon: 'edit',
handler: () => {
this.$router.push({name: 'admin.page.page.create'})
......
......@@ -2,13 +2,13 @@
<div class="div">
<div class="content-header">
<h1>
{{ $t('page.pages') }}
{{ trans('page.pages') }}
</h1>
<el-breadcrumb separator="/">
<el-breadcrumb-item>
<a href="/backend">Home</a>
</el-breadcrumb-item>
<el-breadcrumb-item :to="{name: 'admin.page.page.index'}">{{ $t('page.pages') }}</el-breadcrumb-item>
<el-breadcrumb-item :to="{name: 'admin.page.page.index'}">{{ trans('page.pages') }}</el-breadcrumb-item>
</el-breadcrumb>
</div>
......@@ -21,7 +21,7 @@
<div class="actions el-col el-col-5">
<router-link :to="{name: 'admin.page.page.create'}">
<el-button type="primary"><i class="el-icon-edit"></i>
{{ $t('page.create-page') }}
{{ trans('page.create-page') }}
</el-button>
</router-link>
</div>
......@@ -39,13 +39,13 @@
@sort-change="handleSortChange">
<el-table-column prop="id" label="Id" width="100" sortable="custom">
</el-table-column>
<el-table-column prop="translations.title" :label="$t('page.title')">
<el-table-column prop="translations.title" :label="trans('page.title')">
</el-table-column>
<el-table-column prop="translations.slug" :label="$t('page.slug')">
<el-table-column prop="translations.slug" :label="trans('page.slug')">
</el-table-column>
<el-table-column prop="created_at" :label="$t('core.created_at')" sortable="custom">
<el-table-column prop="created_at" :label="trans('core.table.created at')" sortable="custom">
</el-table-column>
<el-table-column fixed="right" prop="actions" :label="$t('core.actions')">
<el-table-column fixed="right" prop="actions" :label="trans('core.table.actions')">
<template scope="scope">
<a class="btn btn-default btn-flat" @click.prevent="goToEdit(scope)"><i
class="fa fa-pencil"></i></a>
......@@ -77,10 +77,12 @@
<script>
import axios from 'axios'
import _ from "lodash";
import TranslationHelper from '../../../../Core/Assets/js/mixins/TranslationHelper'
let data;
export default {
mixins: [TranslationHelper],
data() {
return {
data,
......
......@@ -75,7 +75,7 @@
@endforeach
<script>
window.AsgardCMS = {
translations: {!! json_encode(['page' => trans('page::pages'), 'core' => trans('core::core')]) !!}
translations: {!! json_encode(['page' => array_dot(trans('page::pages')), 'core' => array_dot(trans('core::core'))]) !!}
};
window.locales = {!! json_encode(LaravelLocalization::getSupportedLocales()) !!}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment