Hallo ihr Profis,
ich würde gerne meine eigene Übersetzung für Woocommerce aus dem ChildTheme Ordner laden lassen.
Das Verzeichnis mit den .po/.mo Dateien ist: wp-content/themes/NativeChurch-child/languages/plugins
Auf der Woocommerce Seite habe ich untenstehende Snippet gefunden, den ich in die function.php meines ChildThemes schreiben soll.
Irgenwie komme ich damit aber nicht so ganz zurecht, jedenfalls wird meine Übersetzung leider nicht geladen.
Vielen Dank für eure Hilfe!
PHP
// Code to be placed in functions.php of your theme or a custom plugin file.
add_filter( 'load_textdomain_mofile', 'load_custom_plugin_translation_file', 10, 2 );
/*
* Replace 'textdomain' with your plugin's textdomain. e.g. 'woocommerce'.
* File to be named, for example, yourtranslationfile-en_GB.mo
* File to be placed, for example, wp-content/lanaguages/textdomain/yourtranslationfile-en_GB.mo
*/
function load_custom_plugin_translation_file( $mofile, $domain ) {
if ( 'textdomain' === $domain ) {
$mofile = WP_LANG_DIR . '/textdomain/yourtranslationfile-' . get_locale() . '.mo';
}
return $mofile;
}
Alles anzeigen