Sindbad~EG File Manager
<?php
namespace RealPress\Helpers;
use RealPress\Helpers\Translation\PolyLang;
class Translation {
public static function load_text_domain( $language_code = '' ) {
if ( PolyLang::is_active() ) {
$language_code = pll_current_language();
if ( empty( $language_code ) ) {
$language_code = $_COOKIE['pll_language'] ?? '';
}
}
if ( empty( $language_code ) ) {
$locale = explode( '_', get_locale() );
$language_code = '';
if ( isset( $locale[0] ) ) {
$language_code = $locale[0];
}
}
$files = array(
WP_LANG_DIR . '/loco/plugins/realpress-' . $language_code . '.mo',
WP_LANG_DIR . '/plugins/realpress-' . $language_code . '.mo',
plugin_dir_path( __FILE__ ) . 'languages/' . 'realpress-' . $language_code . '.mo',
);
foreach ( $files as $file ) {
if ( file_exists( $file ) ) {
load_textdomain( 'realpress', $file );
break;
}
}
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists