Skip to content

Commit

Permalink
Merge pull request #43 from slaubi/feature/da-language
Browse files Browse the repository at this point in the history
danish language added
  • Loading branch information
dusterio authored Sep 1, 2021
2 parents 25a2ed4 + 33cdb83 commit df44419
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.*"
Expand Down
25 changes: 25 additions & 0 deletions src/Services/Poliglottas/Danish.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace MenaraSolutions\Geographer\Services\Poliglottas;

use MenaraSolutions\Geographer\Contracts\IdentifiableInterface;

/**
* Class Danish
* @package MenaraSolutions\FluentGeonames\Services\Poliglottas
*/
class Danish extends Base
{
/**
* @var string
*/
protected $code = 'da';

/**
* @var array
*/
protected $defaultPrepositions = [
'from' => 'fra',
'in' => 'i'
];
}
3 changes: 3 additions & 0 deletions src/Services/TranslationAgency.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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,
];

/**
Expand Down
29 changes: 29 additions & 0 deletions tests/Geographer/Languages/DanishTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Tests\Languages;

use Tests\Test;
use MenaraSolutions\Geographer\Earth;

class DanishTest extends Test
{
protected $forms = ['', 'to', 'from'];

/**
* @var string
*/
protected $languageCode = 'da';

/**
* @test
*/
public function all_countries_have_translated_names()
{
$earth = new Earth();
$countries = $earth->getCountries();

foreach($countries as $country) {
$this->assertNotEquals($country->setLocale($this->languageCode)->getName(), $country->setLocale('en')->getName());
}
}
}
3 changes: 1 addition & 2 deletions tests/Geographer/Languages/DutchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Tests\Test;
use MenaraSolutions\Geographer\Earth;

class RussianTest extends Test
class DutchTest extends Test
{
protected $forms = ['', 'to', 'from'];

Expand All @@ -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";
}
}
}

0 comments on commit df44419

Please sign in to comment.