I am working on a Plugin for Wordpress and I'm not able to get the Internationalization working.
Here is the GitHub Link:
I used wppb.me as a Boilerplate and titan framework as a Admin Panel Framework. I created the pot, po and mo with poedit + Loco Translate (Cause I only have the free versio of poedit).
The following is happening: In the Plugins Menue the translated short description is shown. In my own Menue none of the Strings is translated.
Structure for Translation is the following:
new Studio_Link_Integration
( /includes/class-studio-link-integration.php )__contruct => set_locale();
private function set_locale() {
$plugin_i18n = new Studio_Link_Integration_i18n();
$plugin_i18n->set_domain( 'studio-link-integration' );
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
}
in class Studio_Link_Integration_i18n
public function load_plugin_textdomain() {
load_plugin_textdomain(
$this->domain,
false,
dirname( plugin_basename( __FILE__ ) ) . '/languages'
);
}
Language Files are in /languages/ and are named studio-link-integration-de_DE.
translation is done with __( 'Text to Translate', 'studio-link-integration' )
.
I really dont know, why it wont work. Can someone look at my Files and help me? Am I forgetting some new specifications for translating? I read the whole Codex about Localization and Internationalisation but havent found anything new out that helped me.
Thanks :)
I am working on a Plugin for Wordpress and I'm not able to get the Internationalization working.
Here is the GitHub Link: https://github/dev-nm/WP-StudioLink-Integration
I used wppb.me as a Boilerplate and titan framework as a Admin Panel Framework. I created the pot, po and mo with poedit + Loco Translate (Cause I only have the free versio of poedit).
The following is happening: In the Plugins Menue the translated short description is shown. In my own Menue none of the Strings is translated.
Structure for Translation is the following:
new Studio_Link_Integration
( /includes/class-studio-link-integration.php )__contruct => set_locale();
private function set_locale() {
$plugin_i18n = new Studio_Link_Integration_i18n();
$plugin_i18n->set_domain( 'studio-link-integration' );
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
}
in class Studio_Link_Integration_i18n
public function load_plugin_textdomain() {
load_plugin_textdomain(
$this->domain,
false,
dirname( plugin_basename( __FILE__ ) ) . '/languages'
);
}
Language Files are in /languages/ and are named studio-link-integration-de_DE.
translation is done with __( 'Text to Translate', 'studio-link-integration' )
.
I really dont know, why it wont work. Can someone look at my Files and help me? Am I forgetting some new specifications for translating? I read the whole Codex about Localization and Internationalisation but havent found anything new out that helped me.
Thanks :)
Your error is here
The path to your bundled translations resolve to a languages
folder inside the includes
folder, which is one level down from where it actually is.
Try it with an extra dirname
and you will target it correctly:
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
Or to be a bit tidier:
plugin_basename( __DIR__.'/../languages' )