HelperService.php
1106 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 array $entityTranslation |
| 254 | * |
| 255 | * @return array|null |
| 256 | */ |
| 257 | private function getTranslation($locale, $entityTranslation) |
| 258 | { |
| 259 | $localeParts = explode('_', $locale); |
| 260 | |
| 261 | if (!array_key_exists($locale, $entityTranslation) && count($localeParts) > 1) { |
| 262 | foreach ($entityTranslation as $key => $value) { |
| 263 | if (strpos($key, $localeParts[0] . '_') === 0) { |
| 264 | return $value; |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | return |
| 270 | $entityTranslation && |
| 271 | array_key_exists($locale, $entityTranslation) ? |
| 272 | $entityTranslation[$locale] : null; |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * @param string $locale |
| 277 | * @param string $entityTranslation |
| 278 | * @param string|null $type |
| 279 | * |
| 280 | * @return array|null |
| 281 | */ |
| 282 | public function getBookingTranslation($locale, $entityTranslation, $type) |
| 283 | { |
| 284 | $entityTranslation = !empty($entityTranslation) ? json_decode($entityTranslation, true) : null; |
| 285 | |
| 286 | $translationScope = $type === null |
| 287 | ? $entityTranslation |
| 288 | : ($entityTranslation[$type] ?? null); |
| 289 | |
| 290 | return $locale && is_array($translationScope) |
| 291 | ? $this->getTranslation($locale, $translationScope) |
| 292 | : null; |
| 293 | } |
| 294 | |
| 295 | /** |
| 296 | * @param string $bookingInfo |
| 297 | * @return string |
| 298 | */ |
| 299 | public function getLocaleFromBooking($bookingInfo) |
| 300 | { |
| 301 | /** @var SettingsService $settingsService */ |
| 302 | $settingsService = $this->container->get('domain.settings.service'); |
| 303 | |
| 304 | $usedLanguages = $settingsService->getSetting('general', 'usedLanguages'); |
| 305 | |
| 306 | $bookingInfo = !empty($bookingInfo) ? json_decode($bookingInfo, true) : null; |
| 307 | |
| 308 | return $bookingInfo && !empty($bookingInfo['locale']) ? $this->getLocaleLanguage($usedLanguages, $bookingInfo['locale']) : null; |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * @param string $translations |
| 313 | * |
| 314 | * @return string |
| 315 | */ |
| 316 | public function getLocaleFromTranslations($translations) |
| 317 | { |
| 318 | /** @var SettingsService $settingsService */ |
| 319 | $settingsService = $this->container->get('domain.settings.service'); |
| 320 | |
| 321 | $usedLanguages = $settingsService->getSetting('general', 'usedLanguages'); |
| 322 | |
| 323 | $translations = !empty($translations) ? json_decode($translations, true) : null; |
| 324 | |
| 325 | return $translations && !empty($translations['defaultLanguage']) |
| 326 | ? $this->getLocaleLanguage($usedLanguages, $translations['defaultLanguage']) : null; |
| 327 | } |
| 328 | |
| 329 | /** |
| 330 | * @param array $usedLanguages |
| 331 | * @param string $locale |
| 332 | * @return string |
| 333 | */ |
| 334 | public function getLocaleLanguage($usedLanguages, $locale) |
| 335 | { |
| 336 | if (!in_array(AMELIA_LOCALE, $usedLanguages)) { |
| 337 | $usedLanguages[] = AMELIA_LOCALE; |
| 338 | } |
| 339 | |
| 340 | if (in_array($locale, $usedLanguages)) { |
| 341 | return $locale; |
| 342 | } else { |
| 343 | foreach ($usedLanguages as $language) { |
| 344 | if (explode('_', $language)[0] === explode('_', $locale)[0]) { |
| 345 | return $language; |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | return $locale; |
| 351 | } |
| 352 | |
| 353 | /** |
| 354 | * @return array |
| 355 | */ |
| 356 | public static function getLanguages() |
| 357 | { |
| 358 | return array( |
| 359 | 'af' => array( |
| 360 | 'name' => 'Afrikaans', |
| 361 | 'code' => 'af', |
| 362 | 'wp_locale' => 'af', |
| 363 | 'country_code' => 'za' |
| 364 | ) , |
| 365 | 'ar' => array( |
| 366 | 'name' => 'Arabic', |
| 367 | 'code' => 'ar', |
| 368 | 'wp_locale' => 'ar', |
| 369 | 'country_code' => 'sa' |
| 370 | ) , |
| 371 | 'ary' => array( |
| 372 | 'name' => 'Moroccan Arabic', |
| 373 | 'code' => 'ary', |
| 374 | 'wp_locale' => 'ary', |
| 375 | 'country_code' => 'ma' |
| 376 | ) , |
| 377 | 'as' => array( |
| 378 | 'name' => 'Assamese', |
| 379 | 'code' => 'as', |
| 380 | 'wp_locale' => 'as', |
| 381 | 'country_code' => 'in' |
| 382 | ) , |
| 383 | 'azb' => array( |
| 384 | 'name' => 'South Azerbaijani', |
| 385 | 'code' => 'azb', |
| 386 | 'wp_locale' => 'azb', |
| 387 | 'country_code' => 'az' |
| 388 | ) , |
| 389 | 'az' => array( |
| 390 | 'name' => 'Azerbaijani', |
| 391 | 'code' => 'az', |
| 392 | 'wp_locale' => 'az', |
| 393 | 'country_code' => 'az' |
| 394 | ) , |
| 395 | 'bel' => array( |
| 396 | 'name' => 'Belarusian', |
| 397 | 'code' => 'bel', |
| 398 | 'wp_locale' => 'bel', |
| 399 | 'country_code' => 'by' |
| 400 | ) , |
| 401 | 'bg_BG' => array( |
| 402 | 'name' => 'Bulgarian', |
| 403 | 'code' => 'bg', |
| 404 | 'wp_locale' => 'bg_BG', |
| 405 | 'country_code' => 'bg' |
| 406 | ) , |
| 407 | 'bn_BD' => array( |
| 408 | 'name' => 'Bengali', |
| 409 | 'code' => 'bn', |
| 410 | 'wp_locale' => 'bn_BD', |
| 411 | 'country_code' => 'bd' |
| 412 | ) , |
| 413 | 'bo' => array( |
| 414 | 'name' => 'Tibetan', |
| 415 | 'code' => 'bo', |
| 416 | 'wp_locale' => 'bo', |
| 417 | 'country_code' => 'cn' |
| 418 | ) , |
| 419 | 'bs_BA' => array( |
| 420 | 'name' => 'Bosnian', |
| 421 | 'code' => 'bs', |
| 422 | 'wp_locale' => 'bs_BA', |
| 423 | 'country_code' => 'ba' |
| 424 | ) , |
| 425 | 'ca' => array( |
| 426 | 'name' => 'Catalan', |
| 427 | 'code' => 'ca', |
| 428 | 'wp_locale' => 'ca', |
| 429 | 'country_code' => 'es' |
| 430 | ) , |
| 431 | 'ceb' => array( |
| 432 | 'name' => 'Cebuano', |
| 433 | 'code' => 'ceb', |
| 434 | 'wp_locale' => 'ceb', |
| 435 | 'country_code' => 'ph' |
| 436 | ) , |
| 437 | 'cs_CZ' => array( |
| 438 | 'name' => 'Czech', |
| 439 | 'code' => 'cs', |
| 440 | 'wp_locale' => 'cs_CZ', |
| 441 | 'country_code' => 'cz' |
| 442 | ) , |
| 443 | 'cy' => array( |
| 444 | 'name' => 'Welsh', |
| 445 | 'code' => 'cy', |
| 446 | 'wp_locale' => 'cy', |
| 447 | 'country_code' => 'gb' |
| 448 | ) , |
| 449 | 'da_DK' => array( |
| 450 | 'name' => 'Danish', |
| 451 | 'code' => 'da', |
| 452 | 'wp_locale' => 'da_DK', |
| 453 | 'country_code' => 'dk' |
| 454 | ) , |
| 455 | 'de_DE_formal' => array( |
| 456 | 'name' => 'German (formal)', |
| 457 | 'code' => 'de', |
| 458 | 'wp_locale' => 'de_DE_formal', |
| 459 | 'country_code' => 'de' |
| 460 | ) , |
| 461 | 'de_AT' => array( |
| 462 | 'name' => 'German (Austria)', |
| 463 | 'code' => 'de', |
| 464 | 'wp_locale' => 'de_AT', |
| 465 | 'country_code' => 'at' |
| 466 | ) , |
| 467 | 'de_DE' => array( |
| 468 | 'name' => 'German', |
| 469 | 'code' => 'de', |
| 470 | 'wp_locale' => 'de_DE', |
| 471 | 'country_code' => 'de' |
| 472 | ) , |
| 473 | 'de_CH' => array( |
| 474 | 'name' => 'German (Switzerland)', |
| 475 | 'code' => 'de-ch', |
| 476 | 'wp_locale' => 'de_CH', |
| 477 | 'country_code' => 'ch' |
| 478 | ) , |
| 479 | 'de_CH_informal' => array( |
| 480 | 'name' => 'German (Switzerland) informal', |
| 481 | 'code' => 'de-ch', |
| 482 | 'wp_locale' => 'de_CH_informal', |
| 483 | 'country_code' => 'ch' |
| 484 | ) , |
| 485 | 'dsb' => array( |
| 486 | 'name' => 'Lower Sorbian', |
| 487 | 'code' => 'dsb', |
| 488 | 'wp_locale' => 'dsb', |
| 489 | 'country_code' => 'de' |
| 490 | ) , |
| 491 | 'dzo' => array( |
| 492 | 'name' => 'Dzongkha', |
| 493 | 'code' => 'dzo', |
| 494 | 'wp_locale' => 'dzo', |
| 495 | 'country_code' => 'bt' |
| 496 | ) , |
| 497 | 'el' => array( |
| 498 | 'name' => 'Greek', |
| 499 | 'code' => 'el', |
| 500 | 'wp_locale' => 'el', |
| 501 | 'country_code' => 'gr' |
| 502 | ) , |
| 503 | 'en_AU' => array( |
| 504 | 'name' => 'English (Australia)', |
| 505 | 'code' => 'en-au', |
| 506 | 'wp_locale' => 'en_AU', |
| 507 | 'country_code' => 'au' |
| 508 | ) , |
| 509 | 'en_CA' => array( |
| 510 | 'name' => 'English (Canada)', |
| 511 | 'code' => 'en-ca', |
| 512 | 'wp_locale' => 'en_CA', |
| 513 | 'country_code' => 'ca' |
| 514 | ) , |
| 515 | 'en_GB' => array( |
| 516 | 'name' => 'English (UK)', |
| 517 | 'code' => 'en-gb', |
| 518 | 'wp_locale' => 'en_GB', |
| 519 | 'country_code' => 'gb' |
| 520 | ) , |
| 521 | 'en_US' => array( |
| 522 | 'name' => 'English (US)', |
| 523 | 'code' => 'en', |
| 524 | 'wp_locale' => 'en_US', |
| 525 | 'country_code' => 'us' |
| 526 | ) , |
| 527 | 'en_NZ' => array( |
| 528 | 'name' => 'English (New Zealand)', |
| 529 | 'code' => 'en', |
| 530 | 'wp_locale' => 'en_NZ', |
| 531 | 'country_code' => 'nz' |
| 532 | ) , |
| 533 | 'en_ZA' => array( |
| 534 | 'name' => 'English (South Africa)', |
| 535 | 'code' => 'en', |
| 536 | 'wp_locale' => 'en_ZA', |
| 537 | 'country_code' => 'za' |
| 538 | ) , |
| 539 | 'es_PE' => array( |
| 540 | 'name' => 'Spanish (Peru)', |
| 541 | 'code' => 'es-pe', |
| 542 | 'wp_locale' => 'es_PE', |
| 543 | 'country_code' => 'pe' |
| 544 | ) , |
| 545 | 'es_CR' => array( |
| 546 | 'name' => 'Spanish (Costa Rica)', |
| 547 | 'code' => 'es-cr', |
| 548 | 'wp_locale' => 'es_CR', |
| 549 | 'country_code' => 'cr' |
| 550 | ) , |
| 551 | 'es_EC' => array( |
| 552 | 'name' => 'Spanish (Ecuador)', |
| 553 | 'code' => 'es-ec', |
| 554 | 'wp_locale' => 'es_EC', |
| 555 | 'country_code' => 'ec' |
| 556 | ) , |
| 557 | 'es_CO' => array( |
| 558 | 'name' => 'Spanish (Colombia)', |
| 559 | 'code' => 'es-co', |
| 560 | 'wp_locale' => 'es_CO', |
| 561 | 'country_code' => 'co' |
| 562 | ) , |
| 563 | 'es_UY' => array( |
| 564 | 'name' => 'Spanish (Uruguay)', |
| 565 | 'code' => 'es-uy', |
| 566 | 'wp_locale' => 'es_UY', |
| 567 | 'country_code' => 'uy' |
| 568 | ) , |
| 569 | 'es_PR' => array( |
| 570 | 'name' => 'Spanish (Puerto Rico)', |
| 571 | 'code' => 'es-pr', |
| 572 | 'wp_locale' => 'es_PR', |
| 573 | 'country_code' => 'pr' |
| 574 | ) , |
| 575 | 'es_GT' => array( |
| 576 | 'name' => 'Spanish (Guatemala)', |
| 577 | 'code' => 'es', |
| 578 | 'wp_locale' => 'es_GT', |
| 579 | 'country_code' => 'gt' |
| 580 | ) , |
| 581 | 'es_AR' => array( |
| 582 | 'name' => 'Spanish (Argentina)', |
| 583 | 'code' => 'es-ar', |
| 584 | 'wp_locale' => 'es_AR', |
| 585 | 'country_code' => 'ar' |
| 586 | ) , |
| 587 | 'es_CL' => array( |
| 588 | 'name' => 'Spanish (Chile)', |
| 589 | 'code' => 'es-cl', |
| 590 | 'wp_locale' => 'es_CL', |
| 591 | 'country_code' => 'cl' |
| 592 | ) , |
| 593 | 'es_MX' => array( |
| 594 | 'name' => 'Spanish (Mexico)', |
| 595 | 'code' => 'es-mx', |
| 596 | 'wp_locale' => 'es_MX', |
| 597 | 'country_code' => 'mx' |
| 598 | ) , |
| 599 | 'es_ES' => array( |
| 600 | 'name' => 'Spanish (Spain)', |
| 601 | 'code' => 'es', |
| 602 | 'wp_locale' => 'es_ES', |
| 603 | 'country_code' => 'es' |
| 604 | ) , |
| 605 | 'es_VE' => array( |
| 606 | 'name' => 'Spanish (Venezuela)', |
| 607 | 'code' => 'es-ve', |
| 608 | 'wp_locale' => 'es_VE', |
| 609 | 'country_code' => 've' |
| 610 | ) , |
| 611 | 'et' => array( |
| 612 | 'name' => 'Estonian', |
| 613 | 'code' => 'et', |
| 614 | 'wp_locale' => 'et', |
| 615 | 'country_code' => 'ee' |
| 616 | ) , |
| 617 | 'eu' => array( |
| 618 | 'name' => 'Basque', |
| 619 | 'code' => 'eu', |
| 620 | 'wp_locale' => 'eu', |
| 621 | 'country_code' => 'es' |
| 622 | ) , |
| 623 | 'fa_IR' => array( |
| 624 | 'name' => 'Persian', |
| 625 | 'code' => 'fa', |
| 626 | 'wp_locale' => 'fa_IR', |
| 627 | 'country_code' => 'ir' |
| 628 | ) , |
| 629 | 'fa_AF' => array( |
| 630 | 'name' => 'Persian (Afghanistan)', |
| 631 | 'code' => 'fa-af', |
| 632 | 'wp_locale' => 'fa_AF', |
| 633 | 'country_code' => 'af' |
| 634 | ) , |
| 635 | 'fi' => array( |
| 636 | 'name' => 'Finnish', |
| 637 | 'code' => 'fi', |
| 638 | 'wp_locale' => 'fi', |
| 639 | 'country_code' => 'fi' |
| 640 | ) , |
| 641 | 'fr_FR' => array( |
| 642 | 'name' => 'French (France)', |
| 643 | 'code' => 'fr', |
| 644 | 'wp_locale' => 'fr_FR', |
| 645 | 'country_code' => 'fr' |
| 646 | ) , |
| 647 | 'fr_CA' => array( |
| 648 | 'name' => 'French (Canada)', |
| 649 | 'code' => 'fr', |
| 650 | 'wp_locale' => 'fr_CA', |
| 651 | 'country_code' => 'ca' |
| 652 | ) , |
| 653 | 'fr_BE' => array( |
| 654 | 'name' => 'French (Belgium)', |
| 655 | 'code' => 'fr-be', |
| 656 | 'wp_locale' => 'fr_BE', |
| 657 | 'country_code' => 'be' |
| 658 | ) , |
| 659 | 'fur' => array( |
| 660 | 'name' => 'Friulian', |
| 661 | 'code' => 'fur', |
| 662 | 'wp_locale' => 'fur', |
| 663 | 'country_code' => 'it' |
| 664 | ) , |
| 665 | 'gd' => array( |
| 666 | 'name' => 'Scottish Gaelic', |
| 667 | 'code' => 'gd', |
| 668 | 'wp_locale' => 'gd', |
| 669 | 'country_code' => 'gb' |
| 670 | ) , |
| 671 | 'gl_ES' => array( |
| 672 | 'name' => 'Galician', |
| 673 | 'code' => 'gl', |
| 674 | 'wp_locale' => 'gl_ES', |
| 675 | 'country_code' => 'es' |
| 676 | ) , |
| 677 | 'gu' => array( |
| 678 | 'name' => 'Gujarati', |
| 679 | 'code' => 'gu', |
| 680 | 'wp_locale' => 'gu', |
| 681 | 'country_code' => 'in' |
| 682 | ) , |
| 683 | 'haz' => array( |
| 684 | 'name' => 'Hazaragi', |
| 685 | 'code' => 'haz', |
| 686 | 'wp_locale' => 'haz', |
| 687 | 'country_code' => 'af' |
| 688 | ) , |
| 689 | 'he_IL' => array( |
| 690 | 'name' => 'Hebrew', |
| 691 | 'code' => 'he', |
| 692 | 'wp_locale' => 'he_IL', |
| 693 | 'country_code' => 'il' |
| 694 | ) , |
| 695 | 'hi_IN' => array( |
| 696 | 'name' => 'Hindi', |
| 697 | 'code' => 'hi', |
| 698 | 'wp_locale' => 'hi_IN', |
| 699 | 'country_code' => 'in' |
| 700 | ) , |
| 701 | 'hr' => array( |
| 702 | 'name' => 'Croatian', |
| 703 | 'code' => 'hr', |
| 704 | 'wp_locale' => 'hr', |
| 705 | 'country_code' => 'hr' |
| 706 | ) , |
| 707 | 'hsb' => array( |
| 708 | 'name' => 'Upper Sorbian', |
| 709 | 'code' => 'hsb', |
| 710 | 'wp_locale' => 'hsb', |
| 711 | 'country_code' => 'de' |
| 712 | ) , |
| 713 | 'hu_HU' => array( |
| 714 | 'name' => 'Hungarian', |
| 715 | 'code' => 'hu', |
| 716 | 'wp_locale' => 'hu_HU', |
| 717 | 'country_code' => 'hu' |
| 718 | ) , |
| 719 | 'hy' => array( |
| 720 | 'name' => 'Armenian', |
| 721 | 'code' => 'hy', |
| 722 | 'wp_locale' => 'hy', |
| 723 | 'country_code' => 'am' |
| 724 | ) , |
| 725 | 'id_ID' => array( |
| 726 | 'name' => 'Indonesian', |
| 727 | 'code' => 'id', |
| 728 | 'wp_locale' => 'id_ID', |
| 729 | 'country_code' => 'id' |
| 730 | ) , |
| 731 | 'is_IS' => array( |
| 732 | 'name' => 'Icelandic', |
| 733 | 'code' => 'is', |
| 734 | 'wp_locale' => 'is_IS', |
| 735 | 'country_code' => 'is' |
| 736 | ) , |
| 737 | 'it_IT' => array( |
| 738 | 'name' => 'Italian', |
| 739 | 'code' => 'it', |
| 740 | 'wp_locale' => 'it_IT', |
| 741 | 'country_code' => 'it' |
| 742 | ) , |
| 743 | 'ja' => array( |
| 744 | 'name' => 'Japanese', |
| 745 | 'code' => 'ja', |
| 746 | 'wp_locale' => 'ja', |
| 747 | 'country_code' => 'jp' |
| 748 | ) , |
| 749 | 'jv_ID' => array( |
| 750 | 'name' => 'Javanese', |
| 751 | 'code' => 'jv', |
| 752 | 'wp_locale' => 'jv_ID', |
| 753 | 'country_code' => 'id' |
| 754 | ) , |
| 755 | 'ka_GE' => array( |
| 756 | 'name' => 'Georgian', |
| 757 | 'code' => 'ka', |
| 758 | 'wp_locale' => 'ka_GE', |
| 759 | 'country_code' => 'ge' |
| 760 | ) , |
| 761 | 'kab' => array( |
| 762 | 'name' => 'Kabyle', |
| 763 | 'code' => 'kab', |
| 764 | 'wp_locale' => 'kab', |
| 765 | 'country_code' => 'dz' |
| 766 | ) , |
| 767 | 'kk' => array( |
| 768 | 'name' => 'Kazakh', |
| 769 | 'code' => 'kk', |
| 770 | 'wp_locale' => 'kk', |
| 771 | 'country_code' => 'kz' |
| 772 | ) , |
| 773 | 'km' => array( |
| 774 | 'name' => 'Khmer', |
| 775 | 'code' => 'km', |
| 776 | 'wp_locale' => 'km', |
| 777 | 'country_code' => 'kh' |
| 778 | ) , |
| 779 | 'kn' => array( |
| 780 | 'name' => 'Kannada', |
| 781 | 'code' => 'kn', |
| 782 | 'wp_locale' => 'kn', |
| 783 | 'country_code' => 'in' |
| 784 | ) , |
| 785 | 'ko_KR' => array( |
| 786 | 'name' => 'Korean', |
| 787 | 'code' => 'ko', |
| 788 | 'wp_locale' => 'ko_KR', |
| 789 | 'country_code' => 'kr' |
| 790 | ) , |
| 791 | 'lo' => array( |
| 792 | 'name' => 'Lao', |
| 793 | 'code' => 'lo', |
| 794 | 'wp_locale' => 'lo', |
| 795 | 'country_code' => 'la' |
| 796 | ) , |
| 797 | 'lt_LT' => array( |
| 798 | 'name' => 'Lithuanian', |
| 799 | 'code' => 'lt', |
| 800 | 'wp_locale' => 'lt_LT', |
| 801 | 'country_code' => 'lt' |
| 802 | ) , |
| 803 | 'lb_LU' => array( |
| 804 | 'name' => 'Luxembourgish', |
| 805 | 'code' => 'lb', |
| 806 | 'wp_locale' => 'lb_LU', |
| 807 | 'country_code' => 'lu' |
| 808 | ) , |
| 809 | 'lv' => array( |
| 810 | 'name' => 'Latvian', |
| 811 | 'code' => 'lv', |
| 812 | 'wp_locale' => 'lv', |
| 813 | 'country_code' => 'lv' |
| 814 | ) , |
| 815 | 'mk_MK' => array( |
| 816 | 'name' => 'Macedonian', |
| 817 | 'code' => 'mk', |
| 818 | 'wp_locale' => 'mk_MK', |
| 819 | 'country_code' => 'mk' |
| 820 | ) , |
| 821 | 'ml_IN' => array( |
| 822 | 'name' => 'Malayalam', |
| 823 | 'code' => 'ml', |
| 824 | 'wp_locale' => 'ml_IN', |
| 825 | 'country_code' => 'in' |
| 826 | ) , |
| 827 | 'mn' => array( |
| 828 | 'name' => 'Mongolian', |
| 829 | 'code' => 'mn', |
| 830 | 'wp_locale' => 'mn', |
| 831 | 'country_code' => 'mn' |
| 832 | ) , |
| 833 | 'mr' => array( |
| 834 | 'name' => 'Marathi', |
| 835 | 'code' => 'mr', |
| 836 | 'wp_locale' => 'mr', |
| 837 | 'country_code' => 'in' |
| 838 | ) , |
| 839 | 'ms_MY' => array( |
| 840 | 'name' => 'Malay', |
| 841 | 'code' => 'ms', |
| 842 | 'wp_locale' => 'ms_MY', |
| 843 | 'country_code' => 'my' |
| 844 | ) , |
| 845 | 'my_MM' => array( |
| 846 | 'name' => 'Burmese', |
| 847 | 'code' => 'mya', |
| 848 | 'wp_locale' => 'my_MM', |
| 849 | 'country_code' => 'mm' |
| 850 | ) , |
| 851 | 'nb_NO' => array( |
| 852 | 'name' => 'Norwegian (Bokmål)', |
| 853 | 'code' => 'nb', |
| 854 | 'wp_locale' => 'nb_NO', |
| 855 | 'country_code' => 'no' |
| 856 | ) , |
| 857 | 'ne_NP' => array( |
| 858 | 'name' => 'Nepali', |
| 859 | 'code' => 'ne', |
| 860 | 'wp_locale' => 'ne_NP', |
| 861 | 'country_code' => 'np' |
| 862 | ) , |
| 863 | 'nl_BE' => array( |
| 864 | 'name' => 'Dutch (Belgium)', |
| 865 | 'code' => 'nl-be', |
| 866 | 'wp_locale' => 'nl_BE', |
| 867 | 'country_code' => 'be' |
| 868 | ) , |
| 869 | 'nl_NL' => array( |
| 870 | 'name' => 'Dutch', |
| 871 | 'code' => 'nl', |
| 872 | 'wp_locale' => 'nl_NL', |
| 873 | 'country_code' => 'nl' |
| 874 | ) , |
| 875 | 'nl_NL_formal' => array( |
| 876 | 'name' => 'Dutch (formal)', |
| 877 | 'code' => 'nl', |
| 878 | 'wp_locale' => 'nl_NL_formal', |
| 879 | 'country_code' => 'nl' |
| 880 | ) , |
| 881 | 'nn_NO' => array( |
| 882 | 'name' => 'Norwegian (Nynorsk)', |
| 883 | 'code' => 'nn', |
| 884 | 'wp_locale' => 'nn_NO', |
| 885 | 'country_code' => 'no' |
| 886 | ) , |
| 887 | 'pa_IN' => array( |
| 888 | 'name' => 'Punjabi', |
| 889 | 'code' => 'pa', |
| 890 | 'wp_locale' => 'pa_IN', |
| 891 | 'country_code' => 'in' |
| 892 | ) , |
| 893 | 'pl_PL' => array( |
| 894 | 'name' => 'Polish', |
| 895 | 'code' => 'pl', |
| 896 | 'wp_locale' => 'pl_PL', |
| 897 | 'country_code' => 'pl' |
| 898 | ) , |
| 899 | 'ps' => array( |
| 900 | 'name' => 'Pashto', |
| 901 | 'code' => 'ps', |
| 902 | 'wp_locale' => 'ps', |
| 903 | 'country_code' => 'af' |
| 904 | ) , |
| 905 | 'pt_PT_ao90' => array( |
| 906 | 'name' => 'Portuguese (AO90)', |
| 907 | 'code' => 'pt', |
| 908 | 'wp_locale' => 'pt_PT_ao90', |
| 909 | 'country_code' => 'pt' |
| 910 | ) , |
| 911 | 'pt_PT' => array( |
| 912 | 'name' => 'Portuguese (Portugal)', |
| 913 | 'code' => 'pt', |
| 914 | 'wp_locale' => 'pt_PT', |
| 915 | 'country_code' => 'pt' |
| 916 | ) , |
| 917 | 'pt_AO' => array( |
| 918 | 'name' => 'Portuguese (Angola)', |
| 919 | 'code' => 'pt-ao', |
| 920 | 'wp_locale' => 'pt_AO', |
| 921 | 'country_code' => 'ao' |
| 922 | ) , |
| 923 | 'pt_BR' => array( |
| 924 | 'name' => 'Portuguese (Brazil)', |
| 925 | 'code' => 'pt-br', |
| 926 | 'wp_locale' => 'pt_BR', |
| 927 | 'country_code' => 'br' |
| 928 | ) , |
| 929 | 'rhg' => array( |
| 930 | 'name' => 'Rohingya', |
| 931 | 'code' => 'rhg', |
| 932 | 'wp_locale' => 'rhg', |
| 933 | 'country_code' => 'mm' |
| 934 | ) , |
| 935 | 'ro_RO' => array( |
| 936 | 'name' => 'Romanian', |
| 937 | 'code' => 'ro', |
| 938 | 'wp_locale' => 'ro_RO', |
| 939 | 'country_code' => 'ro' |
| 940 | ) , |
| 941 | 'ru_RU' => array( |
| 942 | 'name' => 'Russian', |
| 943 | 'code' => 'ru', |
| 944 | 'wp_locale' => 'ru_RU', |
| 945 | 'country_code' => 'ru' |
| 946 | ) , |
| 947 | 'sah' => array( |
| 948 | 'name' => 'Sakha', |
| 949 | 'code' => 'sah', |
| 950 | 'wp_locale' => 'sah', |
| 951 | 'country_code' => 'ru' |
| 952 | ) , |
| 953 | 'snd' => array( |
| 954 | 'name' => 'Sindhi', |
| 955 | 'code' => 'snd', |
| 956 | 'wp_locale' => 'snd', |
| 957 | 'country_code' => 'pk' |
| 958 | ) , |
| 959 | 'si_LK' => array( |
| 960 | 'name' => 'Sinhala', |
| 961 | 'code' => 'si', |
| 962 | 'wp_locale' => 'si_LK', |
| 963 | 'country_code' => 'lk' |
| 964 | ) , |
| 965 | 'sk_SK' => array( |
| 966 | 'name' => 'Slovak', |
| 967 | 'code' => 'sk', |
| 968 | 'wp_locale' => 'sk_SK', |
| 969 | 'country_code' => 'sk' |
| 970 | ) , |
| 971 | 'skr' => array( |
| 972 | 'name' => 'Saraiki', |
| 973 | 'code' => 'skr', |
| 974 | 'wp_locale' => 'skr', |
| 975 | 'country_code' => 'pk' |
| 976 | ) , |
| 977 | 'sl_SI' => array( |
| 978 | 'name' => 'Slovenian', |
| 979 | 'code' => 'sl', |
| 980 | 'wp_locale' => 'sl_SI', |
| 981 | 'country_code' => 'si' |
| 982 | ) , |
| 983 | 'sq' => array( |
| 984 | 'name' => 'Albanian', |
| 985 | 'code' => 'sq', |
| 986 | 'wp_locale' => 'sq', |
| 987 | 'country_code' => 'al' |
| 988 | ) , |
| 989 | 'sr_RS' => array( |
| 990 | 'name' => 'Serbian', |
| 991 | 'code' => 'sr', |
| 992 | 'wp_locale' => 'sr_RS', |
| 993 | 'country_code' => 'rs' |
| 994 | ) , |
| 995 | 'sv_SE' => array( |
| 996 | 'name' => 'Swedish', |
| 997 | 'code' => 'sv', |
| 998 | 'wp_locale' => 'sv_SE', |
| 999 | 'country_code' => 'se' |
| 1000 | ) , |
| 1001 | 'sw' => array( |
| 1002 | 'name' => 'Kiswahili', |
| 1003 | 'code' => 'sw', |
| 1004 | 'wp_locale' => 'sw', |
| 1005 | 'country_code' => 'ke' |
| 1006 | ) , |
| 1007 | 'szl' => array( |
| 1008 | 'name' => 'Silesian', |
| 1009 | 'code' => 'szl', |
| 1010 | 'wp_locale' => 'szl', |
| 1011 | 'country_code' => 'pl' |
| 1012 | ) , |
| 1013 | 'ta_IN' => array( |
| 1014 | 'name' => 'Tamil', |
| 1015 | 'code' => 'ta', |
| 1016 | 'wp_locale' => 'ta_IN', |
| 1017 | 'country_code' => 'in' |
| 1018 | ) , |
| 1019 | 'ta_LK' => array( |
| 1020 | 'name' => 'Tamil (Sri Lanka)', |
| 1021 | 'code' => 'ta-lk', |
| 1022 | 'wp_locale' => 'ta_LK', |
| 1023 | 'country_code' => 'lk' |
| 1024 | ) , |
| 1025 | 'te' => array( |
| 1026 | 'name' => 'Telugu', |
| 1027 | 'code' => 'te', |
| 1028 | 'wp_locale' => 'te', |
| 1029 | 'country_code' => 'in' |
| 1030 | ) , |
| 1031 | 'th' => array( |
| 1032 | 'name' => 'Thai', |
| 1033 | 'code' => 'th', |
| 1034 | 'wp_locale' => 'th', |
| 1035 | 'country_code' => 'th' |
| 1036 | ) , |
| 1037 | 'tl' => array( |
| 1038 | 'name' => 'Tagalog', |
| 1039 | 'code' => 'tl', |
| 1040 | 'wp_locale' => 'tl', |
| 1041 | 'country_code' => 'ph' |
| 1042 | ) , |
| 1043 | 'tr_TR' => array( |
| 1044 | 'name' => 'Turkish', |
| 1045 | 'code' => 'tr', |
| 1046 | 'wp_locale' => 'tr_TR', |
| 1047 | 'country_code' => 'tr' |
| 1048 | ) , |
| 1049 | 'tah' => array( |
| 1050 | 'name' => 'Tahitian', |
| 1051 | 'code' => 'tah', |
| 1052 | 'wp_locale' => 'tah', |
| 1053 | 'country_code' => 'pf' |
| 1054 | ) , |
| 1055 | 'ug_CN' => array( |
| 1056 | 'name' => 'Uighur', |
| 1057 | 'code' => 'ug', |
| 1058 | 'wp_locale' => 'ug_CN', |
| 1059 | 'country_code' => 'cn' |
| 1060 | ) , |
| 1061 | 'uk' => array( |
| 1062 | 'name' => 'Ukrainian', |
| 1063 | 'code' => 'uk', |
| 1064 | 'wp_locale' => 'uk', |
| 1065 | 'country_code' => 'ua' |
| 1066 | ) , |
| 1067 | 'ur' => array( |
| 1068 | 'name' => 'Urdu', |
| 1069 | 'code' => 'ur', |
| 1070 | 'wp_locale' => 'ur', |
| 1071 | 'country_code' => 'pk' |
| 1072 | ) , |
| 1073 | 'uz_UZ' => array( |
| 1074 | 'name' => 'Uzbek', |
| 1075 | 'code' => 'uz', |
| 1076 | 'wp_locale' => 'uz_UZ', |
| 1077 | 'country_code' => 'uz' |
| 1078 | ) , |
| 1079 | 'vi' => array( |
| 1080 | 'name' => 'Vietnamese', |
| 1081 | 'code' => 'vi', |
| 1082 | 'wp_locale' => 'vi', |
| 1083 | 'country_code' => 'vn' |
| 1084 | ) , |
| 1085 | 'zh_HK' => array( |
| 1086 | 'name' => 'Chinese (Hong Kong)', |
| 1087 | 'code' => 'zh-hk', |
| 1088 | 'wp_locale' => 'zh_HK', |
| 1089 | 'country_code' => 'hk' |
| 1090 | ) , |
| 1091 | 'zh_CN' => array( |
| 1092 | 'name' => 'Chinese (China)', |
| 1093 | 'code' => 'zh-cn', |
| 1094 | 'wp_locale' => 'zh_CN', |
| 1095 | 'country_code' => 'cn' |
| 1096 | ) , |
| 1097 | 'zh_TW' => array( |
| 1098 | 'name' => 'Chinese (Taiwan)', |
| 1099 | 'code' => 'zh-tw', |
| 1100 | 'wp_locale' => 'zh_TW', |
| 1101 | 'country_code' => 'tw' |
| 1102 | ) |
| 1103 | ); |
| 1104 | } |
| 1105 | } |
| 1106 |