Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function install_locale()
- {
- is_admin() or add_filter( 'locale', function($locale) {
- $locale = "ka_GE";
- return $locale;
- });
- //check if it's not install, then install
- add_action('wp', 'my_locale_implemention');
- function my_locale_implemention()
- {
- $my_locale = get_locale(); //get_user_locale
- if ( !empty($my_locale) && !in_array( $my_locale, get_available_languages() ) ) {
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
- require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
- $language = wp_download_language_pack( $my_locale );
- if ( $language ) {
- if(empty($_POST)) header("location: ".$_SERVER['REQUEST_URI']); exit; //reload page
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement