Returns best-matching Locale object based on the locale identifier
provided as parameter. System default locale will be returned if no
successful matches were done.
public detectLocaleFromLocaleTag ( string $localeIdentifier ) : |
||
$localeIdentifier | string | The locale identifier as used in Locale class |
return | Best-matching existing Locale instance |
/** * @test * @dataProvider sampleLocaleIdentifiers */ public function detectingBestMatchingLocaleFromLocaleIdentifierWorksCorrectly($localeIdentifier, $expectedResult) { $locale = $this->detector->detectLocaleFromLocaleTag($localeIdentifier); $this->assertEquals($expectedResult, $locale); }