Elgg
Version 2.3
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
classes
Elgg
I18n
Locale.php
Go to the documentation of this file.
1
<?php
2
namespace
Elgg\I18n
;
3
13
final
class
Locale
{
14
16
private
$locale;
17
23
private
function
__construct($locale) {
24
$this->locale = $locale;
25
}
26
28
public
function
__toString
() {
29
return
$this->locale;
30
}
31
41
public
static
function
parse
($locale) {
42
// TODO(evan): Better sanitizing of locales using \Locale perhaps
43
if
(!preg_match(
'~^[a-z0-9_]{2,20}$~'
, $locale)) {
44
throw
new
InvalidLocaleException
(
"Unrecognized locale: $locale"
);
45
}
46
47
return
new
Locale
($locale);
48
}
49
}
Elgg\I18n\Locale\parse
static parse($locale)
Create a language, asserting that the language code is valid.
Definition:
Locale.php:41
Elgg\I18n\Locale\__toString
__toString()
Definition:
Locale.php:28
Elgg\I18n\Locale
WARNING: API IN FLUX.
Definition:
Locale.php:13
Elgg\I18n
Definition:
ArrayMessageBundle.php:2
Elgg\I18n\InvalidLocaleException
Indicated an invalid Locale was given.
Definition:
InvalidLocaleException.php:9
Generated on Sat Dec 21 2024 00:01:03 for Elgg by
1.8.11