diff --git a/app/FileManagerFile.php b/app/FileManagerFile.php index ffdf9954..022c3047 100644 --- a/app/FileManagerFile.php +++ b/app/FileManagerFile.php @@ -31,7 +31,7 @@ class FileManagerFile extends Model */ public function getCreatedAtAttribute() { - return Carbon::create($this->attributes['created_at'])->format('j M Y \a\t H:i');; + return format_date($this->attributes['created_at'], __('vuefilemanager.time')); } /** @@ -43,7 +43,7 @@ class FileManagerFile extends Model { if (! $this->attributes['deleted_at']) return null; - return Carbon::create($this->attributes['deleted_at'])->format('j M Y at H:i'); + return format_date($this->attributes['deleted_at'], __('vuefilemanager.time')); } /** diff --git a/app/FileManagerFolder.php b/app/FileManagerFolder.php index ab6954cb..0a7fa78c 100644 --- a/app/FileManagerFolder.php +++ b/app/FileManagerFolder.php @@ -79,7 +79,7 @@ class FileManagerFolder extends Model */ public function getCreatedAtAttribute() { - return Carbon::create($this->attributes['created_at'])->format('j M Y \a\t H:i'); + return format_date($this->attributes['created_at'], __('vuefilemanager.time')); } /** @@ -91,7 +91,7 @@ class FileManagerFolder extends Model { if (! $this->attributes['deleted_at']) return null; - return Carbon::create($this->attributes['deleted_at'])->format('j M Y \a\t H:i'); + return format_date($this->attributes['deleted_at'], __('vuefilemanager.time')); } /** diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 4cab3791..98e6147a 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -43,7 +43,7 @@ class AuthController extends Controller ]; // Abort with 404, user not found - return abort('404', 'We can\'t find a user with that e-mail address.'); + return abort('404', __('vuefilemanager.user_not_fount')); } /** * Login user diff --git a/app/Http/Controllers/FileManagerController.php b/app/Http/Controllers/FileManagerController.php index e9144ced..350f593d 100644 --- a/app/Http/Controllers/FileManagerController.php +++ b/app/Http/Controllers/FileManagerController.php @@ -408,8 +408,10 @@ class FileManagerController extends Controller public function upload_item(Request $request) { // Check if user can upload - if (config('vuefilemanager.limit_storage_by_capacity') && user_storage_percentage() >= 100) + if (config('vuefilemanager.limit_storage_by_capacity') && user_storage_percentage() >= 100) { + abort(423, 'You exceed your storage limit!'); + } // Validate request $validator = Validator::make($request->all(), [ diff --git a/app/Http/Controllers/UserAccountController.php b/app/Http/Controllers/UserAccountController.php index f3e3e0de..d0c75f81 100644 --- a/app/Http/Controllers/UserAccountController.php +++ b/app/Http/Controllers/UserAccountController.php @@ -33,7 +33,6 @@ class UserAccountController extends Controller 'user' => $user->only(['name', 'email', 'avatar']), 'favourites' => $user->favourites->makeHidden(['pivot']), 'latest_uploads' => $user->latest_uploads->makeHidden(['user_id', 'basename']), - 'storage' => [ 'used' => Metric::bytes($user->used_capacity)->format(), 'capacity' => format_gigabytes(config('vuefilemanager.user_storage_capacity')), @@ -57,7 +56,7 @@ class UserAccountController extends Controller return [ [ 'unique_id' => 0, - 'name' => 'Home', + 'name' => __('vuefilemanager.home'), 'location' => 'base', 'folders' => $folders, ] diff --git a/app/Http/helpers.php b/app/Http/helpers.php index 989aa7e0..1435702a 100644 --- a/app/Http/helpers.php +++ b/app/Http/helpers.php @@ -1,6 +1,7 @@ toArray(), 'unique_id'); return appeared_once($folder_unique_ids); +} + +/** + * Format localized date + * + * @param $date + * @param string $format + * @return string + */ +function format_date($date, $format = '%d. %B. %Y, %H:%M') +{ + $start = Carbon::parse($date); + + return $start->formatLocalized($format); } \ No newline at end of file diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ee8ca5bc..bf6e052e 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,8 @@ namespace App\Providers; +use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -23,6 +25,11 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - // + Schema::defaultStringLength(191); + + $get_time_locale = App::getLocale() . '_' . mb_strtoupper(App::getLocale()); + + // Set locale for carbon dates + setlocale(LC_TIME, $get_time_locale); } } diff --git a/config/app.php b/config/app.php index 590f3253..1a2dc4c8 100644 --- a/config/app.php +++ b/config/app.php @@ -80,7 +80,7 @@ return [ | */ - 'locale' => 'en', + 'locale' => 'sk', /* |-------------------------------------------------------------------------- diff --git a/database/vue-file-manager-127.0.0.114-03-2020 b/database/vue-file-manager-127.0.0.114-03-2020 index 4474b73f..2b1248af 100644 --- a/database/vue-file-manager-127.0.0.114-03-2020 +++ b/database/vue-file-manager-127.0.0.114-03-2020 @@ -100,7 +100,7 @@ DROP TABLE IF EXISTS `migrations`; CREATE TABLE `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -137,7 +137,7 @@ CREATE TABLE `oauth_access_tokens` ( `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` bigint(20) unsigned DEFAULT NULL, `client_id` bigint(20) unsigned NOT NULL, - `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `scopes` text COLLATE utf8mb4_unicode_ci, `revoked` tinyint(1) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, @@ -175,7 +175,7 @@ DROP TABLE IF EXISTS `oauth_clients`; CREATE TABLE `oauth_clients` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `user_id` bigint(20) unsigned DEFAULT NULL, - `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `secret` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `redirect` text COLLATE utf8mb4_unicode_ci NOT NULL, `personal_access_client` tinyint(1) NOT NULL, @@ -234,8 +234,8 @@ CREATE TABLE `oauth_refresh_tokens` ( DROP TABLE IF EXISTS `password_resets`; CREATE TABLE `password_resets` ( - `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, KEY `password_resets_email_index` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -249,11 +249,11 @@ DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, - `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, - `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `avatar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, diff --git a/package-lock.json b/package-lock.json index 322fd3b6..345d98da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10216,6 +10216,11 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", "dev": true }, + "vue-i18n": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.16.0.tgz", + "integrity": "sha512-cp9JOsx4ETzlCsnD22FE8ZhAmD8kcyNLRKV0DPsS7bBNTCdIlOKuyTGonWKYcGCUtNMtwemDWRBevRm8eevBVg==" + }, "vue-loader": { "version": "15.9.0", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.0.tgz", diff --git a/package.json b/package.json index 9d7f2c79..9b60e6a4 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "node-sass": "^4.13.1", "vee-validate": "^3.2.5", "vue": "^2.6.10", + "vue-i18n": "^8.16.0", "vuex": "^3.0.1" } } diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 84307b4c..189353f3 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,40 @@ { "/js/main.js": "/js/main.js", - "/css/app.css": "/css/app.css" + "/css/app.css": "/css/app.css", + "/js/main.b199e742764976d477eb.hot-update.js": "/js/main.b199e742764976d477eb.hot-update.js", + "/js/main.74bd4021acf8f5e6f2c0.hot-update.js": "/js/main.74bd4021acf8f5e6f2c0.hot-update.js", + "/js/main.7751cc56f809bdcca52f.hot-update.js": "/js/main.7751cc56f809bdcca52f.hot-update.js", + "/js/main.6550285a609d98fd0a2c.hot-update.js": "/js/main.6550285a609d98fd0a2c.hot-update.js", + "/js/main.593b8d94aebec435eaa6.hot-update.js": "/js/main.593b8d94aebec435eaa6.hot-update.js", + "/js/main.9646136421cb914b9bc8.hot-update.js": "/js/main.9646136421cb914b9bc8.hot-update.js", + "/js/main.34d97ba06940b269e518.hot-update.js": "/js/main.34d97ba06940b269e518.hot-update.js", + "/js/main.93f2bdf89f84cfacf4f3.hot-update.js": "/js/main.93f2bdf89f84cfacf4f3.hot-update.js", + "/js/main.817de8c8f5fd813c607b.hot-update.js": "/js/main.817de8c8f5fd813c607b.hot-update.js", + "/js/main.963bfdadae1fb90e0238.hot-update.js": "/js/main.963bfdadae1fb90e0238.hot-update.js", + "/js/main.1512db5a6a7632fb9e8e.hot-update.js": "/js/main.1512db5a6a7632fb9e8e.hot-update.js", + "/js/main.3a19340ddc14dcc839a1.hot-update.js": "/js/main.3a19340ddc14dcc839a1.hot-update.js", + "/js/main.397553844e2b0ca23cc7.hot-update.js": "/js/main.397553844e2b0ca23cc7.hot-update.js", + "/js/main.c87eeede975b87bf2b16.hot-update.js": "/js/main.c87eeede975b87bf2b16.hot-update.js", + "/js/main.f580b09761154926899f.hot-update.js": "/js/main.f580b09761154926899f.hot-update.js", + "/js/main.91d490a5132517514bfb.hot-update.js": "/js/main.91d490a5132517514bfb.hot-update.js", + "/js/main.bdad4fbdd1e409eb4b21.hot-update.js": "/js/main.bdad4fbdd1e409eb4b21.hot-update.js", + "/js/main.48d106f956e2b5fecbb0.hot-update.js": "/js/main.48d106f956e2b5fecbb0.hot-update.js", + "/js/main.3f7d1e2b874ad885f9ba.hot-update.js": "/js/main.3f7d1e2b874ad885f9ba.hot-update.js", + "/js/main.be94f32edd036852aa82.hot-update.js": "/js/main.be94f32edd036852aa82.hot-update.js", + "/js/main.0b838845dace73e0df6d.hot-update.js": "/js/main.0b838845dace73e0df6d.hot-update.js", + "/js/main.aac07313ac3ce9a2e597.hot-update.js": "/js/main.aac07313ac3ce9a2e597.hot-update.js", + "/js/main.37168073afe720eff29e.hot-update.js": "/js/main.37168073afe720eff29e.hot-update.js", + "/js/main.1eafca2af4cbb4242c1f.hot-update.js": "/js/main.1eafca2af4cbb4242c1f.hot-update.js", + "/js/main.8f3db6ec42d42fa7152e.hot-update.js": "/js/main.8f3db6ec42d42fa7152e.hot-update.js", + "/js/main.3d0c0e744120bafa0076.hot-update.js": "/js/main.3d0c0e744120bafa0076.hot-update.js", + "/js/main.5bf20eacf51dd037796e.hot-update.js": "/js/main.5bf20eacf51dd037796e.hot-update.js", + "/js/main.bf91b39fc6ebda933d92.hot-update.js": "/js/main.bf91b39fc6ebda933d92.hot-update.js", + "/js/main.87b79f2adeaf95ca1eae.hot-update.js": "/js/main.87b79f2adeaf95ca1eae.hot-update.js", + "/js/main.caeb9ea0fe68c0e20cbc.hot-update.js": "/js/main.caeb9ea0fe68c0e20cbc.hot-update.js", + "/js/main.61e2b39b769cf182b833.hot-update.js": "/js/main.61e2b39b769cf182b833.hot-update.js", + "/js/main.ac3b225c09da944dd637.hot-update.js": "/js/main.ac3b225c09da944dd637.hot-update.js", + "/js/main.e90426301ffd1febd2e8.hot-update.js": "/js/main.e90426301ffd1febd2e8.hot-update.js", + "/js/main.ee9680aa2ebf66f438e2.hot-update.js": "/js/main.ee9680aa2ebf66f438e2.hot-update.js", + "/js/main.0af6eb46c23ed68de4db.hot-update.js": "/js/main.0af6eb46c23ed68de4db.hot-update.js", + "/js/main.7d6e0c7874e39ca5797d.hot-update.js": "/js/main.7d6e0c7874e39ca5797d.hot-update.js" } diff --git a/resources/js/components/VueFileManagerComponents/Auth.vue b/resources/js/components/VueFileManagerComponents/Auth.vue index 0c3eef72..8ab3e26b 100644 --- a/resources/js/components/VueFileManagerComponents/Auth.vue +++ b/resources/js/components/VueFileManagerComponents/Auth.vue @@ -4,23 +4,23 @@ -

