PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.3
Booking for Appointments and Events Calendar – Amelia v2.3
2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Application / Services / Helper / HelperService.php
ameliabooking / src / Application / Services / Helper Last commit date
HelperService.php 2 months ago
HelperService.php
1090 lines
1 <?php
2
3 namespace AmeliaBooking\Application\Services\Helper;
4
5 use AmeliaBooking\Domain\Services\DateTime\DateTimeService;
6 use AmeliaBooking\Domain\Services\Settings\SettingsService;
7 use AmeliaBooking\Domain\ValueObjects\Number\Integer\LoginType;
8 use AmeliaBooking\Infrastructure\Common\Container;
9 use AmeliaVendor\Firebase\JWT\JWT;
10 use DateTime;
11 use Exception;
12
13 /**
14 * Class HelperService
15 *
16 * @package AmeliaBooking\Application\Services\Helper
17 */
18 class HelperService
19 {
20 private $container;
21
22 /**
23 * HelperService constructor.
24 *
25 * @param Container $container
26 */
27 public function __construct(Container $container)
28 {
29 $this->container = $container;
30 }
31
32 /**
33 * @param array $params
34 *
35 * @return void
36 */
37 public function convertDates(&$params)
38 {
39 if (!empty($params['dates'])) {
40 if (!empty($params['dates'][0])) {
41 $params['dates'][0] .= ' 00:00:00';
42 }
43 if (!empty($params['dates'][1])) {
44 $params['dates'][1] .= ' 23:59:59';
45 }
46
47 if (!empty($params['timeZone'])) {
48 foreach ([0, 1] as $index) {
49 if (!empty($params['dates'][$index])) {
50 $params['dates'][$index] = DateTimeService::getDateTimeObjectInTimeZone(
51 $params['dates'][$index],
52 $params['timeZone']
53 )->setTimezone(DateTimeService::getTimeZone())->format('Y-m-d H:i:s');
54 }
55 }
56 }
57 }
58 }
59
60 /**
61 * Returns formatted price based on price plugin settings
62 *
63 * @param int|float $price
64 *
65 * @return string
66 */
67 public function getFormattedPrice($price)
68 {
69 /** @var SettingsService $settingsService */
70 $settingsService = $this->container->get('domain.settings.service');
71
72 $paymentSettings = $settingsService->getCategorySettings('payments');
73
74 // Price Separators
75 $thousandSeparatorMap = [',', '.', ' ', ' '];
76
77 $decimalSeparatorMap = ['.', ',', '.', ','];
78
79 $thousandSeparator = $thousandSeparatorMap[$paymentSettings['priceSeparator'] - 1];
80
81 $decimalSeparator = $decimalSeparatorMap[$paymentSettings['priceSeparator'] - 1];
82
83 // Price Prefix
84 $pricePrefix = '';
85 if ($paymentSettings['priceSymbolPosition'] === 'before') {
86 $pricePrefix = $paymentSettings['symbol'];
87 } elseif ($paymentSettings['priceSymbolPosition'] === 'beforeWithSpace') {
88 $pricePrefix = $paymentSettings['symbol'] . ' ';
89 }
90
91 // Price Suffix
92 $priceSuffix = '';
93 if ($paymentSettings['priceSymbolPosition'] === 'after') {
94 $priceSuffix = $paymentSettings['symbol'];
95 } elseif ($paymentSettings['priceSymbolPosition'] === 'afterWithSpace') {
96 $priceSuffix = ' ' . $paymentSettings['symbol'];
97 }
98
99 $formattedNumber = number_format(
100 $price,
101 $paymentSettings['priceNumberOfDecimals'],
102 $decimalSeparator,
103 $thousandSeparator
104 );
105
106 return $pricePrefix . $formattedNumber . $priceSuffix;
107 }
108
109 /**
110 * @param int $seconds
111 *
112 * @return string
113 */
114 public function secondsToNiceDuration($seconds)
115 {
116 $hours = floor($seconds / 3600);
117
118 $minutes = $seconds / 60 % 60;
119
120 return ($hours ? ($hours . 'h ') : '') . ($hours && $minutes ? ' ' : '') . ($minutes ? ($minutes . 'min') : '');
121 }
122
123 /**
124 * @param string $email
125 * @param string $secret
126 * @param int|null $expireTimeStamp
127 * @param int $loginType
128 *
129 * @return mixed
130 * @throws Exception
131 */
132 public function getGeneratedJWT($email, $secret, $expireTimeStamp, $loginType)
133 {
134 $now = new DateTime();
135
136 $data = [
137 'iss' => AMELIA_SITE_URL,
138 'iat' => $now->getTimestamp(),
139 'email' => $email,
140 'wp' => $loginType
141 ];
142
143 if ($expireTimeStamp !== null) {
144 $data['exp'] = $expireTimeStamp;
145 }
146
147 return JWT::encode($data, $secret, 'HS256');
148 }
149
150 /**
151 * @param string $email
152 * @param string $type
153 * @param string $dateStartString
154 * @param string $dateEndString
155 * @param string $locale
156 *
157 * @return string
158 *
159 * @throws Exception
160 */
161 public function getCustomerCabinetUrl($email, $type, $dateStartString, $dateEndString, $locale, $changePass = false)
162 {
163 /** @var SettingsService $cabinetSettings */
164 $cabinetSettings = $this->container->get('domain.settings.service')->getSetting('roles', 'customerCabinet');
165
166 $cabinetPlaceholder = '';
167
168 $usedLanguages = $this->container->get('domain.settings.service')->getSetting('general', 'usedLanguages');
169
170 $cabinetURL = trim(
171 $locale &&
172 $usedLanguages &&
173 in_array($locale, $usedLanguages) &&
174 !empty($cabinetSettings['translations']['url'][$locale]) ?
175 $cabinetSettings['translations']['url'][$locale] : $cabinetSettings['pageUrl']
176 );
177
178 if ($cabinetURL) {
179 $tokenParam = $type === 'email' || $type === 'whatsapp' ?
180 (strpos($cabinetURL, '?') === false ? '?token=' : '&token=') .
181 $this->getGeneratedJWT(
182 $email,
183 $cabinetSettings['urlJwtSecret'],
184 DateTimeService::getNowDateTimeObject()->getTimestamp() + $cabinetSettings['tokenValidTime'],
185 LoginType::AMELIA_URL_TOKEN
186 ) : '';
187
188 $cabinetPlaceholder = substr($cabinetURL, -1) === '/' ?
189 substr($cabinetURL, 0, -1) . $tokenParam : $cabinetURL . $tokenParam;
190
191 if ($cabinetSettings['filterDate'] && $dateStartString && $dateEndString) {
192 $cabinetPlaceholder .= '&end=' . $dateEndString . '&start=' . $dateStartString;
193 }
194
195 if ($changePass) {
196 $cabinetPlaceholder .= '&changePass=' . $changePass;
197 }
198
199 $cabinetPlaceholder = apply_filters('amelia_customer_panel_placeholder_filter', $cabinetPlaceholder);
200 }
201
202 return $cabinetPlaceholder;
203 }
204
205 /**
206 * @param string $email
207 * @param string $type
208 * @param string $dateStartString
209 * @param string $dateEndString
210 * @param bool $changePass
211 *
212 * @return string
213 *
214 * @throws Exception
215 */
216 public function getProviderCabinetUrl($email, $type, $dateStartString, $dateEndString, $changePass = false)
217 {
218 /** @var SettingsService $cabinetSettings */
219 $cabinetSettings = $this->container->get('domain.settings.service')->getSetting('roles', 'providerCabinet');
220
221 $cabinetPlaceholder = '';
222
223 $cabinetURL = trim($cabinetSettings['pageUrl']);
224
225 if ($cabinetURL) {
226 $tokenParam = $type === 'email' ? (strpos($cabinetURL, '?') === false ? '?token=' : '&token=') .
227 $this->getGeneratedJWT(
228 $email,
229 $cabinetSettings['urlJwtSecret'],
230 DateTimeService::getNowDateTimeObject()->getTimestamp() + $cabinetSettings['tokenValidTime'],
231 LoginType::AMELIA_URL_TOKEN
232 ) : '';
233
234 $cabinetPlaceholder = substr($cabinetURL, -1) === '/' ?
235 substr($cabinetURL, 0, -1) . $tokenParam : $cabinetURL . $tokenParam;
236
237 if ($cabinetSettings['filterDate'] && $dateStartString && $dateEndString) {
238 $cabinetPlaceholder .= '&end=' . $dateEndString . '&start=' . $dateStartString;
239 }
240
241 if ($changePass) {
242 $cabinetPlaceholder .= '&changePass=' . $changePass;
243 }
244
245 $cabinetPlaceholder = apply_filters('amelia_employee_panel_placeholder_filter', $cabinetPlaceholder);
246 }
247
248 return $cabinetPlaceholder;
249 }
250
251 /**
252 * @param string $locale
253 * @param string $entityTranslation
254 * @param string|null $type
255 *
256 * @return array|null
257 */
258 public function getBookingTranslation($locale, $entityTranslation, $type)
259 {
260 $entityTranslation = !empty($entityTranslation) ? json_decode($entityTranslation, true) : null;
261
262 if ($locale) {
263 if ($type === null) {
264 return
265 $entityTranslation &&
266 !empty($entityTranslation[$locale]) ?
267 $entityTranslation[$locale] : null;
268 } else {
269 return
270 $entityTranslation &&
271 !empty($entityTranslation[$type][$locale]) ?
272 $entityTranslation[$type][$locale] : null;
273 }
274 }
275
276 return null;
277 }
278
279 /**
280 * @param string $bookingInfo
281 * @return string
282 */
283 public function getLocaleFromBooking($bookingInfo)
284 {
285 /** @var SettingsService $settingsService */
286 $settingsService = $this->container->get('domain.settings.service');
287
288 $usedLanguages = $settingsService->getSetting('general', 'usedLanguages');
289
290 $bookingInfo = !empty($bookingInfo) ? json_decode($bookingInfo, true) : null;
291
292 return $bookingInfo && !empty($bookingInfo['locale']) ? $this->getLocaleLanguage($usedLanguages, $bookingInfo['locale']) : null;
293 }
294
295 /**
296 * @param string $translations
297 *
298 * @return string
299 */
300 public function getLocaleFromTranslations($translations)
301 {
302 /** @var SettingsService $settingsService */
303 $settingsService = $this->container->get('domain.settings.service');
304
305 $usedLanguages = $settingsService->getSetting('general', 'usedLanguages');
306
307 $translations = !empty($translations) ? json_decode($translations, true) : null;
308
309 return $translations && !empty($translations['defaultLanguage'])
310 ? $this->getLocaleLanguage($usedLanguages, $translations['defaultLanguage']) : null;
311 }
312
313 /**
314 * @param array $usedLanguages
315 * @param string $locale
316 * @return string
317 */
318 public function getLocaleLanguage($usedLanguages, $locale)
319 {
320 if (!in_array(AMELIA_LOCALE, $usedLanguages)) {
321 $usedLanguages[] = AMELIA_LOCALE;
322 }
323
324 if (in_array($locale, $usedLanguages)) {
325 return $locale;
326 } else {
327 foreach ($usedLanguages as $language) {
328 if (explode('_', $language)[0] === explode('_', $locale)[0]) {
329 return $language;
330 }
331 }
332 }
333
334 return $locale;
335 }
336
337 /**
338 * @return array
339 */
340 public static function getLanguages()
341 {
342 return array(
343 'af' => array(
344 'name' => 'Afrikaans',
345 'code' => 'af',
346 'wp_locale' => 'af',
347 'country_code' => 'za'
348 ) ,
349 'ar' => array(
350 'name' => 'Arabic',
351 'code' => 'ar',
352 'wp_locale' => 'ar',
353 'country_code' => 'sa'
354 ) ,
355 'ary' => array(
356 'name' => 'Moroccan Arabic',
357 'code' => 'ary',
358 'wp_locale' => 'ary',
359 'country_code' => 'ma'
360 ) ,
361 'as' => array(
362 'name' => 'Assamese',
363 'code' => 'as',
364 'wp_locale' => 'as',
365 'country_code' => 'in'
366 ) ,
367 'azb' => array(
368 'name' => 'South Azerbaijani',
369 'code' => 'azb',
370 'wp_locale' => 'azb',
371 'country_code' => 'az'
372 ) ,
373 'az' => array(
374 'name' => 'Azerbaijani',
375 'code' => 'az',
376 'wp_locale' => 'az',
377 'country_code' => 'az'
378 ) ,
379 'bel' => array(
380 'name' => 'Belarusian',
381 'code' => 'bel',
382 'wp_locale' => 'bel',
383 'country_code' => 'by'
384 ) ,
385 'bg_BG' => array(
386 'name' => 'Bulgarian',
387 'code' => 'bg',
388 'wp_locale' => 'bg_BG',
389 'country_code' => 'bg'
390 ) ,
391 'bn_BD' => array(
392 'name' => 'Bengali',
393 'code' => 'bn',
394 'wp_locale' => 'bn_BD',
395 'country_code' => 'bd'
396 ) ,
397 'bo' => array(
398 'name' => 'Tibetan',
399 'code' => 'bo',
400 'wp_locale' => 'bo',
401 'country_code' => 'cn'
402 ) ,
403 'bs_BA' => array(
404 'name' => 'Bosnian',
405 'code' => 'bs',
406 'wp_locale' => 'bs_BA',
407 'country_code' => 'ba'
408 ) ,
409 'ca' => array(
410 'name' => 'Catalan',
411 'code' => 'ca',
412 'wp_locale' => 'ca',
413 'country_code' => 'es'
414 ) ,
415 'ceb' => array(
416 'name' => 'Cebuano',
417 'code' => 'ceb',
418 'wp_locale' => 'ceb',
419 'country_code' => 'ph'
420 ) ,
421 'cs_CZ' => array(
422 'name' => 'Czech',
423 'code' => 'cs',
424 'wp_locale' => 'cs_CZ',
425 'country_code' => 'cz'
426 ) ,
427 'cy' => array(
428 'name' => 'Welsh',
429 'code' => 'cy',
430 'wp_locale' => 'cy',
431 'country_code' => 'gb'
432 ) ,
433 'da_DK' => array(
434 'name' => 'Danish',
435 'code' => 'da',
436 'wp_locale' => 'da_DK',
437 'country_code' => 'dk'
438 ) ,
439 'de_DE_formal' => array(
440 'name' => 'German (formal)',
441 'code' => 'de',
442 'wp_locale' => 'de_DE_formal',
443 'country_code' => 'de'
444 ) ,
445 'de_AT' => array(
446 'name' => 'German (Austria)',
447 'code' => 'de',
448 'wp_locale' => 'de_AT',
449 'country_code' => 'at'
450 ) ,
451 'de_DE' => array(
452 'name' => 'German',
453 'code' => 'de',
454 'wp_locale' => 'de_DE',
455 'country_code' => 'de'
456 ) ,
457 'de_CH' => array(
458 'name' => 'German (Switzerland)',
459 'code' => 'de-ch',
460 'wp_locale' => 'de_CH',
461 'country_code' => 'ch'
462 ) ,
463 'de_CH_informal' => array(
464 'name' => 'German (Switzerland) informal',
465 'code' => 'de-ch',
466 'wp_locale' => 'de_CH_informal',
467 'country_code' => 'ch'
468 ) ,
469 'dsb' => array(
470 'name' => 'Lower Sorbian',
471 'code' => 'dsb',
472 'wp_locale' => 'dsb',
473 'country_code' => 'de'
474 ) ,
475 'dzo' => array(
476 'name' => 'Dzongkha',
477 'code' => 'dzo',
478 'wp_locale' => 'dzo',
479 'country_code' => 'bt'
480 ) ,
481 'el' => array(
482 'name' => 'Greek',
483 'code' => 'el',
484 'wp_locale' => 'el',
485 'country_code' => 'gr'
486 ) ,
487 'en_AU' => array(
488 'name' => 'English (Australia)',
489 'code' => 'en-au',
490 'wp_locale' => 'en_AU',
491 'country_code' => 'au'
492 ) ,
493 'en_CA' => array(
494 'name' => 'English (Canada)',
495 'code' => 'en-ca',
496 'wp_locale' => 'en_CA',
497 'country_code' => 'ca'
498 ) ,
499 'en_GB' => array(
500 'name' => 'English (UK)',
501 'code' => 'en-gb',
502 'wp_locale' => 'en_GB',
503 'country_code' => 'gb'
504 ) ,
505 'en_US' => array(
506 'name' => 'English (US)',
507 'code' => 'en',
508 'wp_locale' => 'en_US',
509 'country_code' => 'us'
510 ) ,
511 'en_NZ' => array(
512 'name' => 'English (New Zealand)',
513 'code' => 'en',
514 'wp_locale' => 'en_NZ',
515 'country_code' => 'nz'
516 ) ,
517 'en_ZA' => array(
518 'name' => 'English (South Africa)',
519 'code' => 'en',
520 'wp_locale' => 'en_ZA',
521 'country_code' => 'za'
522 ) ,
523 'es_PE' => array(
524 'name' => 'Spanish (Peru)',
525 'code' => 'es-pe',
526 'wp_locale' => 'es_PE',
527 'country_code' => 'pe'
528 ) ,
529 'es_CR' => array(
530 'name' => 'Spanish (Costa Rica)',
531 'code' => 'es-cr',
532 'wp_locale' => 'es_CR',
533 'country_code' => 'cr'
534 ) ,
535 'es_EC' => array(
536 'name' => 'Spanish (Ecuador)',
537 'code' => 'es-ec',
538 'wp_locale' => 'es_EC',
539 'country_code' => 'ec'
540 ) ,
541 'es_CO' => array(
542 'name' => 'Spanish (Colombia)',
543 'code' => 'es-co',
544 'wp_locale' => 'es_CO',
545 'country_code' => 'co'
546 ) ,
547 'es_UY' => array(
548 'name' => 'Spanish (Uruguay)',
549 'code' => 'es-uy',
550 'wp_locale' => 'es_UY',
551 'country_code' => 'uy'
552 ) ,
553 'es_PR' => array(
554 'name' => 'Spanish (Puerto Rico)',
555 'code' => 'es-pr',
556 'wp_locale' => 'es_PR',
557 'country_code' => 'pr'
558 ) ,
559 'es_GT' => array(
560 'name' => 'Spanish (Guatemala)',
561 'code' => 'es',
562 'wp_locale' => 'es_GT',
563 'country_code' => 'gt'
564 ) ,
565 'es_AR' => array(
566 'name' => 'Spanish (Argentina)',
567 'code' => 'es-ar',
568 'wp_locale' => 'es_AR',
569 'country_code' => 'ar'
570 ) ,
571 'es_CL' => array(
572 'name' => 'Spanish (Chile)',
573 'code' => 'es-cl',
574 'wp_locale' => 'es_CL',
575 'country_code' => 'cl'
576 ) ,
577 'es_MX' => array(
578 'name' => 'Spanish (Mexico)',
579 'code' => 'es-mx',
580 'wp_locale' => 'es_MX',
581 'country_code' => 'mx'
582 ) ,
583 'es_ES' => array(
584 'name' => 'Spanish (Spain)',
585 'code' => 'es',
586 'wp_locale' => 'es_ES',
587 'country_code' => 'es'
588 ) ,
589 'es_VE' => array(
590 'name' => 'Spanish (Venezuela)',
591 'code' => 'es-ve',
592 'wp_locale' => 'es_VE',
593 'country_code' => 've'
594 ) ,
595 'et' => array(
596 'name' => 'Estonian',
597 'code' => 'et',
598 'wp_locale' => 'et',
599 'country_code' => 'ee'
600 ) ,
601 'eu' => array(
602 'name' => 'Basque',
603 'code' => 'eu',
604 'wp_locale' => 'eu',
605 'country_code' => 'es'
606 ) ,
607 'fa_IR' => array(
608 'name' => 'Persian',
609 'code' => 'fa',
610 'wp_locale' => 'fa_IR',
611 'country_code' => 'ir'
612 ) ,
613 'fa_AF' => array(
614 'name' => 'Persian (Afghanistan)',
615 'code' => 'fa-af',
616 'wp_locale' => 'fa_AF',
617 'country_code' => 'af'
618 ) ,
619 'fi' => array(
620 'name' => 'Finnish',
621 'code' => 'fi',
622 'wp_locale' => 'fi',
623 'country_code' => 'fi'
624 ) ,
625 'fr_FR' => array(
626 'name' => 'French (France)',
627 'code' => 'fr',
628 'wp_locale' => 'fr_FR',
629 'country_code' => 'fr'
630 ) ,
631 'fr_CA' => array(
632 'name' => 'French (Canada)',
633 'code' => 'fr',
634 'wp_locale' => 'fr_CA',
635 'country_code' => 'ca'
636 ) ,
637 'fr_BE' => array(
638 'name' => 'French (Belgium)',
639 'code' => 'fr-be',
640 'wp_locale' => 'fr_BE',
641 'country_code' => 'be'
642 ) ,
643 'fur' => array(
644 'name' => 'Friulian',
645 'code' => 'fur',
646 'wp_locale' => 'fur',
647 'country_code' => 'it'
648 ) ,
649 'gd' => array(
650 'name' => 'Scottish Gaelic',
651 'code' => 'gd',
652 'wp_locale' => 'gd',
653 'country_code' => 'gb'
654 ) ,
655 'gl_ES' => array(
656 'name' => 'Galician',
657 'code' => 'gl',
658 'wp_locale' => 'gl_ES',
659 'country_code' => 'es'
660 ) ,
661 'gu' => array(
662 'name' => 'Gujarati',
663 'code' => 'gu',
664 'wp_locale' => 'gu',
665 'country_code' => 'in'
666 ) ,
667 'haz' => array(
668 'name' => 'Hazaragi',
669 'code' => 'haz',
670 'wp_locale' => 'haz',
671 'country_code' => 'af'
672 ) ,
673 'he_IL' => array(
674 'name' => 'Hebrew',
675 'code' => 'he',
676 'wp_locale' => 'he_IL',
677 'country_code' => 'il'
678 ) ,
679 'hi_IN' => array(
680 'name' => 'Hindi',
681 'code' => 'hi',
682 'wp_locale' => 'hi_IN',
683 'country_code' => 'in'
684 ) ,
685 'hr' => array(
686 'name' => 'Croatian',
687 'code' => 'hr',
688 'wp_locale' => 'hr',
689 'country_code' => 'hr'
690 ) ,
691 'hsb' => array(
692 'name' => 'Upper Sorbian',
693 'code' => 'hsb',
694 'wp_locale' => 'hsb',
695 'country_code' => 'de'
696 ) ,
697 'hu_HU' => array(
698 'name' => 'Hungarian',
699 'code' => 'hu',
700 'wp_locale' => 'hu_HU',
701 'country_code' => 'hu'
702 ) ,
703 'hy' => array(
704 'name' => 'Armenian',
705 'code' => 'hy',
706 'wp_locale' => 'hy',
707 'country_code' => 'am'
708 ) ,
709 'id_ID' => array(
710 'name' => 'Indonesian',
711 'code' => 'id',
712 'wp_locale' => 'id_ID',
713 'country_code' => 'id'
714 ) ,
715 'is_IS' => array(
716 'name' => 'Icelandic',
717 'code' => 'is',
718 'wp_locale' => 'is_IS',
719 'country_code' => 'is'
720 ) ,
721 'it_IT' => array(
722 'name' => 'Italian',
723 'code' => 'it',
724 'wp_locale' => 'it_IT',
725 'country_code' => 'it'
726 ) ,
727 'ja' => array(
728 'name' => 'Japanese',
729 'code' => 'ja',
730 'wp_locale' => 'ja',
731 'country_code' => 'jp'
732 ) ,
733 'jv_ID' => array(
734 'name' => 'Javanese',
735 'code' => 'jv',
736 'wp_locale' => 'jv_ID',
737 'country_code' => 'id'
738 ) ,
739 'ka_GE' => array(
740 'name' => 'Georgian',
741 'code' => 'ka',
742 'wp_locale' => 'ka_GE',
743 'country_code' => 'ge'
744 ) ,
745 'kab' => array(
746 'name' => 'Kabyle',
747 'code' => 'kab',
748 'wp_locale' => 'kab',
749 'country_code' => 'dz'
750 ) ,
751 'kk' => array(
752 'name' => 'Kazakh',
753 'code' => 'kk',
754 'wp_locale' => 'kk',
755 'country_code' => 'kz'
756 ) ,
757 'km' => array(
758 'name' => 'Khmer',
759 'code' => 'km',
760 'wp_locale' => 'km',
761 'country_code' => 'kh'
762 ) ,
763 'kn' => array(
764 'name' => 'Kannada',
765 'code' => 'kn',
766 'wp_locale' => 'kn',
767 'country_code' => 'in'
768 ) ,
769 'ko_KR' => array(
770 'name' => 'Korean',
771 'code' => 'ko',
772 'wp_locale' => 'ko_KR',
773 'country_code' => 'kr'
774 ) ,
775 'lo' => array(
776 'name' => 'Lao',
777 'code' => 'lo',
778 'wp_locale' => 'lo',
779 'country_code' => 'la'
780 ) ,
781 'lt_LT' => array(
782 'name' => 'Lithuanian',
783 'code' => 'lt',
784 'wp_locale' => 'lt_LT',
785 'country_code' => 'lt'
786 ) ,
787 'lb_LU' => array(
788 'name' => 'Luxembourgish',
789 'code' => 'lb',
790 'wp_locale' => 'lb_LU',
791 'country_code' => 'lu'
792 ) ,
793 'lv' => array(
794 'name' => 'Latvian',
795 'code' => 'lv',
796 'wp_locale' => 'lv',
797 'country_code' => 'lv'
798 ) ,
799 'mk_MK' => array(
800 'name' => 'Macedonian',
801 'code' => 'mk',
802 'wp_locale' => 'mk_MK',
803 'country_code' => 'mk'
804 ) ,
805 'ml_IN' => array(
806 'name' => 'Malayalam',
807 'code' => 'ml',
808 'wp_locale' => 'ml_IN',
809 'country_code' => 'in'
810 ) ,
811 'mn' => array(
812 'name' => 'Mongolian',
813 'code' => 'mn',
814 'wp_locale' => 'mn',
815 'country_code' => 'mn'
816 ) ,
817 'mr' => array(
818 'name' => 'Marathi',
819 'code' => 'mr',
820 'wp_locale' => 'mr',
821 'country_code' => 'in'
822 ) ,
823 'ms_MY' => array(
824 'name' => 'Malay',
825 'code' => 'ms',
826 'wp_locale' => 'ms_MY',
827 'country_code' => 'my'
828 ) ,
829 'my_MM' => array(
830 'name' => 'Burmese',
831 'code' => 'mya',
832 'wp_locale' => 'my_MM',
833 'country_code' => 'mm'
834 ) ,
835 'nb_NO' => array(
836 'name' => 'Norwegian (Bokmål)',
837 'code' => 'nb',
838 'wp_locale' => 'nb_NO',
839 'country_code' => 'no'
840 ) ,
841 'ne_NP' => array(
842 'name' => 'Nepali',
843 'code' => 'ne',
844 'wp_locale' => 'ne_NP',
845 'country_code' => 'np'
846 ) ,
847 'nl_BE' => array(
848 'name' => 'Dutch (Belgium)',
849 'code' => 'nl-be',
850 'wp_locale' => 'nl_BE',
851 'country_code' => 'be'
852 ) ,
853 'nl_NL' => array(
854 'name' => 'Dutch',
855 'code' => 'nl',
856 'wp_locale' => 'nl_NL',
857 'country_code' => 'nl'
858 ) ,
859 'nl_NL_formal' => array(
860 'name' => 'Dutch (formal)',
861 'code' => 'nl',
862 'wp_locale' => 'nl_NL_formal',
863 'country_code' => 'nl'
864 ) ,
865 'nn_NO' => array(
866 'name' => 'Norwegian (Nynorsk)',
867 'code' => 'nn',
868 'wp_locale' => 'nn_NO',
869 'country_code' => 'no'
870 ) ,
871 'pa_IN' => array(
872 'name' => 'Punjabi',
873 'code' => 'pa',
874 'wp_locale' => 'pa_IN',
875 'country_code' => 'in'
876 ) ,
877 'pl_PL' => array(
878 'name' => 'Polish',
879 'code' => 'pl',
880 'wp_locale' => 'pl_PL',
881 'country_code' => 'pl'
882 ) ,
883 'ps' => array(
884 'name' => 'Pashto',
885 'code' => 'ps',
886 'wp_locale' => 'ps',
887 'country_code' => 'af'
888 ) ,
889 'pt_PT_ao90' => array(
890 'name' => 'Portuguese (AO90)',
891 'code' => 'pt',
892 'wp_locale' => 'pt_PT_ao90',
893 'country_code' => 'pt'
894 ) ,
895 'pt_PT' => array(
896 'name' => 'Portuguese (Portugal)',
897 'code' => 'pt',
898 'wp_locale' => 'pt_PT',
899 'country_code' => 'pt'
900 ) ,
901 'pt_AO' => array(
902 'name' => 'Portuguese (Angola)',
903 'code' => 'pt-ao',
904 'wp_locale' => 'pt_AO',
905 'country_code' => 'ao'
906 ) ,
907 'pt_BR' => array(
908 'name' => 'Portuguese (Brazil)',
909 'code' => 'pt-br',
910 'wp_locale' => 'pt_BR',
911 'country_code' => 'br'
912 ) ,
913 'rhg' => array(
914 'name' => 'Rohingya',
915 'code' => 'rhg',
916 'wp_locale' => 'rhg',
917 'country_code' => 'mm'
918 ) ,
919 'ro_RO' => array(
920 'name' => 'Romanian',
921 'code' => 'ro',
922 'wp_locale' => 'ro_RO',
923 'country_code' => 'ro'
924 ) ,
925 'ru_RU' => array(
926 'name' => 'Russian',
927 'code' => 'ru',
928 'wp_locale' => 'ru_RU',
929 'country_code' => 'ru'
930 ) ,
931 'sah' => array(
932 'name' => 'Sakha',
933 'code' => 'sah',
934 'wp_locale' => 'sah',
935 'country_code' => 'ru'
936 ) ,
937 'snd' => array(
938 'name' => 'Sindhi',
939 'code' => 'snd',
940 'wp_locale' => 'snd',
941 'country_code' => 'pk'
942 ) ,
943 'si_LK' => array(
944 'name' => 'Sinhala',
945 'code' => 'si',
946 'wp_locale' => 'si_LK',
947 'country_code' => 'lk'
948 ) ,
949 'sk_SK' => array(
950 'name' => 'Slovak',
951 'code' => 'sk',
952 'wp_locale' => 'sk_SK',
953 'country_code' => 'sk'
954 ) ,
955 'skr' => array(
956 'name' => 'Saraiki',
957 'code' => 'skr',
958 'wp_locale' => 'skr',
959 'country_code' => 'pk'
960 ) ,
961 'sl_SI' => array(
962 'name' => 'Slovenian',
963 'code' => 'sl',
964 'wp_locale' => 'sl_SI',
965 'country_code' => 'si'
966 ) ,
967 'sq' => array(
968 'name' => 'Albanian',
969 'code' => 'sq',
970 'wp_locale' => 'sq',
971 'country_code' => 'al'
972 ) ,
973 'sr_RS' => array(
974 'name' => 'Serbian',
975 'code' => 'sr',
976 'wp_locale' => 'sr_RS',
977 'country_code' => 'rs'
978 ) ,
979 'sv_SE' => array(
980 'name' => 'Swedish',
981 'code' => 'sv',
982 'wp_locale' => 'sv_SE',
983 'country_code' => 'se'
984 ) ,
985 'sw' => array(
986 'name' => 'Kiswahili',
987 'code' => 'sw',
988 'wp_locale' => 'sw',
989 'country_code' => 'ke'
990 ) ,
991 'szl' => array(
992 'name' => 'Silesian',
993 'code' => 'szl',
994 'wp_locale' => 'szl',
995 'country_code' => 'pl'
996 ) ,
997 'ta_IN' => array(
998 'name' => 'Tamil',
999 'code' => 'ta',
1000 'wp_locale' => 'ta_IN',
1001 'country_code' => 'in'
1002 ) ,
1003 'ta_LK' => array(
1004 'name' => 'Tamil (Sri Lanka)',
1005 'code' => 'ta-lk',
1006 'wp_locale' => 'ta_LK',
1007 'country_code' => 'lk'
1008 ) ,
1009 'te' => array(
1010 'name' => 'Telugu',
1011 'code' => 'te',
1012 'wp_locale' => 'te',
1013 'country_code' => 'in'
1014 ) ,
1015 'th' => array(
1016 'name' => 'Thai',
1017 'code' => 'th',
1018 'wp_locale' => 'th',
1019 'country_code' => 'th'
1020 ) ,
1021 'tl' => array(
1022 'name' => 'Tagalog',
1023 'code' => 'tl',
1024 'wp_locale' => 'tl',
1025 'country_code' => 'ph'
1026 ) ,
1027 'tr_TR' => array(
1028 'name' => 'Turkish',
1029 'code' => 'tr',
1030 'wp_locale' => 'tr_TR',
1031 'country_code' => 'tr'
1032 ) ,
1033 'tah' => array(
1034 'name' => 'Tahitian',
1035 'code' => 'tah',
1036 'wp_locale' => 'tah',
1037 'country_code' => 'pf'
1038 ) ,
1039 'ug_CN' => array(
1040 'name' => 'Uighur',
1041 'code' => 'ug',
1042 'wp_locale' => 'ug_CN',
1043 'country_code' => 'cn'
1044 ) ,
1045 'uk' => array(
1046 'name' => 'Ukrainian',
1047 'code' => 'uk',
1048 'wp_locale' => 'uk',
1049 'country_code' => 'ua'
1050 ) ,
1051 'ur' => array(
1052 'name' => 'Urdu',
1053 'code' => 'ur',
1054 'wp_locale' => 'ur',
1055 'country_code' => 'pk'
1056 ) ,
1057 'uz_UZ' => array(
1058 'name' => 'Uzbek',
1059 'code' => 'uz',
1060 'wp_locale' => 'uz_UZ',
1061 'country_code' => 'uz'
1062 ) ,
1063 'vi' => array(
1064 'name' => 'Vietnamese',
1065 'code' => 'vi',
1066 'wp_locale' => 'vi',
1067 'country_code' => 'vn'
1068 ) ,
1069 'zh_HK' => array(
1070 'name' => 'Chinese (Hong Kong)',
1071 'code' => 'zh-hk',
1072 'wp_locale' => 'zh_HK',
1073 'country_code' => 'hk'
1074 ) ,
1075 'zh_CN' => array(
1076 'name' => 'Chinese (China)',
1077 'code' => 'zh-cn',
1078 'wp_locale' => 'zh_CN',
1079 'country_code' => 'cn'
1080 ) ,
1081 'zh_TW' => array(
1082 'name' => 'Chinese (Taiwan)',
1083 'code' => 'zh-tw',
1084 'wp_locale' => 'zh_TW',
1085 'country_code' => 'tw'
1086 )
1087 );
1088 }
1089 }
1090