Skip to content

Commit

Permalink
Added the FE method
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanhao Li authored and ifox committed Mar 2, 2020
1 parent 11a094b commit c1e59ba
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/js/components/media-library/MediaLibrary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@
props: {
modalTitlePrefix: {
type: String,
default: 'Media Library'
default: function () {
return this.$trans('media-library.title')
}
},
btnLabelSingle: {
type: String,
Expand Down
4 changes: 4 additions & 0 deletions frontend/js/plugins/A17Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import a17MediaLibrary from '@/components/media-library/MediaLibrary.vue'

// Plugins
import VueTimeago from 'vue-timeago'
import get from 'lodash/get'
import axios from 'axios'

// Directives
Expand Down Expand Up @@ -97,6 +98,9 @@ const A17Config = {
Vue.config.productionTip = isProd
Vue.config.devtools = true
Vue.prototype.$http = axios
Vue.prototype.$trans = function (string) {
return get(window[process.env.VUE_APP_NAME].lang, string)
}

axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'

Expand Down
3 changes: 3 additions & 0 deletions views/lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@
'cms-users' => 'CMS Users',
'settings' => 'Settings',
'logout' => 'Logout'
],
'media-library' => [
'title' => 'Media Library'
]
];
3 changes: 3 additions & 0 deletions views/lang/ja/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@
'cms-users' => 'ユーザー管理',
'settings' => '設定',
'logout' => 'ログアウト'
],
'media-library' => [
'title' => 'メディアライブラリ'
]
];

0 comments on commit c1e59ba

Please sign in to comment.