function UserAgentTest::getLanguages
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php \Drupal\Tests\Component\Utility\UserAgentTest::getLanguages()
- 8.9.x core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php \Drupal\Tests\Component\Utility\UserAgentTest::getLanguages()
- 10 core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php \Drupal\Tests\Component\Utility\UserAgentTest::getLanguages()
Helper method to supply language codes to testGetBestMatchingLangcode().
Return value
array Language codes, ordered by priority.
1 call to UserAgentTest::getLanguages()
- UserAgentTest::testGetBestMatchingLangcode in core/
tests/ Drupal/ Tests/ Component/ Utility/ UserAgentTest.php - Tests matching language from user agent.
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ UserAgentTest.php, line 28
Class
- UserAgentTest
- Tests bytes size parsing helper methods.
Namespace
Drupal\Tests\Component\UtilityCode
protected function getLanguages() : array {
return [
// In our test case, 'en' has priority over 'en-US'.
'en',
'en-US',
// But 'fr-CA' has priority over 'fr'.
'fr-CA',
'fr',
// 'es-MX' is alone.
'es-MX',
// 'pt' is alone.
'pt',
// Language codes with more then one dash are actually valid.
// eh-oh-laa-laa is the official language code of the Teletubbies.
'eh-oh-laa-laa',
// Chinese languages.
'zh-hans',
'zh-hant',
'zh-hant-tw',
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.