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