[Geschlossen] wpml_default_language, wpml_switch_language with action won't work any more
Dies ist das technische Support-Forum für WPML – das mehrsprachige WordPress-Plugin.
Mitlesen können alle, doch nur WPML-Kunden können hier Fragen veröffentlichen. Das WPML-Team antwortet im Forum an 6 Tagen pro Woche, 22 Stunden am Tag.
woocommerce-products are only generate in one language - to custom output them, we switch on other-language page for output the product-data to the default language.
We used a function to get the default language:
function getDefaultLang ($bDebug = false ) {
return ( apply_filters( 'wpml_default_language', NULL ) );
}
$currentLang = getLang();
if ( $currentLang != $defaultLang ) {
do_action( 'wpml_switch_language', $defaultLang() ); // line 1537
do_action( 'wpml_switch_language', 'DE' ); // works fine, but we do not like hard-coded languages
}
And we use the following construct to check if default != current lang and the we switch before output product data. later we switch back.
it works fine but actualy we get an error:
Fatal error: Uncaught Error: Call to undefined function de()
in /wp-content/... on line 1537 (the switching-line)
Seems the action returns a function and not a string with the lang-code?!