I've tried too much for changing the language of buddypress but failed.
I have set the language in wp-config.php
define('WPLANG', 'es_ES');
if ( file_exists( WP_LANG_DIR . '/buddypress-es_ES.mo' ) ) {
load_textdomain( 'buddypress', WP_LANG_DIR . '/buddypress-es_ES.mo' );
}
Nothing worked. Please help.
That code should be good. Why the if statement when define('WPLANG', 'es_ES'); should work properly? BuddyPress follows the language settings set by WordPress.
Verify you have the translation file uploaded via:
wp-content/languages/themes/your_theme-es_ES.mo
Also, note that if you're using WordPress v4.0 and above you can change the language in the dashboard (assuming you have the language files) via Settings > General > Site Language.
Related
I'm trying to set the german language for the Wordpress backend.
German is also installed and can be selected under:
Settings> General> Site Language
Unfortunately it jumps back to English when saving.
My attempts so far:
The following did not work (for me):
wp_config.php WPLANG set and also removed
Looking at the database by setting, it is set to de_DE
Loco Translate installed and viewed. There, too, like the Site Language, it is output as English. Loco removed again. No WPML/Loco installed.
Checked for language updates, there were none.
Installed formal German and tried to select.
Language files controlled by FTP. Only German available, no EN.
Check latest Wordpress 5.8.
No Errors in Log Files
Test .htaccess, wp-content, wp-content/languages and all other subfolders of wp-content set to 777. Only for a sec. Really.
Deactive all Plugins
Other settings such as the time (UTC + 2) could be changed and saved
Activate all WordPress debug mode for developers. Nothing
define('FS_METHOD', 'direct'); doesnt help
Check WP site-health.
Browser-Language set to german
Try another Browser
The following did work:
Installed and activated a Wordpress original theme "Twenty One" as a test
Since only the theme change worked, it had to be due to the theme. So I scoured the files and found it here:
The code says, and this was confirmed to me by support when I asked, that if "Deactivate translations" is not active in the theme options, absolute is set to en_US.
function et_divi_maybe_change_frontend_locale( $locale ) {
$option_name = 'divi_disable_translations';
$theme_options = get_option( 'et_divi' );
$disable_translations = isset ( $theme_options[ $option_name ] ) ? $theme_options[ $option_name ] : false;
if ( 'on' === $disable_translations ) {
return 'en_US';
}
return $locale;
}
add_filter( 'locale', 'et_divi_maybe_change_frontend_locale' );
It appears something has been done to my wordpress installation. The "administrator" role appears to not have access to the admin panel but another role does have access to some menu items. Among the menu items I do not have access to is the "plugins" menu. I am not able to disable the plugins but I can "break" them by renaming the folder (which I have done for all plugins)
Since I have renamed all the plugin folders, I assume it is not a plugin that is controlling it. Is there somewhere else I can look?
I assume remove_menu_page() has been used but not sure where? If it was done by an old plugin do I have to add the menu back in or should disabling the code do the trick?
I am just stumped as to where the code is residing.
This did the trick...
if ( !function_exists( 'populate_roles' ) ) {
require_once( ABSPATH . 'wp-admin/includes/schema.php' );
}
populate_roles();
I'd like to change theme (Flatsome) language on admin control panel site. One of the page UX Builder that i can...but the customizer page (..>appereance>customize)
does not change.
I made the localization:
define('THEME_PATH', get_template_directory());
load_theme_textdomain( 'flatsome', THEME_PATH . '/languages' );
$locale = get_locale();
$locale_file = THEME_PATH . "/languages/$locale.php";
if ( is_readable( $locale_file ) ) require_once( $locale_file );
I've change all the string like I want with __() and _e()
Then I scanned the project, locally (with POedit) and created the POT and PO files.
I did my translation. After finished, I transfered the PO and MO files to FTP. Like I said, half of them has changed. I tried so many things now I think totally stuck.
Yes, I solved the problem. If anyone come across this kind of problem. After WP updated 3.7, the main folder for themes is under wp-content/languages/themes/
And also if you are translating plugin it is wp-content/languages/plugins/
if your theme mo file doesn't work or half of them is working then take your po mo files to these directories, but this time make theme {text-domain}-{locale}.mo and {text-domain}-{locale}.po
I have seen many questions and answers but none that fit the bill. So here is my issue.
I have a plugin that I have localized which works fine on it's own when you add
define('WPLANG', 'my-plugin-name-de_DE');
to the wp-config file. But then when someone try's to translate the rest of the wp site it will not show the languange.
What am I missing here? I even tried naming the files I added the the wp-content folder to be the same name as my plugin... for example my-plugin-name-de_DE.po and .mo and no luck.
ANSWER
Ok so in wordpress 4.0 you can now select your language from the settings /general page.
My plugin was localized using the code
function plugin_action_init()
{
// Localization
load_plugin_textdomain('my-plugin-name', false, basename( dirname( __FILE__ ) ) . '/languages' );
}
// Add actions
add_action('init', 'plugin_action_init');
Example of a string that would get translated.
_e('Simple text example', 'my-plugin-name');
SO all that needed to be done to get my plugin's and wordpress's translation to work at the same time was to upload the wp language that I want to the wp-content/languages folder. Making sure the file name was simply de_DE.mo and de_DE.po
Such a simple mistake :)
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?
You can do the following:
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.
Move the .mo file to wp-content/languages/ of your default (english) WordPress installation.
Change the WPLANG constant in wp-config.php to the new locale (e.g. de_DE)
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
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/
You can use the google translate plugin for wordpress. For more info see the plugin page.
Google Translate WordPress » WP Translate
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
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 ==== */
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.