1 <?php
2 3 4 5 6 7 8 9
10 class DBLocale extends Varchar {
11
12 function __construct($name, $size = 16) {
13 parent::__construct($name, $size);
14 }
15
16 17 18 19 20 21 22
23 function Nice($showNative=false) {
24 if ($showNative) {
25 return $this->getNativeName();
26 }
27 return $this->getShortName();
28 }
29
30 function RFC1766() {
31 return i18n::convert_rfc1766($this->value);
32 }
33
34 35 36 37 38 39
40 function getShortName() {
41 $common_names = i18n::get_common_locales();
42 return (isset($common_names[$this->value])) ? $common_names[$this->value] : false;
43 }
44
45 46 47
48 function getLongName() {
49 return i18n::get_locale_name($this->value);
50 }
51
52 53 54 55 56 57
58 function getNativeName() {
59 $common_names = i18n::get_common_locales(true);
60 return (isset($common_names[$this->value])) ? $common_names[$this->value] : false;
61 }
62 }
63 ?>
64
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-