aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/intl/Symfony/Component/Intl/Locale/Locale.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Locale/Locale.php')
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/Locale/Locale.php317
1 files changed, 317 insertions, 0 deletions
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Locale/Locale.php b/vendor/symfony/intl/Symfony/Component/Intl/Locale/Locale.php
new file mode 100644
index 00000000..cca4e9e4
--- /dev/null
+++ b/vendor/symfony/intl/Symfony/Component/Intl/Locale/Locale.php
@@ -0,0 +1,317 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Intl\Locale;
13
14use Symfony\Component\Intl\Exception\MethodNotImplementedException;
15
16/**
17 * Replacement for PHP's native {@link \Locale} class.
18 *
19 * The only method supported in this class is {@link getDefault}. This method
20 * will always return "en". All other methods will throw an exception when used.
21 *
22 * @author Eriksen Costa <eriksen.costa@infranology.com.br>
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25class Locale
26{
27 const DEFAULT_LOCALE = null;
28
29 /* Locale method constants */
30 const ACTUAL_LOCALE = 0;
31 const VALID_LOCALE = 1;
32
33 /* Language tags constants */
34 const LANG_TAG = 'language';
35 const EXTLANG_TAG = 'extlang';
36 const SCRIPT_TAG = 'script';
37 const REGION_TAG = 'region';
38 const VARIANT_TAG = 'variant';
39 const GRANDFATHERED_LANG_TAG = 'grandfathered';
40 const PRIVATE_TAG = 'private';
41
42 /**
43 * Not supported. Returns the best available locale based on HTTP "Accept-Language" header according to RFC 2616
44 *
45 * @param string $header The string containing the "Accept-Language" header value
46 *
47 * @return string The corresponding locale code
48 *
49 * @see http://www.php.net/manual/en/locale.acceptfromhttp.php
50 *
51 * @throws MethodNotImplementedException
52 */
53 public static function acceptFromHttp($header)
54 {
55 throw new MethodNotImplementedException(__METHOD__);
56 }
57
58 /**
59 * Not supported. Returns a correctly ordered and delimited locale code
60 *
61 * @param array $subtags A keyed array where the keys identify the particular locale code subtag
62 *
63 * @return string The corresponding locale code
64 *
65 * @see http://www.php.net/manual/en/locale.composelocale.php
66 *
67 * @throws MethodNotImplementedException
68 */
69 public static function composeLocale(array $subtags)
70 {
71 throw new MethodNotImplementedException(__METHOD__);
72 }
73
74 /**
75 * Not supported. Checks if a language tag filter matches with locale
76 *
77 * @param string $langtag The language tag to check
78 * @param string $locale The language range to check against
79 * @param Boolean $canonicalize
80 *
81 * @return string The corresponding locale code
82 *
83 * @see http://www.php.net/manual/en/locale.filtermatches.php
84 *
85 * @throws MethodNotImplementedException
86 */
87 public static function filterMatches($langtag, $locale, $canonicalize = false)
88 {
89 throw new MethodNotImplementedException(__METHOD__);
90 }
91
92 /**
93 * Not supported. Returns the variants for the input locale
94 *
95 * @param string $locale The locale to extract the variants from
96 *
97 * @return array The locale variants
98 *
99 * @see http://www.php.net/manual/en/locale.getallvariants.php
100 *
101 * @throws MethodNotImplementedException
102 */
103 public static function getAllVariants($locale)
104 {
105 throw new MethodNotImplementedException(__METHOD__);
106 }
107
108 /**
109 * Returns the default locale
110 *
111 * @return string The default locale code. Always returns 'en'
112 *
113 * @see http://www.php.net/manual/en/locale.getdefault.php
114 */
115 public static function getDefault()
116 {
117 return 'en';
118 }
119
120 /**
121 * Not supported. Returns the localized display name for the locale language
122 *
123 * @param string $locale The locale code to return the display language from
124 * @param string $inLocale Optional format locale code to use to display the language name
125 *
126 * @return string The localized language display name
127 *
128 * @see http://www.php.net/manual/en/locale.getdisplaylanguage.php
129 *
130 * @throws MethodNotImplementedException
131 */
132 public static function getDisplayLanguage($locale, $inLocale = null)
133 {
134 throw new MethodNotImplementedException(__METHOD__);
135 }
136
137 /**
138 * Not supported. Returns the localized display name for the locale
139 *
140 * @param string $locale The locale code to return the display locale name from
141 * @param string $inLocale Optional format locale code to use to display the locale name
142 *
143 * @return string The localized locale display name
144 *
145 * @see http://www.php.net/manual/en/locale.getdisplayname.php
146 *
147 * @throws MethodNotImplementedException
148 */
149 public static function getDisplayName($locale, $inLocale = null)
150 {
151 throw new MethodNotImplementedException(__METHOD__);
152 }
153
154 /**
155 * Not supported. Returns the localized display name for the locale region
156 *
157 * @param string $locale The locale code to return the display region from
158 * @param string $inLocale Optional format locale code to use to display the region name
159 *
160 * @return string The localized region display name
161 *
162 * @see http://www.php.net/manual/en/locale.getdisplayregion.php
163 *
164 * @throws MethodNotImplementedException
165 */
166 public static function getDisplayRegion($locale, $inLocale = null)
167 {
168 throw new MethodNotImplementedException(__METHOD__);
169 }
170
171 /**
172 * Not supported. Returns the localized display name for the locale script
173 *
174 * @param string $locale The locale code to return the display script from
175 * @param string $inLocale Optional format locale code to use to display the script name
176 *
177 * @return string The localized script display name
178 *
179 * @see http://www.php.net/manual/en/locale.getdisplayscript.php
180 *
181 * @throws MethodNotImplementedException
182 */
183 public static function getDisplayScript($locale, $inLocale = null)
184 {
185 throw new MethodNotImplementedException(__METHOD__);
186 }
187
188 /**
189 * Not supported. Returns the localized display name for the locale variant
190 *
191 * @param string $locale The locale code to return the display variant from
192 * @param string $inLocale Optional format locale code to use to display the variant name
193 *
194 * @return string The localized variant display name
195 *
196 * @see http://www.php.net/manual/en/locale.getdisplayvariant.php
197 *
198 * @throws MethodNotImplementedException
199 */
200 public static function getDisplayVariant($locale, $inLocale = null)
201 {
202 throw new MethodNotImplementedException(__METHOD__);
203 }
204
205 /**
206 * Not supported. Returns the keywords for the locale
207 *
208 * @param string $locale The locale code to extract the keywords from
209 *
210 * @return array Associative array with the extracted variants
211 *
212 * @see http://www.php.net/manual/en/locale.getkeywords.php
213 *
214 * @throws MethodNotImplementedException
215 */
216 public static function getKeywords($locale)
217 {
218 throw new MethodNotImplementedException(__METHOD__);
219 }
220
221 /**
222 * Not supported. Returns the primary language for the locale
223 *
224 * @param string $locale The locale code to extract the language code from
225 *
226 * @return string|null The extracted language code or null in case of error
227 *
228 * @see http://www.php.net/manual/en/locale.getprimarylanguage.php
229 *
230 * @throws MethodNotImplementedException
231 */
232 public static function getPrimaryLanguage($locale)
233 {
234 throw new MethodNotImplementedException(__METHOD__);
235 }
236
237 /**
238 * Not supported. Returns the region for the locale
239 *
240 * @param string $locale The locale code to extract the region code from
241 *
242 * @return string|null The extracted region code or null if not present
243 *
244 * @see http://www.php.net/manual/en/locale.getregion.php
245 *
246 * @throws MethodNotImplementedException
247 */
248 public static function getRegion($locale)
249 {
250 throw new MethodNotImplementedException(__METHOD__);
251 }
252
253 /**
254 * Not supported. Returns the script for the locale
255 *
256 * @param string $locale The locale code to extract the script code from
257 *
258 * @return string|null The extracted script code or null if not present
259 *
260 * @see http://www.php.net/manual/en/locale.getscript.php
261 *
262 * @throws MethodNotImplementedException
263 */
264 public static function getScript($locale)
265 {
266 throw new MethodNotImplementedException(__METHOD__);
267 }
268
269 /**
270 * Not supported. Returns the closest language tag for the locale
271 *
272 * @param array $langtag A list of the language tags to compare to locale
273 * @param string $locale The locale to use as the language range when matching
274 * @param Boolean $canonicalize If true, the arguments will be converted to canonical form before matching
275 * @param string $default The locale to use if no match is found
276 *
277 * @see http://www.php.net/manual/en/locale.lookup.php
278 *
279 * @throws MethodNotImplementedException
280 */
281 public static function lookup(array $langtag, $locale, $canonicalize = false, $default = null)
282 {
283 throw new MethodNotImplementedException(__METHOD__);
284 }
285
286 /**
287 * Not supported. Returns an associative array of locale identifier subtags
288 *
289 * @param string $locale The locale code to extract the subtag array from
290 *
291 * @return array Associative array with the extracted subtags
292 *
293 * @see http://www.php.net/manual/en/locale.parselocale.php
294 *
295 * @throws MethodNotImplementedException
296 */
297 public static function parseLocale($locale)
298 {
299 throw new MethodNotImplementedException(__METHOD__);
300 }
301
302 /**
303 * Not supported. Sets the default runtime locale
304 *
305 * @param string $locale The locale code
306 *
307 * @return Boolean true on success or false on failure
308 *
309 * @see http://www.php.net/manual/en/locale.parselocale.php
310 *
311 * @throws MethodNotImplementedException
312 */
313 public static function setDefault($locale)
314 {
315 throw new MethodNotImplementedException(__METHOD__);
316 }
317}