lithium\g11n\Locale::canonicalize()

public static method

Returns a locale in its canonical form with tags formatted properly.

Parameters

  • string $locale

    A locale in an arbitrary form (i.e. 'ZH-HANS-HK_REVISED').

Returns

string

A locale in its canonical form (i.e. 'zh_Hans_HK_REVISED').

Source

	public static function canonicalize($locale) {
		$tags = static::decompose($locale);

		foreach ($tags as $name => &$tag) {
			foreach ((array) static::$_tags[$name]['formatter'] as $formatter) {
				$tag = $formatter($tag);
			}
		}
		return static::compose($tags);
	}