Ich greif mal folgenden code von oben auf:
### Create Text Domain For Translation
add_action('init', 'ban_textdomain');
function ban_textdomain() {
if ([COLOR=Red][B]![/B][/COLOR]function_exists('[COLOR=Red][B]wp_print_styles[/B][/COLOR]')) {
load_plugin_textdomain('wp-ban', 'wp-content/plugins/wp-ban'); //<-- alles kleiner WP 2.6
} else {
load_plugin_textdomain('wp-ban', false, 'wp-ban'); //<-- WP 2.6 Fall
}
}
Da hat der Autor ? teilweise mitgedacht und an WP 2.6 anpassen wollen ([COLOR=Red]rot markiert[/COLOR]). Die Funktion wp_print_styles gibt es erst ab WP 2.6 somit wird mit diesem if entschieden, ob der Blog schon 2.6 oder niedriger ist. Also ein auskommentieren ist sicher nicht die beste Wahl, eine Korrektur ist angemessener.
Da ich selbst noch keine Zeit hatte, die WP 2.6 zu installieren (liegt nur ausgepackt in einem deaktivierten, lokalen vhost rum), kann ich noch nicht viel zur Arbeitsweise der erweiterten load_plugin_textdomain Funktion sagen. Die schau ich mir aber später noch an.
Ergänzungen:
Die Sprachdatei für diese Plugin muß, um es nochmal eindeutig und exakt zu sagen, "wp-ban-de_DE.mo" für deutsch heißen und im wp-ban Ordner liegen.
Desweiteren muß in der wp-config.php folgendes drinstehen:
define ('WPLANG', 'de_DE');
Dann sollte die Übersetzung auch geladen werden, denn die WP 2.6 Funktion ist intern so definiert:
/**
* load_plugin_textdomain() - Loads the plugin's translated strings
*
* If the path is not given then it will be the root of the plugin
* directory. The .mo file should be named based on the domain with a
* dash followed by a dash, and then the locale exactly.
*
* @since 1.5.0
*
* @param string $domain Unique identifier for retrieving translated strings
* @param string $abs_rel_path Optional. Relative path to ABSPATH of a folder,
* where the .mo file resides. Deprecated, but still functional until 2.7
* @param string $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR. This is the preferred argument to use. It takes precendence over $abs_rel_path
*/
function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path = false) {
$locale = get_locale();
if ( false !== $plugin_rel_path )
$path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/');
else if ( false !== $abs_rel_path)
$path = ABSPATH . trim( $abs_rel_path, '/');
else
$path = WP_PLUGIN_DIR;
$mofile = $path . '/'. $domain . '-' . $locale . '.mo';
load_textdomain($domain, $mofile);
}
Alles anzeigen