Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
54bd1c31
Unverified
Commit
54bd1c31
authored
Sep 16, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setting up vue i18n
parent
b12bc6ea
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1450 additions
and
8 deletions
+1450
-8
app.js
public/js/app.js
+1428
-8
app.js
resources/assets/js/app.js
+22
-0
No files found.
public/js/app.js
View file @
54bd1c31
This diff is collapsed.
Click to expand it.
resources/assets/js/app.js
View file @
54bd1c31
require
(
'
./bootstrap
'
);
require
(
'
./bootstrap
'
);
import
Vue
from
'
vue
'
import
Vue
from
'
vue
'
import
VueI18n
from
'
vue-i18n
'
import
VueRouter
from
'
vue-router
'
import
VueRouter
from
'
vue-router
'
import
ElementUI
from
'
element-ui
'
import
ElementUI
from
'
element-ui
'
import
DataTables
from
'
vue-data-tables
'
import
DataTables
from
'
vue-data-tables
'
...
@@ -9,6 +10,7 @@ import locale from 'element-ui/lib/locale/lang/en'
...
@@ -9,6 +10,7 @@ import locale from 'element-ui/lib/locale/lang/en'
Vue
.
use
(
ElementUI
,
{
locale
});
Vue
.
use
(
ElementUI
,
{
locale
});
Vue
.
use
(
DataTables
,
{
locale
});
Vue
.
use
(
DataTables
,
{
locale
});
Vue
.
use
(
VueI18n
);
Vue
.
use
(
VueRouter
);
Vue
.
use
(
VueRouter
);
Vue
.
component
(
'
ckeditor
'
,
require
(
'
../../../Modules/Core/Assets/js/components/CkEditor.vue
'
));
Vue
.
component
(
'
ckeditor
'
,
require
(
'
../../../Modules/Core/Assets/js/components/CkEditor.vue
'
));
...
@@ -24,7 +26,27 @@ const router = new VueRouter({
...
@@ -24,7 +26,27 @@ const router = new VueRouter({
],
],
});
});
let
messages
=
{
[
currentLocale
]:
window
.
translations
,
};
console
.
log
(
messages
);
const
i18n
=
new
VueI18n
({
locale
:
currentLocale
,
messages
,
});
const
app
=
new
Vue
({
const
app
=
new
Vue
({
el
:
'
#app
'
,
el
:
'
#app
'
,
router
,
router
,
i18n
,
});
});
// window.axios.get(route('api.translation.translations.all'))
// .then(response => {
// messages = {
// [currentLocale]: response.data,
// };
// console.log(messages);
// app.$i18n.setLocaleMessage('en', messages)
// });
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment