-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from Laravel-Lang/1.x
Fixed a bug with processing dynamic names when translating
- Loading branch information
Showing
20 changed files
with
204 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
"Administrator", | ||
"This field must be accepted.", | ||
"The :attribute must be accepted." | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"Added.": "Added.", | ||
"Administrator": "Administrator", | ||
"Foo": "Foo", | ||
"Bar.": "Bar.", | ||
"Uploading files... (:current/:total)": "Uploading files... (:current/:total)" | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/Fixtures/Resources/Translate/locales/ar/php-inline.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"accepted": "This field must be accepted.", | ||
"accepted_if": "This field must be accepted when :other is :value.", | ||
"active_url": "This field is not a valid URL.", | ||
"custom2": "Custom field 2", | ||
"sub.array2": "Sub Array 2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"0": "Numeric Zero", | ||
"10": "Numeric Ten", | ||
"100": "Numeric One Hundred", | ||
"accepted": "The :attribute must be accepted.", | ||
"accepted_if": "The :attribute must be accepted when :other is :value.", | ||
"active_url": "The :attribute is not a valid URL.", | ||
"custom": "Custom field", | ||
"sub.array": "Sub Array" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
"Administrator", | ||
"This field must be accepted.", | ||
"The :attribute must be accepted." | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"Added.": "Added.", | ||
"Administrator": "Administrator", | ||
"Foo": "Foo", | ||
"Bar.": "Bar.", | ||
"Uploading files... (:current/:total)": "Uploading files... (:current/:total)" | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/Fixtures/Resources/Translate/locales/es/php-inline.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"accepted": "This field must be accepted.", | ||
"accepted_if": "This field must be accepted when :other is :value.", | ||
"active_url": "This field is not a valid URL.", | ||
"custom2": "Custom field 2", | ||
"sub.array2": "Sub Array 2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"0": "Numeric Zero", | ||
"10": "Numeric Ten", | ||
"100": "Numeric One Hundred", | ||
"accepted": "The :attribute must be accepted.", | ||
"accepted_if": "The :attribute must be accepted when :other is :value.", | ||
"active_url": "The :attribute is not a valid URL.", | ||
"custom": "Custom field", | ||
"sub.array": "Sub Array" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"Added.": "Added.", | ||
"Administrator": "Administrator" | ||
"Administrator": "Administrator", | ||
"Uploading files... (:current/:total)": "Uploading files... (:current/:total)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Unit\Commands\Translate; | ||
|
||
/** | ||
* @group Translate | ||
*/ | ||
class ArabicTest extends Base | ||
{ | ||
public function testJson(): void | ||
{ | ||
$this->assertJsonFileEqualsJson([ | ||
'Added.' => 'مضاف.', | ||
'Administrator' => 'Administrator', | ||
|
||
'Uploading files... (:current/:total)' => 'جاري تحميل الملفات ... (:current/:total)', | ||
], 'locales/ar/json.json', __FUNCTION__); | ||
} | ||
|
||
public function testPhp(): void | ||
{ | ||
$values = $this->filesystem->load($this->tempPath('locales/ar/php.json')); | ||
|
||
$this->assertContainsEquals($values[0], ['رقمي صفر']); | ||
$this->assertContainsEquals($values[10], ['رقم عشرة']); | ||
$this->assertContainsEquals($values[100], ['مائة رقمية']); | ||
|
||
$this->assertSame($values['accepted'], 'The :attribute must be accepted.'); | ||
|
||
$this->assertContainsEquals($values['accepted_if'], ['يجب قبول :attribute عندما تكون :other هي :value.', 'يجب قبول :attribute عندما يكون :other هو :value.']); | ||
|
||
$this->assertContainsEquals($values['active_url'], [':attribute ليس عنوان URL صالحًا.']); | ||
|
||
$this->assertContainsEquals($values['between.array'], ['The :attribute must have between :min and :max items.']); | ||
$this->assertContainsEquals($values['between.file'], ['The :attribute must be between :min and :max kilobytes.']); | ||
} | ||
|
||
public function testPhpInline(): void | ||
{ | ||
$values = $this->filesystem->load($this->tempPath('locales/ar/php-inline.json')); | ||
|
||
$this->assertSame($values['accepted'], 'This field must be accepted.'); | ||
|
||
$this->assertContainsEquals($values['accepted_if'], ['يجب قبول هذا الحقل عندما يكون :other هو :value.']); | ||
|
||
$this->assertContainsEquals($values['active_url'], ['هذا الحقل ليس عنوان URL صالحًا.']); | ||
|
||
$this->assertContainsEquals($values['between.array'], ['This field must have between :min and :max items.']); | ||
$this->assertContainsEquals($values['between.file'], ['This field must be between :min and :max kilobytes.']); | ||
} | ||
|
||
public function testExcludes(): void | ||
{ | ||
$this->assertFileExists($this->tempPath('locales/ar/_excludes.json')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Unit\Commands\Translate; | ||
|
||
/** | ||
* @group Translate | ||
*/ | ||
class SpanishTest extends Base | ||
{ | ||
public function testJson(): void | ||
{ | ||
$this->assertJsonFileEqualsJson([ | ||
'Added.' => 'Agregado.', | ||
'Administrator' => 'Administrator', | ||
|
||
'Uploading files... (:current/:total)' => 'Subiendo archivos... (:current/:total)', | ||
], 'locales/es/json.json', __FUNCTION__); | ||
} | ||
|
||
public function testPhp(): void | ||
{ | ||
$values = $this->filesystem->load($this->tempPath('locales/es/php.json')); | ||
|
||
$this->assertContainsEquals($values[0], ['Cero numérico', 'cero numérico']); | ||
$this->assertContainsEquals($values[10], ['Numérico Diez']); | ||
$this->assertContainsEquals($values[100], ['Cent numérique', 'Numérico Cien']); | ||
|
||
$this->assertSame($values['accepted'], 'The :attribute must be accepted.'); | ||
|
||
$this->assertContainsEquals( | ||
$values['accepted_if'], | ||
['El campo :attribute debe ser aceptado cuando :other sea :value.', 'El :attribute debe aceptarse cuando :other es :value.'] | ||
); | ||
|
||
$this->assertContainsEquals($values['active_url'], ['El campo :attribute debe ser una URL válida.', 'El :attribute no es una URL válida.']); | ||
|
||
$this->assertContainsEquals($values['between.array'], ['The :attribute must have between :min and :max items.']); | ||
$this->assertContainsEquals($values['between.file'], ['The :attribute must be between :min and :max kilobytes.']); | ||
} | ||
|
||
public function testPhpInline(): void | ||
{ | ||
$values = $this->filesystem->load($this->tempPath('locales/es/php-inline.json')); | ||
|
||
$this->assertSame($values['accepted'], 'This field must be accepted.'); | ||
|
||
$this->assertContainsEquals($values['accepted_if'], ['Este campo debe ser aceptado cuando :other sea :value.', 'Este campo debe aceptarse cuando :other es :value.']); | ||
|
||
$this->assertContainsEquals($values['active_url'], ['Este campo debe ser una URL válida.', 'Este campo no es una URL válida.']); | ||
|
||
$this->assertContainsEquals($values['between.array'], ['This field must have between :min and :max items.']); | ||
$this->assertContainsEquals($values['between.file'], ['This field must be between :min and :max kilobytes.']); | ||
} | ||
|
||
public function testExcludes(): void | ||
{ | ||
$this->assertFileExists($this->tempPath('locales/es/_excludes.json')); | ||
} | ||
} |