Welcome Back!

-

Please type your email to log in:

+

{{ $t('page_login.title') }}

+

{{ $t('page_login.subtitle') }}

- {{ errors[0] }} - + - Don’t have an account? Register account. + {{ $t('page_login.registration_text') }} {{ $t('page_login.registration_button') }}
@@ -28,166 +28,166 @@
-

Are You {{ checkedAccount.name }}?

-

Confirm you by your password:

+

{{ $t('page_sign_in.title', {name: checkedAccount.name}) }}

+

{{ $t('page_sign_in.subtitle') }}

- {{ errors[0] }} - + - Forgotten your password? Reset Password. + {{ $t('page_sign_in.password_reset_text') }} {{ $t('page_sign_in.password_reset_button') }} -

Forgotten Password?

-

Get reset link with your email:

+

{{ $t('page_forgotten_password.title') }}

+

{{ $t('page_forgotten_password.subtitle') }}

- {{ errors[0] }} - + - Remember your password? Log In. + {{ $t('page_forgotten_password.password_remember_text') }} {{ $t('page_forgotten_password.password_remember_button') }}
-

Only One Step to Log In

-

Create your new password here:

+

{{ $t('page_create_password.title') }}

+

{{ $t('page_create_password.subtitle') }}

- + - {{ errors[0] }}
- + - {{ errors[0] }}
- + - {{ errors[0] }}
- +
- Remember your password? Log In. + {{ $t('page_forgotten_password.password_remember_text') }} {{ $t('page_forgotten_password.password_remember_button') }}
-

