@@ -226,19 +226,20 @@ The ``Languages`` class provides access to the name of all languages::
226
226
\Locale::setDefault('en');
227
227
228
228
$languages = Languages::getNames();
229
- // => ['ab' => 'Abkhazian', ...]
229
+ // ('languageCode' => 'languageName')
230
+ // => ['ab' => 'Abkhazian', 'ace' => 'Achinese', ...]
230
231
231
- $language = Languages::getName('de');
232
- // => 'German'
233
-
234
- $language = Languages::getName('de', 'AT');
235
- // => 'Austrian German'
232
+ $language = Languages::getName('fr');
233
+ // => 'French'
236
234
237
235
All methods accept the translation locale as the last, optional parameter,
238
236
which defaults to the current default locale::
239
237
240
238
$languages = Languages::getNames('de');
241
- // => ['ab' => 'Abchasisch', ...]
239
+ // => ['ab' => 'Abchasisch', 'ace' => 'Aceh', ...]
240
+
241
+ $language = Languages::getName('fr', 'de');
242
+ // => 'Französisch'
242
243
243
244
You can also check if a given language code is valid::
244
245
@@ -258,18 +259,28 @@ for traditional Chinese)::
258
259
\Locale::setDefault('en');
259
260
260
261
$scripts = Scripts::getNames();
261
- // => ['Arab' => 'Arabic', ...]
262
+ // ('scriptCode' => 'scriptName')
263
+ // => ['Adlm' => 'Adlam', 'Afak' => 'Afaka', ...]
262
264
263
265
$script = Scripts::getName('Hans');
264
266
// => 'Simplified'
265
267
268
+ All methods accept the translation locale as the last, optional parameter,
269
+ which defaults to the current default locale::
270
+
271
+ $languages = Scripts::getNames('de');
272
+ // => ['Adlm' => 'Adlam', 'Afak' => 'Afaka', ...]
273
+
274
+ $language = Scripts::getName('Hans', 'de');
275
+ // => 'Vereinfacht'
276
+
266
277
You can also check if a given script code is valid::
267
278
268
279
$isValidScript = Scripts::exists($scriptCode);
269
280
270
281
.. versionadded :: 4.3
271
282
272
- The ``Scrcipts `` class was introduced in Symfony 4.3.
283
+ The ``Scripts `` class was introduced in Symfony 4.3.
273
284
274
285
.. _country-names :
275
286
@@ -285,7 +296,8 @@ instead of a ``Countries`` class::
285
296
\Locale::setDefault('en');
286
297
287
298
$countries = Regions::getNames();
288
- // => ['AF' => 'Afghanistan', ...]
299
+ // ('regionCode' => 'regionName')
300
+ // => ['AF' => 'Afghanistan', 'AX' => 'Åland Islands', ...]
289
301
290
302
$country = Regions::getName('GB');
291
303
// => 'United Kingdom'
@@ -294,7 +306,10 @@ All methods accept the translation locale as the last, optional parameter,
294
306
which defaults to the current default locale::
295
307
296
308
$countries = Regions::getNames('de');
297
- // => ['AF' => 'Afghanistan', ...]
309
+ // => ['AF' => 'Afghanistan', 'EG' => 'Ägypten', ...]
310
+
311
+ $country = Regions::getName('GB', 'de');
312
+ // => 'Vereinigtes Königreich'
298
313
299
314
You can also check if a given region code is valid::
300
315
@@ -317,7 +332,8 @@ provides access to the name of all locales::
317
332
\Locale::setDefault('en');
318
333
319
334
$locales = Locales::getNames();
320
- // => ['af' => 'Afrikaans', ...]
335
+ // ('localeCode' => 'localeName')
336
+ // => ['af' => 'Afrikaans', 'af_NA' => 'Afrikaans (Namibia)', ...]
321
337
322
338
$locale = Locales::getName('zh_Hans_MO');
323
339
// => 'Chinese (Simplified, Macau SAR China)'
@@ -326,7 +342,10 @@ All methods accept the translation locale as the last, optional parameter,
326
342
which defaults to the current default locale::
327
343
328
344
$locales = Locales::getNames('de');
329
- // => ['af' => 'Afrikaans', ...]
345
+ // => ['af' => 'Afrikaans', 'af_NA' => 'Afrikaans (Namibia)', ...]
346
+
347
+ $locale = Locales::getName('zh_Hans_MO', 'de');
348
+ // => 'Chinesisch (Vereinfacht, Sonderverwaltungsregion Macau)'
330
349
331
350
You can also check if a given locale code is valid::
332
351
@@ -347,7 +366,8 @@ as some of their information (symbol, fraction digits, etc.)::
347
366
\Locale::setDefault('en');
348
367
349
368
$currencies = Currencies::getNames();
350
- // => ['AFN' => 'Afghan Afghani', ...]
369
+ // ('currencyCode' => 'currencyName')
370
+ // => ['AFN' => 'Afghan Afghani', 'ALL' => 'Albanian Lek', ...]
351
371
352
372
$currency = Currencies::getName('INR');
353
373
// => 'Indian Rupee'
@@ -366,7 +386,10 @@ accept the translation locale as the last, optional parameter, which defaults to
366
386
the current default locale::
367
387
368
388
$currencies = Currencies::getNames('de');
369
- // => ['AFN' => 'Afghanische Afghani', ...]
389
+ // => ['AFN' => 'Afghanischer Afghani', 'EGP' => 'Ägyptisches Pfund', ...]
390
+
391
+ $currency = Currencies::getName('INR', 'de');
392
+ // => 'Indische Rupie'
370
393
371
394
You can also check if a given currency code is valid::
372
395
0 commit comments