mirror of
https://github.com/inretio/WordPress-Plugin-Boilerplate
synced 2024-12-22 11:53:53 +02:00
Use plugin-name directly instead of passing a variable through
This should fix the incorrect pattern of using a variable where we should be using the plugin-name instead. Same goes for any translatable strings within the plugin (no more using $this->plugin-name etc).
This commit is contained in:
parent
5391e0ca27
commit
0c099e4208
2 changed files with 2 additions and 19 deletions
|
@ -26,14 +26,6 @@
|
||||||
*/
|
*/
|
||||||
class Plugin_Name_i18n {
|
class Plugin_Name_i18n {
|
||||||
|
|
||||||
/**
|
|
||||||
* The domain specified for this plugin.
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @access private
|
|
||||||
* @var string $domain The domain identifier for this plugin.
|
|
||||||
*/
|
|
||||||
private $domain;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the plugin text domain for translation.
|
* Load the plugin text domain for translation.
|
||||||
|
@ -43,21 +35,13 @@ class Plugin_Name_i18n {
|
||||||
public function load_plugin_textdomain() {
|
public function load_plugin_textdomain() {
|
||||||
|
|
||||||
load_plugin_textdomain(
|
load_plugin_textdomain(
|
||||||
$this->domain,
|
'plugin-name',
|
||||||
false,
|
false,
|
||||||
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
|
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the domain equal to that of the specified domain.
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @param string $domain The domain that represents the locale of this plugin.
|
|
||||||
*/
|
|
||||||
public function set_domain( $domain ) {
|
|
||||||
$this->domain = $domain;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,6 @@ class Plugin_Name {
|
||||||
private function set_locale() {
|
private function set_locale() {
|
||||||
|
|
||||||
$plugin_i18n = new Plugin_Name_i18n();
|
$plugin_i18n = new Plugin_Name_i18n();
|
||||||
$plugin_i18n->set_domain( $this->get_plugin_name() );
|
|
||||||
|
|
||||||
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue