'contact-form-7', 'version' => WPCF7_VERSION ) ); if ( is_wp_error( $api ) || empty( $api['translations'] ) ) { return $l10n; } foreach ( (array) $api['translations'] as $translation ) { if ( ! empty( $translation['language'] ) && ! empty( $translation['english_name'] ) ) { $l10n[$translation['language']] = $translation['english_name']; } } return $l10n; } function wpcf7_is_valid_locale( $locale ) { $pattern = '/^[a-z]{2,3}(?:_[a-zA-Z_]{2,})?$/'; return (bool) preg_match( $pattern, $locale ); } function wpcf7_is_rtl( $locale = '' ) { if ( empty( $locale ) ) { return function_exists( 'is_rtl' ) ? is_rtl() : false; } $rtl_locales = array( 'ar' => 'Arabic', 'he_IL' => 'Hebrew', 'fa_IR' => 'Persian' ); return isset( $rtl_locales[$locale] ); } function wpcf7_load_textdomain( $locale = null ) { global $l10n; $domain = 'contact-form-7'; if ( get_locale() == $locale ) { $locale = null; } if ( empty( $locale ) ) { if ( is_textdomain_loaded( $domain ) ) { return true; } else { return load_plugin_textdomain( $domain, false, $domain . '/languages' ); } } else { $mo_orig = $l10n[$domain]; unload_textdomain( $domain ); $mofile = $domain . '-' . $locale . '.mo'; $path = WP_PLUGIN_DIR . '/' . $domain . '/languages'; if ( $loaded = load_textdomain( $domain, $path . '/'. $mofile ) ) { return $loaded; } else { $mofile = WP_LANG_DIR . '/plugins/' . $mofile; return load_textdomain( $domain, $mofile ); } $l10n[$domain] = $mo_orig; } return false; }