From 33cdb83138b1aa0b310462d545dae44f4d81bfb7 Mon Sep 17 00:00:00 2001 From: slaubi Date: Wed, 1 Sep 2021 14:11:44 +0200 Subject: [PATCH] danish language added --- README.md | 3 ++- composer.json | 1 + src/Services/Poliglottas/Danish.php | 25 +++++++++++++++++++ src/Services/TranslationAgency.php | 3 +++ tests/Geographer/Languages/DanishTest.php | 29 +++++++++++++++++++++++ tests/Geographer/Languages/DutchTest.php | 3 +-- 6 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 src/Services/Poliglottas/Danish.php create mode 100644 tests/Geographer/Languages/DanishTest.php diff --git a/README.md b/README.md index 2b68f91..44676fe 100644 --- a/README.md +++ b/README.md @@ -225,7 +225,8 @@ attempt to use a non-existing language – expect an exception. | Italian | ✓ | ✓ | ✓ | [geographer-it](https://github.com/MenaraSolutions/geographer-it) | | French | ✓ | ✓ | ✓ | [geographer-fr](https://github.com/MenaraSolutions/geographer-fr) | | German | ✓ | ✓ | ✓ | [geographer-de](https://github.com/MenaraSolutions/geographer-de) | -| Chinese Mandarin | ✓ | ✓ | ✓ | [geographer-zh](https://github.com/MenaraSolutions/geographer-zh) | +| Chinese Mandarin | ✓ | ✓ | ✓ | [geographer-zh](https://github.com/MenaraSolutions/geographer-zh) | +| Danish | ✓ | - | - | [geographer-da](https://github.com/MenaraSolutions/geographer-da) | English texts are included in the data package and are used as default metadata. diff --git a/composer.json b/composer.json index 052d28e..9df33ce 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "phpunit/phpunit": "4.*|5.*", "codeclimate/php-test-reporter": "dev-master", "illuminate/support": "5.*", + "menarasolutions/geographer-da": "0.*", "menarasolutions/geographer-de": "0.*", "menarasolutions/geographer-ru": "0.*", "menarasolutions/geographer-nl": "0.*" diff --git a/src/Services/Poliglottas/Danish.php b/src/Services/Poliglottas/Danish.php new file mode 100644 index 0000000..a5c5286 --- /dev/null +++ b/src/Services/Poliglottas/Danish.php @@ -0,0 +1,25 @@ + 'fra', + 'in' => 'i' + ]; +} diff --git a/src/Services/TranslationAgency.php b/src/Services/TranslationAgency.php index b4b8f78..8c4ef6d 100644 --- a/src/Services/TranslationAgency.php +++ b/src/Services/TranslationAgency.php @@ -7,6 +7,7 @@ use MenaraSolutions\Geographer\Contracts\RepositoryInterface; use MenaraSolutions\Geographer\Contracts\TranslationAgencyInterface; use MenaraSolutions\Geographer\Exceptions\MisconfigurationException; +use MenaraSolutions\Geographer\Services\Poliglottas\Danish; use MenaraSolutions\Geographer\Services\Poliglottas\Dutch; use MenaraSolutions\Geographer\Services\Poliglottas\French; use MenaraSolutions\Geographer\Services\Poliglottas\German; @@ -60,6 +61,7 @@ class TranslationAgency implements TranslationAgencyInterface const LANG_UKRAINIAN = 'uk'; const LANG_GERMAN = 'de'; const LANG_DUTCH = 'nl'; + const LANG_DANISH = 'da'; /** * Constants for available forms @@ -83,6 +85,7 @@ class TranslationAgency implements TranslationAgencyInterface self::LANG_UKRAINIAN => Ukrainian::class, self::LANG_GERMAN => German::class, self::LANG_DUTCH => Dutch::class, + self::LANG_DANISH => Danish::class, ]; /** diff --git a/tests/Geographer/Languages/DanishTest.php b/tests/Geographer/Languages/DanishTest.php new file mode 100644 index 0000000..7bfa06b --- /dev/null +++ b/tests/Geographer/Languages/DanishTest.php @@ -0,0 +1,29 @@ +getCountries(); + + foreach($countries as $country) { + $this->assertNotEquals($country->setLocale($this->languageCode)->getName(), $country->setLocale('en')->getName()); + } + } +} diff --git a/tests/Geographer/Languages/DutchTest.php b/tests/Geographer/Languages/DutchTest.php index c437d1a..2af1821 100644 --- a/tests/Geographer/Languages/DutchTest.php +++ b/tests/Geographer/Languages/DutchTest.php @@ -5,7 +5,7 @@ use Tests\Test; use MenaraSolutions\Geographer\Earth; -class RussianTest extends Test +class DutchTest extends Test { protected $forms = ['', 'to', 'from']; @@ -24,7 +24,6 @@ public function all_countries_have_translated_names() foreach($countries as $country) { $this->assertNotEquals($country->setLocale($this->languageCode)->getName(), $country->setLocale('en')->getName()); - //echo $country->inflict('from')->setLocale($this->languageCode)->getName() . "\n"; } } }