Activation
8 months ago
Admin
3 weeks ago
Block
3 weeks ago
Compatibility
8 months ago
Container
8 months ago
Front
1 year ago
Rest
8 months ago
Shortcode
1 year ago
Traits
4 years ago
Widget
3 weeks ago
Bootstrap.php
5 years ago
Cache.php
8 months ago
Helper.php
3 weeks ago
I18N.php
5 years ago
Image.php
8 months ago
Output.php
4 months ago
Query.php
3 weeks ago
Settings.php
3 weeks ago
Themer.php
8 months ago
Translate.php
3 years ago
Upgrader.php
8 months ago
WordPressPopularPosts.php
8 months ago
deprecated.php
4 years ago
template-tags.php
3 weeks ago
I18N.php
50 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Define the internationalization functionality |
| 4 | * |
| 5 | * Loads and defines the internationalization files for this plugin |
| 6 | * so that it is ready for translation. |
| 7 | * |
| 8 | * @since 4.0.0 |
| 9 | * |
| 10 | * @package WordPressPopularPosts |
| 11 | */ |
| 12 | |
| 13 | namespace WordPressPopularPosts; |
| 14 | |
| 15 | class I18N { |
| 16 | /** |
| 17 | * Plugin options. |
| 18 | * |
| 19 | * @var array $config |
| 20 | * @access private |
| 21 | */ |
| 22 | private $config; |
| 23 | |
| 24 | /** |
| 25 | * Construct. |
| 26 | * |
| 27 | * @since 5.3.0 |
| 28 | */ |
| 29 | public function __construct(array $config) |
| 30 | { |
| 31 | $this->config = $config; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Load the plugin text domain for translation. |
| 36 | * |
| 37 | * @since 1.0.0 |
| 38 | */ |
| 39 | public function load_plugin_textdomain() |
| 40 | { |
| 41 | // This is basically a "hack" and should be removed in the future |
| 42 | // if/when we figure out why Polylang doesn't load WPP's mo files |
| 43 | // while WPML does that automatically. |
| 44 | if ( ! is_admin() && ! $this->config['tools']['ajax'] && function_exists('PLL') ) { |
| 45 | unload_textdomain('wordpress-popular-posts'); |
| 46 | load_textdomain('wordpress-popular-posts', WP_LANG_DIR . '/plugins/wordpress-popular-posts-' . get_locale() . '.mo'); |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 |