Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute names exported to external file #1862

Merged
merged 8 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/main/Concerns/Contains.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ protected function isMarkdown(string $filename): bool

protected function isValidation(string $filename): bool
{
return str_starts_with($filename, 'validation');
$names = ['validation.php', 'validation-inline.php'];

return in_array($filename, $names, true);
}
}
9 changes: 4 additions & 5 deletions app/main/Processors/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ protected function merge(array $source, array $target, string $filename): array
$this->sort($target);

if ($this->isValidation($filename)) {
$custom = $this->getFallbackValue($source, $target, 'custom');
$attributes = $this->getFallbackValue($source, $target, 'attributes');
$custom = $this->getFallbackValue($source, $target, 'custom');

$source = Arr::except($source, ['custom', 'attributes']);
$target = Arr::except($target, ['custom', 'attributes']);
$source = Arr::except($source, ['attributes', 'custom']);
$target = Arr::except($target, ['attributes', 'custom']);

return array_merge($source, $target, compact('custom', 'attributes'));
return array_merge($source, $target, compact('custom'));
}

return array_merge($source, $target);
Expand Down
11 changes: 6 additions & 5 deletions app/tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ protected function source(string $filename): array
$content = $this->isJsonFile($filename) ? $this->loadJson() : $this->loadFile($filename);

if ($this->isValidation($filename)) {
$custom = Arr::get($content, 'custom', []);
$attributes = Arr::get($content, 'attributes', []);
$custom = Arr::get($content, 'custom', []);

return Arrayable::of($content)
->except(['custom', 'attributes'])
->except(['attributes', 'custom'])
->ksort()
->merge(compact('custom', 'attributes'))
->merge(compact('custom'))
->get();
}

Expand Down Expand Up @@ -97,7 +96,9 @@ protected function locales(): array

protected function isValidation(string $filename): bool
{
return str_starts_with($filename, 'validation');
$names = ['validation.php', 'validation-inline.php'];

return in_array($filename, $names, true);
}

protected function isInline(string $filename): bool
Expand Down
4 changes: 2 additions & 2 deletions docs/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Completion status

> Translation of localizations is completed by **79%** (58.2K / 73.2K).
Translation of localizations is completed by **79%** (55.3K / 70.3K).

<table width="100%">
<tr><td align="center" width="17%">
Expand All @@ -12,7 +12,7 @@
</td>
<td align="center" width="17%">

[ar&nbsp;](statuses/ar.md)
[ar&nbsp;](statuses/ar.md)

</td>
<td align="center" width="17%">
Expand Down
39 changes: 39 additions & 0 deletions locales/af/validation-attributes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

return [
'attributes' => [
'address' => 'adres',
'age' => 'ouderdom',
'body' => 'liggaam',
'city' => 'stad',
'content' => 'inhoud',
'country' => 'land',
'date' => 'datum',
'day' => 'dag',
'description' => 'beskrywing',
'email' => 'epos',
'excerpt' => 'uittreksel',
'first_name' => 'naam',
'gender' => 'geslag',
'hour' => 'uur',
'last_name' => 'van',
'message' => 'boodskap',
'minute' => 'minuut',
'mobile' => 'mobiele',
'month' => 'maand',
'name' => 'naam',
'password' => 'wagwoord',
'password_confirmation' => 'bevestig_wagwoord',
'phone' => 'telefoon',
'price' => 'prys',
'role' => 'rol',
'second' => 'sekonde',
'sex' => 'geslag',
'subject' => 'onderwerp',
'terms' => 'terme',
'time' => 'tyd',
'title' => 'titel',
'username' => 'gebruikersnaam',
'year' => 'jaar',
],
];
1 change: 0 additions & 1 deletion locales/af/validation-inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,4 @@
'rule-name' => 'custom-message',
],
],
'attributes' => [],
];
35 changes: 0 additions & 35 deletions locales/af/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,39 +130,4 @@
'rule-name' => 'custom-message',
],
],
'attributes' => [
'address' => 'adres',
'age' => 'ouderdom',
'body' => 'liggaam',
'city' => 'stad',
'content' => 'inhoud',
'country' => 'land',
'date' => 'datum',
'day' => 'dag',
'description' => 'beskrywing',
'email' => 'epos',
'excerpt' => 'uittreksel',
'first_name' => 'naam',
'gender' => 'geslag',
'hour' => 'uur',
'last_name' => 'van',
'message' => 'boodskap',
'minute' => 'minuut',
'mobile' => 'mobiele',
'month' => 'maand',
'name' => 'naam',
'password' => 'wagwoord',
'password_confirmation' => 'bevestig_wagwoord',
'phone' => 'telefoon',
'price' => 'prys',
'role' => 'rol',
'second' => 'sekonde',
'sex' => 'geslag',
'subject' => 'onderwerp',
'terms' => 'terme',
'time' => 'tyd',
'title' => 'titel',
'username' => 'gebruikersnaam',
'year' => 'jaar',
],
];
35 changes: 35 additions & 0 deletions locales/ar/validation-attributes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

