8V@Px?8V@`x?;VP`z9V` z9V 00z<Vp0z(;V{q~<VpP{BP:8VP{<@<VP`{@9V`p{{9Vp`{+@<V||;V|>8V` =8VPA.8V9V@.VKV4 9V/ 8V9P8VpE8VPtP:8V<`a9V:@ 9V4 8V9V+8V D8VPt68V<9VlP8V(E~<VPPB8Vp`t8V`ptP:8V< 8V9V+(;V0q~<VpPB8V`tP:8V<:V|09V>P8V`@E~<V`PB8VP`tP:8V <9V @+P8VHE8VPt~<V``B8VptP:8V0<P8V0@b<V@P8V0`b<V`8V0FP8V0PE~<VPB8V `t8VptP:8V< 8V9V+(;VXq~<VpPB8V`tP:8V<:V|09V>;V9V+P8VhE8VPt 8V9P8VpE~<VPBP:8V<`a9V:й:V`2P:8V<@ 9V49V|@g9V>8V 9V`/0`8V@ 9V49V+(;VPxq~<VpPB8V0`tP:8V <:V |09V >,8V*P8VE~<V`PB8V`t8VptP:8V0< 8V0@9V@+(;Vq~<VpPB8V `tP:8VP<:VP|09VP><V``;V` P8VP E8V` Pt 8V9P8V0 E~<VPBP:8V<`a9V:й:V`2P:8V<<VP8V E8V Pt 8V9P8V` Eion * @param null|string $targetLang * * @return string */ private function translateByDBQuery( $wpmlContext, $name, $value, &$hasTranslation, $targetLang ) { $filter = $this->filterProvider->getFilter( $targetLang, $name ); if ( $filter ) { $value = $filter->translate_by_name_and_context( $value, $name, $wpmlContext, $hasTranslation ); } return $value; } /** * @param string $domain * @param string $locale */ private function loadTextDomain( $domain, $locale ) { if ( ! isset( $GLOBALS['l10n'][ $domain ] ) && ! isset( $GLOBALS['l10n_unloaded'][ $domain ] ) && ! isset( self::$loadedDomains[ $locale ][ $domain ] ) ) { load_textdomain( $domain, $this->fileManager->getFilepath( $domain, $locale ) ); self::$loadedDomains[ $locale ][ $domain ] = true; } } /** * @param string $targetLang * @param callable $function * * @return string */ private function withMOLocale( $targetLang, $function ) { $initialLocale = $this->languageSwitch->getCurrentLocale(); if ( $targetLang ) { /** @var string $targetLocale */ $targetLocale = $this->locale->get_locale( $targetLang ); $this->languageSwitch->switchToLocale( $targetLocale ); $result = $function( $targetLocale ); $this->languageSwitch->switchToLocale( $initialLocale ); } else { $result = $function( $initialLocale ); } return $result; } /** * We will allow MO translation only when * the original is not empty. * * We also need to make sure we deal with a * WPML registered string (not gettext). * * If those conditions are not fulfilled, * we will translate from the database. * * @param string|bool $original * @param string $name * * @return bool */ public static function canTranslateWithMO( $original, $name ) { return $original && self::isWpmlRegisteredString( $original, $name ); } /** * This allows to differentiate WPML registered strings * from gettext strings that have the default hash for * the name. * * But it's still possible that WPML registered strings * have a hash for the name. * * @param string|bool $original * @param string $name * * @return bool */ private static function isWpmlRegisteredString( $original, $name ) { return $name && md5( (string) $original ) !== $name; } public static function resetCache() { self::$loadedDomains = []; } }