diff --git a/app/Http/Middleware/Lang.php b/app/Http/Middleware/Lang.php index ae715f4..a0c85ab 100644 --- a/app/Http/Middleware/Lang.php +++ b/app/Http/Middleware/Lang.php @@ -15,7 +15,7 @@ class Lang */ public function handle($request, Closure $next) { - app()->setLocale(request('lang', session('lang'))); + app()->setLocale(request('lang', session('lang', 'id'))); if (request('lang')) { session(['lang' => request('lang')]); } diff --git a/resources/lang/en/app.php b/resources/lang/en/app.php index c4a08c2..4ac0bda 100644 --- a/resources/lang/en/app.php +++ b/resources/lang/en/app.php @@ -19,6 +19,7 @@ return [ // Actions 'edit' => 'Edit', + 'update' => 'Update', 'show_profile' => 'Show Profile', 'show_family_chart' => 'Show Family Chart', 'show_family_tree' => 'Show Family Tree', diff --git a/resources/lang/id/app.php b/resources/lang/id/app.php index f32f114..5f9ed76 100644 --- a/resources/lang/id/app.php +++ b/resources/lang/id/app.php @@ -19,6 +19,7 @@ return [ // Actions 'edit' => 'Edit', + 'update' => 'Update', 'show_profile' => 'Lihat Profil', 'show_family_chart' => 'Lihat Bagan Keluarga', 'show_family_tree' => 'Lihat Pohon Keluarga', diff --git a/tests/Feature/ManageUserFamiliesTest.php b/tests/Feature/ManageUserFamiliesTest.php index 22ca06f..5acc318 100644 --- a/tests/Feature/ManageUserFamiliesTest.php +++ b/tests/Feature/ManageUserFamiliesTest.php @@ -17,7 +17,7 @@ class ManageUserFamiliesTest extends TestCase $this->visit(route('profile')); $this->seePageIs(route('profile')); $this->dontSeeElement('input', ['name' => 'set_father']); - $this->click('Set Ayah'); + $this->click(trans('user.set_father')); $this->seePageIs(route('users.show', [$user->id, 'action' => 'set_father'])); $this->seeElement('input', ['name' => 'set_father']); @@ -39,7 +39,7 @@ class ManageUserFamiliesTest extends TestCase $this->visit(route('profile')); $this->seePageIs(route('profile')); $this->dontSeeElement('input', ['name' => 'set_mother']); - $this->click('Set Ibu'); + $this->click(trans('user.set_mother')); $this->seePageIs(route('users.show', [$user->id, 'action' => 'set_mother'])); $this->seeElement('input', ['name' => 'set_mother']); @@ -61,12 +61,12 @@ class ManageUserFamiliesTest extends TestCase $user = $this->loginAsUser(['gender_id' => 1]); $this->visit(route('profile')); $this->seePageIs(route('profile')); - $this->click('Tambah Anak'); + $this->click(trans('user.add_child')); $this->seeElement('input', ['name' => 'add_child_name']); $this->seeElement('input', ['name' => 'add_child_gender_id']); $this->seeElement('select', ['name' => 'add_child_parent_id']); - $this->submitForm('Tambah Anak', [ + $this->submitForm(trans('user.add_child'), [ 'add_child_name' => 'Nama Anak 1', 'add_child_gender_id' => 1, 'add_child_parent_id' => '', @@ -94,12 +94,12 @@ class ManageUserFamiliesTest extends TestCase $this->visit(route('profile')); $this->seePageIs(route('profile')); - $this->click('Tambah Anak'); + $this->click(trans('user.add_child')); $this->seeElement('input', ['name' => 'add_child_name']); $this->seeElement('input', ['name' => 'add_child_gender_id']); $this->seeElement('select', ['name' => 'add_child_parent_id']); - $this->submitForm('Tambah Anak', [ + $this->submitForm(trans('user.add_child'), [ 'add_child_name' => 'Nama Anak 1', 'add_child_gender_id' => 1, 'add_child_parent_id' => $marriageId, @@ -120,7 +120,7 @@ class ManageUserFamiliesTest extends TestCase $user = $this->loginAsUser(['gender_id' => 1]); $this->visit(route('profile')); $this->seePageIs(route('profile')); - $this->click('Tambah Isteri'); + $this->click(trans('user.add_wife')); $this->seeElement('input', ['name' => 'set_wife']); $this->submitForm('set_wife_button', [ @@ -146,7 +146,7 @@ class ManageUserFamiliesTest extends TestCase $user = $this->loginAsUser(['gender_id' => 2]); $this->visit(route('profile')); $this->seePageIs(route('profile')); - $this->click('Tambah Suami'); + $this->click(trans('user.add_husband')); $this->seeElement('input', ['name' => 'set_husband']); $this->submitForm('set_husband_button', [ @@ -176,7 +176,7 @@ class ManageUserFamiliesTest extends TestCase $this->visit(route('profile')); $this->seePageIs(route('profile')); $this->dontSeeElement('input', ['name' => 'set_father']); - $this->click('Set Ayah'); + $this->click(trans('user.set_father')); $this->seePageIs(route('users.show', [$user->id, 'action' => 'set_father'])); $this->seeElement('input', ['name' => 'set_father']); $this->seeElement('select', ['name' => 'set_father_id']); @@ -198,7 +198,7 @@ class ManageUserFamiliesTest extends TestCase $this->visit(route('profile')); $this->seePageIs(route('profile')); $this->dontSeeElement('input', ['name' => 'set_mother']); - $this->click('Set Ibu'); + $this->click(trans('user.set_mother')); $this->seePageIs(route('users.show', [$user->id, 'action' => 'set_mother'])); $this->seeElement('input', ['name' => 'set_mother']); $this->seeElement('select', ['name' => 'set_mother_id']); @@ -219,7 +219,7 @@ class ManageUserFamiliesTest extends TestCase $this->visit(route('profile')); $this->seePageIs(route('profile')); - $this->click('Tambah Isteri'); + $this->click(trans('user.add_wife')); $this->seeElement('input', ['name' => 'set_wife']); $this->seeElement('select', ['name' => 'set_wife_id']); @@ -242,7 +242,7 @@ class ManageUserFamiliesTest extends TestCase $this->visit(route('profile')); $this->seePageIs(route('profile')); - $this->click('Tambah Suami'); + $this->click(trans('user.add_husband')); $this->seeElement('input', ['name' => 'set_husband']); $this->seeElement('select', ['name' => 'set_husband_id']); diff --git a/tests/Feature/UsersProfileTest.php b/tests/Feature/UsersProfileTest.php index 771db08..85b6a03 100644 --- a/tests/Feature/UsersProfileTest.php +++ b/tests/Feature/UsersProfileTest.php @@ -25,7 +25,7 @@ class UsersProfileTest extends TestCase $this->visit(route('users.edit', $user->id)); $this->seePageIs(route('users.edit', $user->id)); - $this->submitForm('Update', [ + $this->submitForm(trans('app.update'), [ 'nickname' => 'Nama Panggilan', 'name' => 'Nama User', 'gender_id' => 1,