return [
'attributes' => [
'address' => 'العنوان',
'age' => 'العمر',
'available' => 'مُتاح',
'city' => 'المدينة',
'content' => 'المُحتوى',
'country' => 'الدولة',
'date' => 'التاريخ',
'day' => 'اليوم',
'description' => 'الوصف',
'email' => 'البريد الالكتروني',
'excerpt' => 'المُلخص',
'first_name' => 'الاسم الأول',
'gender' => 'النوع',
'hour' => 'ساعة',
'last_name' => 'اسم العائلة',
'minute' => 'دقيقة',
'mobile' => 'الجوال',
'month' => 'الشهر',
'name' => 'الاسم',
'password' => 'كلمة المرور',
'password_confirmation' => 'تأكيد كلمة المرور',
'phone' => 'الهاتف',
'second' => 'ثانية',
'sex' => 'الجنس',
'size' => 'الحجم',
'time' => 'الوقت',
'title' => 'العنوان',
'username' => 'اسم المُستخدم',
'year' => 'السنة',
],
];
1 change: 0 additions & 1 deletion locales/ar/validation-inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,4 @@
'rule-name' => 'custom-message',
],
],
'attributes' => [],
];
31 changes: 0 additions & 31 deletions locales/ar/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,35 +130,4 @@
'rule-name' => 'custom-message',
],
],
'attributes' => [
'address' => 'العنوان',
'age' => 'العمر',
'available' => 'مُتاح',
'city' => 'المدينة',
'content' => 'المُحتوى',
'country' => 'الدولة',
'date' => 'التاريخ',
'day' => 'اليوم',
'description' => 'الوصف',
'email' => 'البريد الالكتروني',
'excerpt' => 'المُلخص',
'first_name' => 'الاسم الأول',
'gender' => 'النوع',
'hour' => 'ساعة',
'last_name' => 'اسم العائلة',
'minute' => 'دقيقة',
'mobile' => 'الجوال',
'month' => 'الشهر',
'name' => 'الاسم',
'password' => 'كلمة المرور',
'password_confirmation' => 'تأكيد كلمة المرور',
'phone' => 'الهاتف',
'second' => 'ثانية',
'sex' => 'الجنس',
'size' => 'الحجم',
'time' => 'الوقت',
'title' => 'العنوان',
'username' => 'اسم المُستخدم',
'year' => 'السنة',
],
];
36 changes: 36 additions & 0 deletions locales/az/validation-attributes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

return [
'attributes' => [
'address' => 'Ünvan',
'age' => 'Yaş',
'available' => 'Əlçatandır',
'city' => 'Şəhər',
'content' => 'Məzmun',
'country' => 'Şəhər',
'current_password' => 'Cari şifrə',
'date' => 'Tarix',
'day' => 'Gün',
'description' => 'Təsvir',
'email' => 'E-poçt ünvanı',
'excerpt' => 'Çıxarış',
'first_name' => 'Ad',
'gender' => 'Gender',
'hour' => 'Saat',
'last_name' => 'Soyad',
'minute' => 'Dəqiqə',
'mobile' => 'Mobil nömrə',
'month' => 'Ay',
'name' => 'Ad',
'password' => 'Şifrə',
'password_confirmation' => 'Şifrə təsdiqi',
'phone' => 'Telefon',
'second' => 'Saniyə',
'sex' => 'Cins',
'size' => 'Ölçü',
'time' => 'Vaxt',
'title' => 'Başlıq',
'username' => 'İstifadəçi adı',
'year' => 'İl',
],
];
1 change: 0 additions & 1 deletion locales/az/validation-inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,4 @@
'rule-name' => 'custom-message',
],
],
'attributes' => [],
];
32 changes: 0 additions & 32 deletions locales/az/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,36 +130,4 @@
'rule-name' => 'custom-message',
],
],
'attributes' => [
'address' => 'Ünvan',
'age' => 'Yaş',
'available' => 'Əlçatandır',
'city' => 'Şəhər',
'content' => 'Məzmun',
'country' => 'Şəhər',
'current_password' => 'Cari şifrə',
'date' => 'Tarix',
'day' => 'Gün',
'description' => 'Təsvir',
'email' => 'E-poçt ünvanı',
'excerpt' => 'Çıxarış',
'first_name' => 'Ad',
'gender' => 'Gender',
'hour' => 'Saat',
'last_name' => 'Soyad',
'minute' => 'Dəqiqə',
'mobile' => 'Mobil nömrə',
'month' => 'Ay',
'name' => 'Ad',
'password' => 'Şifrə',
'password_confirmation' => 'Şifrə təsdiqi',
'phone' => 'Telefon',
'second' => 'Saniyə',
'sex' => 'Cins',
'size' => 'Ölçü',
'time' => 'Vaxt',
'title' => 'Başlıq',
'username' => 'İstifadəçi adı',
'year' => 'İl',
],
];
40 changes: 40 additions & 0 deletions locales/be/validation-attributes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

return [
'attributes' => [
'address' => 'Address',
'age' => 'Age',
'body' => 'Body',
'city' => 'City',
'content' => 'Content',
'country' => 'Country',
'date' => 'Date',
'day' => 'Day',
'description' => 'Description',
'email' => 'Email',
'excerpt' => 'Excerpt',
'first_name' => 'First Name',
'gender' => 'Gender',
'hour' => 'Hour',
'last_name' => 'Last Name',
'message' => 'Message',
'minute' => 'Minute',
'mobile' => 'Mobile',
'month' => 'Month',
'name' => 'Name',
'password' => 'Password',
'password_confirmation' => 'Password Confirmation',
'phone' => 'Phone',
'photo' => 'Photo',
'price' => 'Price',
'role' => 'Role',
'second' => 'Second',
'sex' => 'Sex',
'subject' => 'Subject',
'terms' => 'Terms',
'time' => 'Time',
'title' => 'Title',
'username' => 'Username',
'year' => 'Year',
],
];
1 change: 0 additions & 1 deletion locales/be/validation-inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,4 @@
'rule-name' => 'custom-message',
],
],
'attributes' => [],
];
Loading