Create New Account

-

Please fill registration to create account:

+

{{ $t('page_registration.title') }}

+

{{ $t('page_registration.subtitle') }}

- + - {{ errors[0] }}
- + - {{ errors[0] }}
- + - {{ errors[0] }}
- + - {{ errors[0] }}
- +
- Do you have an account? Log In. + {{ $t('page_registration.have_an_account') }} {{ $t('page_forgotten_password.password_remember_button') }}
-

Thank you!

-

We have e-mailed your password reset link!

+

{{ $t('page_forgotten_password.pass_sennded_title') }}

+

{{ $t('page_forgotten_password.pass_sennded_subtitle') }}

- Remember your password? Log In. + {{ $t('page_forgotten_password.password_remember_text') }} {{ $t('page_forgotten_password.password_remember_button') }}
-

Awesome!

-

Your password was reset successfully.

+

{{ $t('page_forgotten_password.pass_reseted_title') }}

+

{{ $t('page_forgotten_password.pass_reseted_subtitle') }}

- +
@@ -320,7 +320,7 @@ if (error.response.status == 400) { this.$refs.sign_in.setErrors({ - 'User Password': ['Sorry, you passed incorrect password :('] + 'User Password': [this.$t('validation_errors.incorrect_password')] }); } @@ -460,7 +460,7 @@ let pathname = location.pathname.split('/')[1] let token = location.search.split('token=')[1] - if (pathname === 'create-new-password') { + if (pathname === this.$t('routes.create_new_password')) { this.recoverPassword.token = token this.goToAuthPage('create-new-password') } else { diff --git a/resources/js/components/VueFileManagerComponents/Auth/AuthContentWrapper.vue b/resources/js/components/VueFileManagerComponents/Auth/AuthContentWrapper.vue index f9a736f6..726eba35 100644 --- a/resources/js/components/VueFileManagerComponents/Auth/AuthContentWrapper.vue +++ b/resources/js/components/VueFileManagerComponents/Auth/AuthContentWrapper.vue @@ -5,7 +5,6 @@ diff --git a/resources/js/components/VueFileManagerComponents/Others/UserImageInput.vue b/resources/js/components/VueFileManagerComponents/Others/UserImageInput.vue index b4659674..c9c8f328 100644 --- a/resources/js/components/VueFileManagerComponents/Others/UserImageInput.vue +++ b/resources/js/components/VueFileManagerComponents/Others/UserImageInput.vue @@ -48,7 +48,7 @@ // Update user avatar this.$updateImage('/user/profile', 'avatar', event.target.files[0]) } else { - alert('You may have uploaded the wrong file, try again!') + alert( this.$t('validation_errors.wrong_image') ) } } }, diff --git a/resources/js/components/VueFileManagerComponents/Sidebar.vue b/resources/js/components/VueFileManagerComponents/Sidebar.vue index 1f43515f..40f5cc3f 100644 --- a/resources/js/components/VueFileManagerComponents/Sidebar.vue +++ b/resources/js/components/VueFileManagerComponents/Sidebar.vue @@ -9,11 +9,11 @@ @@ -33,10 +33,10 @@ @drop="dragFinish($event)" :class="{ 'is-dragenter': area }" > - Favourites + {{ $t('sidebar.favourites') }} -
  • Drag here your favourite - folder. +
  • + {{ $t('sidebar.favourites_empty') }}