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