user1958458
user1958458

Reputation: 37

change frontend language wordpress

I am trying to change my theme language in the frontend from english to german . I have changed also wp-config.php file . But it doesn't work. I am using wordpress 4.0 Can some one what should to do change language?

Upvotes: 2

Views: 14407

Answers (6)

Motaz M. El Shazly
Motaz M. El Shazly

Reputation: 49

Since 4.7, you should do the following:

function wp_noshor_redefine_locale($locale) {
    if( is_admin() ):
        switch_to_locale('en_US');
    endif;
}
add_filter('init','wp_noshor_redefine_locale');

this changes the dashbaord to English while setting front-end to the language you choose from the setting option.

Upvotes: 0

Ashar Zafar
Ashar Zafar

Reputation: 402

Change Language of Woocomerce through Functions Or change language of wodpress

/* ==== Function Start ==== */

add_filter('gettext', 'translate_reply44');
add_filter('ngettext', 'translate_reply44');

function translate_reply44($translated) {
$translated = str_ireplace('Undo?', 'numaları sipariş silindi. Sepete geri almak istiyorsanız tıklayın? ', $translated);
return $translated; 
}

/* ==== Function END ==== */

Upvotes: 0

user1390454
user1390454

Reputation: 21

Setup your site in the desired language in the admin settings and then download this plugin. In it you can setup the language for your admin backend side only ;)

http://wordpress.org/extend/plugins/kau-boys-backend-localization/

Upvotes: 1

Peter
Peter

Reputation: 4701

I wanted to change the language in the front-end and keep the language in the backend the same. I tried using adding a filter to in function.php but that didn't work for me. What did was using a plugin - Backend localization

Upvotes: 0

Yamu
Yamu

Reputation: 1662

You can use the google translate plugin for wordpress. For more info see the plugin page.

Google Translate WordPress » WP Translate

Upvotes: 0

ummahusla
ummahusla

Reputation: 2063

You can do the following:

  1. Get the the language pack (e.g. de_DE.mo) from wordpress.org. If the language pack isn't available as a standalone download, you could also use the .mo file which is bundled in the WordPress ZIP-file for your language. Located under wp-content/languages.
  2. Move the .mo file to wp-content/languages/ of your default (english) WordPress installation.
  3. Change the WPLANG constant in wp-config.php to the new locale (e.g. de_DE)
  4. In your functions.php add the following filter:

functions.php

add_filter('locale', 'wpse27056_setLocale');
function wpse27056_setLocale($locale) {
    if ( is_admin() ) {
        return 'en_US';
    }

    return $locale;
}

Reference - https://wordpress.stackexchange.com/questions/27056/different-language-for-frontend-and-backend

Take a look at WordPress Codex - Translating WordPress

Additionally you can use WP plugins especially for translating your WP website:
Codestyling Localization
User Language Switch

Upvotes: 1

Related Questions