From c0db7efa80f4b949a192dd540f642a5d6945ca34 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Thu, 4 Jan 2018 11:34:41 +0800 Subject: [PATCH] Small improvement on sidebar lang switcher Add lang switcher tooltip and disabled button attribute to selected lang Fix some missing customer lang value --- resources/lang/en/customer.php | 3 ++- resources/lang/en/lang.php | 7 ++++--- resources/lang/id/customer.php | 19 +++++++++---------- resources/lang/id/lang.php | 7 ++++--- resources/views/layouts/partials/sidebar.blade.php | 19 +++++++++++++++---- 5 files changed, 34 insertions(+), 21 deletions(-) diff --git a/resources/lang/en/customer.php b/resources/lang/en/customer.php index 824133a..ef3617d 100644 --- a/resources/lang/en/customer.php +++ b/resources/lang/en/customer.php @@ -5,11 +5,12 @@ return [ 'customer' => 'Customer', 'list' => 'Customer List', 'search' => 'Search Customer', - 'detail' => 'Customer Detail', 'not_found' => 'Customer not found.', 'empty' => 'Customer is empty.', 'back_to_show' => 'Back to Customer Detail', 'back_to_index' => 'Back to Customer List', + 'detail' => 'Customer Detail', + 'contact' => 'Customer Contact', // Actions 'create' => 'Create new Customer', diff --git a/resources/lang/en/lang.php b/resources/lang/en/lang.php index c5ed2da..b6a1bd1 100644 --- a/resources/lang/en/lang.php +++ b/resources/lang/en/lang.php @@ -1,7 +1,8 @@ 'Language', - 'en' => 'English', - 'id' => 'Bahasa', + 'lang' => 'Language', + 'switch_tooltip' => 'Switch language to :lang', + 'en' => 'English', + 'id' => 'Bahasa', ]; diff --git a/resources/lang/id/customer.php b/resources/lang/id/customer.php index 09fceb6..5364599 100644 --- a/resources/lang/id/customer.php +++ b/resources/lang/id/customer.php @@ -2,16 +2,15 @@ return [ // Labels - 'customer' => 'Customer', - 'list' => 'Daftar Customer', - 'search' => 'Cari Customer', - 'not_found' => 'Customer tidak ditemukan', - 'empty' => 'Belum ada Customer', - 'back_to_show' => 'Kembali ke detail Customer', - 'back_to_index' => 'Kembali ke daftar Customer', - 'type' => 'Jenis Customer', - 'detail' => 'Detail Customer', - 'contact' => 'Kontak Customer', + 'customer' => 'Customer', + 'list' => 'Daftar Customer', + 'search' => 'Cari Customer', + 'not_found' => 'Customer tidak ditemukan', + 'empty' => 'Belum ada Customer', + 'back_to_show' => 'Kembali ke detail Customer', + 'back_to_index' => 'Kembali ke daftar Customer', + 'detail' => 'Detail Customer', + 'contact' => 'Kontak Customer', // Actions 'create' => 'Input Customer Baru', diff --git a/resources/lang/id/lang.php b/resources/lang/id/lang.php index 09c616c..49af53d 100644 --- a/resources/lang/id/lang.php +++ b/resources/lang/id/lang.php @@ -1,7 +1,8 @@ 'Bahasa', - 'en' => 'Bahasa Inggris', - 'id' => 'Bahasa Indonesia', + 'lang' => 'Bahasa', + 'switch_tooltip' => 'Ubah bahasa ke :lang', + 'en' => 'Bahasa Inggris', + 'id' => 'Bahasa Indonesia', ]; diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index cd89669..8bd3986 100755 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -14,16 +14,27 @@
{{ config('app.name') }}
+ {{ trans('lang.lang') }} : {!! FormField::formButton( - ['route' => 'users.profile.switch-lang', 'method' => 'patch'], + [ + 'route' => 'users.profile.switch-lang', + 'method' => 'patch', + 'title' => auth()->user()->lang != 'en' ? trans('lang.switch_tooltip', ['lang' => trans('lang.en')]) : '' + ], 'EN', - ['class' => 'btn btn-default btn-xs', 'id' => 'switch_lang_en'], + ['class' => 'btn btn-default btn-xs', 'id' => 'switch_lang_en'] + + (auth()->user()->lang == 'en' ? ['disabled' => 'disabled'] : []), ['lang' => 'en'] ) !!} {!! FormField::formButton( - ['route' => 'users.profile.switch-lang', 'method' => 'patch'], + [ + 'route' => 'users.profile.switch-lang', + 'method' => 'patch', + 'title' => auth()->user()->lang != 'id' ? trans('lang.switch_tooltip', ['lang' => trans('lang.id')]) : '' + ], 'ID', - ['class' => 'btn btn-default btn-xs', 'id' => 'switch_lang_id'], + ['class' => 'btn btn-default btn-xs', 'id' => 'switch_lang_id'] + + (auth()->user()->lang == 'id' ? ['disabled' => 'disabled'] : []), ['lang' => 'id'] ) !!}