Skip to content

Commit 598bae7

Browse files
committed
Add translations to vue files
1 parent 791cbaa commit 598bae7

File tree

14 files changed

+178
-29
lines changed

14 files changed

+178
-29
lines changed

BUILDING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Building Assets
2+
3+
```
4+
yarn install
5+
6+
php artisan vue-i18n:generate
7+
php artisan ziggy:generate resources/assets/pterodactyl/scripts/helpers/ziggy.js
8+
9+
npm run build
10+
```

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"filp/whoops": "^2.1",
4949
"friendsofphp/php-cs-fixer": "^2.8.0",
5050
"fzaninotto/faker": "^1.6",
51+
"martinlindhe/laravel-vue-i18n-generator": "^0.1.28",
5152
"mockery/mockery": "^1.0",
5253
"php-mock/php-mock-phpunit": "^2.0",
5354
"phpunit/phpunit": "~6.4.0",

composer.lock

Lines changed: 54 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/vue-i18n-generator.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
return [
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Laravel translations path
7+
|--------------------------------------------------------------------------
8+
|
9+
| The default path where the translations are stored by Laravel.
10+
| Note: the path will be prepended to point to the App directory.
11+
|
12+
*/
13+
14+
'langPath' => '/resources/lang',
15+
16+
/*
17+
|--------------------------------------------------------------------------
18+
| Laravel translation files
19+
|--------------------------------------------------------------------------
20+
|
21+
| You can choose which translation files to be generated.
22+
| Note: leave this empty for all the translation files to be generated.
23+
|
24+
*/
25+
26+
'langFiles' => [],
27+
28+
/*
29+
|--------------------------------------------------------------------------
30+
| Output file
31+
|--------------------------------------------------------------------------
32+
|
33+
| The javascript path where I will place the generated file.
34+
| Note: the path will be prepended to point to the App directory.
35+
|
36+
*/
37+
'jsPath' => '/resources/i18n/lang',
38+
'jsFile' => '/resources/i18n/locales.js',
39+
40+
/*
41+
|--------------------------------------------------------------------------
42+
| i18n library
43+
|--------------------------------------------------------------------------
44+
|
45+
| Specify the library you use for localization.
46+
| Options are vue-i18n or vuex-i18n.
47+
|
48+
*/
49+
'i18nLib' => 'vuex-i18n',
50+
];

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function scripts() {
6464
* Provides watchers.
6565
*/
6666
function watch() {
67-
gulp.watch(paths.styles.src, gulp.series(function cleanStyles() {
67+
gulp.watch(['./resources/assets/pterodactyl/styles/**/*.css'], gulp.series(function cleanStyles() {
6868
return del(['./public/assets/css/**/*.css']);
6969
}, styles));
7070

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
"vue-router": "^3.0.1",
3838
"vue-template-compiler": "^2.5.16",
3939
"vueify-insert-css": "^1.0.0",
40+
"vuex": "^3.0.1",
41+
"vuex-i18n": "^1.10.5",
4042
"webpack": "^4.4.1",
4143
"webpack-stream": "^4.0.3",
4244
"yargs": "^11.0.0"
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
import Vue from 'vue';
2+
import Vuex from 'vuex';
3+
import vuexI18n from 'vuex-i18n';
24
import VueRouter from 'vue-router';
5+
6+
// Helpers
37
import { Ziggy } from './helpers/ziggy';
8+
import Locales from './../../../../resources/i18n/locales';
49

510
// Base Vuejs Templates
611
import Login from './components/auth/Login';
712

8-
/**
9-
* First we will load all of this project's JavaScript dependencies which
10-
* includes Vue and other libraries. It is a great starting point when
11-
* building robust, powerful web applications using Vue and Laravel.
12-
*/
13-
14-
require('./bootstrap');
15-
13+
// Used for the route() helper.
1614
window.Ziggy = Ziggy;
1715

18-
/**
19-
* Next, we will create a fresh Vue application instance and attach it to
20-
* the page. Then, you may begin adding components to this application
21-
* or customize the JavaScript scaffolding to fit your unique needs.
22-
*/
16+
Vue.use(Vuex);
2317

18+
const store = new Vuex.Store();
2419
const route = require('./../../../../vendor/tightenco/ziggy/src/js/route').default;
2520

2621
Vue.config.productionTip = false;
@@ -31,6 +26,10 @@ Vue.mixin({
3126
});
3227

3328
Vue.use(VueRouter);
29+
Vue.use(vuexI18n.plugin, store);
30+
31+
Vue.i18n.add('en', Locales.en);
32+
Vue.i18n.set('en');
3433

3534
const router = new VueRouter({
3635
routes: [
@@ -41,6 +40,9 @@ const router = new VueRouter({
4140
]
4241
});
4342

43+
require('./bootstrap');
44+
4445
const app = new Vue({
46+
store,
4547
router,
4648
}).$mount('#pterodactyl');

resources/assets/pterodactyl/scripts/components/auth/ForgotPassword.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,22 @@
33
<form class="bg-white shadow-lg rounded-lg pt-10 px-8 pb-6 mb-4 animate fadein" method="post">
44
<div class="flex flex-wrap -mx-3 mb-6">
55
<div class="input-open">
6-
<input class="input" id="grid-email" type="text" aria-labelledby="grid-email" required
6+
<input class="input" id="grid-email" type="email" aria-labelledby="grid-email" required
77
v-bind:value="email"
88
v-on:input="updateEmail($event)"
99
/>
10-
<label for="grid-email">Email</label>
11-
<p class="text-grey-darker text-xs">Enter your account email address to recive instructions on resetting your password.</p>
10+
<label for="grid-email">{{ $t('strings.email') }}</label>
11+
<p class="text-grey-darker text-xs">{{ $t('auth.reset_help_text') }}</p>
1212
</div>
1313
</div>
1414
<div>
15-
<button class="bg-blue hover:bg-blue-dark hover:border-blue-darker border-blue-dark border text-white p-4 rounded w-full uppercase tracking-wide text-sm"
16-
type="submit">
17-
Recover Account
15+
<button class="btn btn-blue btn-jumbo" type="submit">
16+
{{ $t('auth.recover_account') }}
1817
</button>
1918
</div>
2019
<div class="pt-6 text-center">
2120
<router-link to="/" class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark">
22-
Go to Login
21+
{{ $t('auth.go_to_login') }}
2322
</router-link>
2423
</div>
2524
</form>

resources/assets/pterodactyl/scripts/components/auth/LoginForm.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77
v-bind:value="email"
88
v-on:input="updateEmail($event)"
99
/>
10-
<label for="grid-username">Username or Email</label>
10+
<label for="grid-username">{{ $t('strings.user_identifier') }}</label>
1111
</div>
1212
</div>
1313
<div class="flex flex-wrap -mx-3 mb-6">
1414
<div class="input-open">
1515
<input class="input" id="grid-password" type="password" name="password" aria-labelledby="grid-password" required>
16-
<label for="grid-password">Password</label>
16+
<label for="grid-password">{{ $t('strings.password') }}</label>
1717
</div>
1818
</div>
1919
<div>
20-
<button class="bg-blue hover:bg-blue-dark hover:border-blue-darker border-blue-dark border text-white p-4 rounded w-full uppercase tracking-wide text-sm" type="submit">
21-
Sign In
20+
<button class="btn btn-blue btn-jumbo" type="submit">
21+
{{ $t('auth.sign_in') }}
2222
</button>
2323
</div>
2424
<div class="pt-6 text-center">
2525
<router-link to="/forgot-password" class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark">
26-
Forgot Password?
26+
{{ $t('auth.forgot_password') }}
2727
</router-link>
2828
</div>
2929
</form>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.btn {
2+
@apply .rounded;
3+
4+
/**
5+
* Button Colors
6+
*/
7+
&.btn-blue {
8+
@apply .bg-blue .border-blue-dark .border .text-white;
9+
10+
&:hover {
11+
@apply .bg-blue-dark .border-blue-darker;
12+
}
13+
}
14+
15+
/**
16+
* Button Sizes
17+
*/
18+
&.btn-jumbo {
19+
@apply .p-4 .w-full .uppercase .tracking-wide .text-sm;
20+
}
21+
}

0 commit comments

Comments
 (0)