This method partially implements the lookup matching scheme as described
in RFC 4647, section 3.4 and thus does not strictly conform to the
specification.
Differences to specification:
- No support for wildcards in the to-be-matched locales.
- No support for locales with private subtags.
- No support for a default return value.
- Passed locales are required to be in canonical form (i.e. 'ja_JP').
public function testLookup() { $expected = 'zh_Hans_HK'; $result = Locale::lookup(array('zh_Hans_REVISED', 'zh_Hans_HK', 'zh', 'zh_Hans'), 'zh_Hans_HK_REVISED'); $this->assertEqual($expected, $result); $expected = 'zh_Hans_HK'; $result = Locale::lookup(array('zh', 'zh_Hans_REVISED', 'zh_Hans_HK', 'zh_Hans'), 'zh_Hans_HK_REVISED'); $this->assertEqual($expected, $result); }
public function testLookup() { $result = Locale::lookup(array('zh_Hans_REVISED', 'zh_Hans_HK', 'zh', 'zh_Hans'), 'zh_Hans_HK_REVISED'); $this->assertEqual('zh_Hans_HK', $result); $result = Locale::lookup(array('zh', 'zh_Hans_REVISED', 'zh_Hans_HK', 'zh_Hans'), 'zh_Hans_HK_REVISED'); $this->assertEqual('zh_Hans_HK', $result); $result = Locale::lookup(array('en', 'en_UK', 'en_US', 'es', 'es_AR'), 'en'); $this->assertEqual('en', $result); $result = Locale::lookup(array('en', 'en_UK', 'en_US', 'es', 'es_AR'), 'en_UK'); $this->assertEqual('en_UK', $result); $result = Locale::lookup(array('en', 'en_UK', 'en_US', 'es', 'es_AR'), 'es_ES'); $this->assertEqual('es', $result); $result = Locale::lookup(array('en', 'en_UK', 'en_US', 'es_AR'), 'es_ES'); $this->assertEqual('es_AR', $result); }