| | 553 | } |
| | 554 | |
| | 555 | /** |
| | 556 | * Get the PHPMailer localization name that corresponds to a WordPress localization name |
| | 557 | * |
| | 558 | * PHPMailer's localizations naming scheme doesn't match WordPress', so this function helps to match them up. Typically, that just means |
| | 559 | * converting to lowercase and using the first two characters of the WP name, but there are also exceptions that are handled. PHPMailer |
| | 560 | * will check if the resulting filename actually exists, and default to English if it doesn't, so checking that is not necessary here. |
| | 561 | * |
| | 562 | * @since |
| | 563 | * |
| | 564 | * @param string $wp_lang A WordPress localization name. Defaults to the localization currently being used. |
| | 565 | * @return string The corresponding PHPMailer localization name. |
| | 566 | */ |
| | 567 | function get_phpmailer_localization( $wp_lang = WPLANG ) { |
| | 568 | $wp_lang = strtolower( $wp_lang ); |
| | 569 | |
| | 570 | switch ( $wp_lang ) { |
| | 571 | case 'cs_cz': |
| | 572 | $phpmailer_lang = 'cz'; |
| | 573 | break; |
| | 574 | |
| | 575 | case 'da_dk': |
| | 576 | $phpmailer_lang = 'dk'; |
| | 577 | break; |
| | 578 | |
| | 579 | case 'pt_br': |
| | 580 | $phpmailer_lang = 'br'; |
| | 581 | break; |
| | 582 | |
| | 583 | case 'sv_se': |
| | 584 | $phpmailer_lang = 'se'; |
| | 585 | break; |
| | 586 | |
| | 587 | case 'zh_ch': |
| | 588 | $phpmailer_lang = 'zh_ch'; |
| | 589 | break; |
| | 590 | |
| | 591 | default: |
| | 592 | $phpmailer_lang = substr( $wp_lang, 0, 2 ); |
| | 593 | break; |
| | 594 | } |
| | 595 | |
| | 596 | return $phpmailer_lang; |