/** * @param string $name * @param string $context * * @return WPML_ST_Page_Translation|null */ public function get_translation($name, $context, $gettext_context = '') { $result = isset($this->string_translations[$context][$gettext_context][$name]) ? $this->string_translations[$context][$gettext_context][$name] : null; if (!$result && $this->domain_fallback->has_fallback_domain($context)) { $context = $this->domain_fallback->get_fallback_domain($context); $result = isset($this->string_translations[$context][$gettext_context][$name]) ? $this->string_translations[$context][$gettext_context][$name] : null; } return $result; }
/** * @param string $language * @param string $name * @param string $context * @param string $gettext_context * * @return WPML_ST_Page_Translation|null */ public function get_translation($language, $name, $context, $gettext_context = '') { if (!in_array($context, $this->loaded_contexts)) { $this->load($language, $context); } $translation = $this->try_get_translation($name, $context, $gettext_context); if (!$translation && $this->domain_fallback->has_fallback_domain($context)) { $context = $this->domain_fallback->get_fallback_domain($context); if (!in_array($context, $this->loaded_contexts)) { $this->load($language, $context); } $translation = $this->try_get_translation($name, $context, $gettext_context); } return $translation; }