mirror of
https://github.com/inretio/WordPress-Plugin-Boilerplate
synced 2024-12-22 11:53:53 +02:00
extending the new plugin name base class and implementing localization
This commit is contained in:
parent
f6a587372a
commit
d29ebf7dc8
1 changed files with 41 additions and 1 deletions
|
@ -1,3 +1,43 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// @TODO
|
/**
|
||||||
|
* Define a short description for what this class does (no period)
|
||||||
|
*
|
||||||
|
* @package Plugin_Name
|
||||||
|
* @subpackage Plugin_Name/includes
|
||||||
|
* @author Your Name <email@example.com>
|
||||||
|
* @license GPL-2.0+
|
||||||
|
* @link http://example.com
|
||||||
|
* @copyright 2014 Your Name or Company Name
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a short description for what this class does.
|
||||||
|
*
|
||||||
|
* Define a longer description for the purpose of this class.
|
||||||
|
*
|
||||||
|
* @package Plugin_Name
|
||||||
|
* @subpackage Plugin_Name/includes
|
||||||
|
* @author Your Name <email@example.com>
|
||||||
|
* @extends Plugin_Name
|
||||||
|
*/
|
||||||
|
class Plugin_Name_i18n extends Plugin_Name {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Load the plugin text domain for translation.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function load_plugin_textdomain() {
|
||||||
|
|
||||||
|
$domain = $this->plugin_slug;
|
||||||
|
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
|
||||||
|
|
||||||
|
load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
|
||||||
|
load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue