You are here

protected function UserAgentTest::getLanguages in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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
Test matching language from user agent.

File

core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php, line 28
Contains \Drupal\Tests\Component\Utility\UserAgentTest.

Class

UserAgentTest
Tests bytes size parsing helper methods.

Namespace

Drupal\Tests\Component\Utility

Code

protected function getLanguages() {
  return array(
    // 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',
  );
}