I think I fixed the issue with the following extended function in my plugin:
function localize_backend( $locale ) {
// set langauge if user is in admin area
if( defined( 'WP_ADMIN' ) || ( isset( $_REQUEST['pwd'] ) && isset( $_REQUEST['kau-boys_backend_localization_language'] ) ) ){
// ajax call from frontend
if ( 'admin-ajax.php' == basename( $_SERVER[ 'SCRIPT_FILENAME' ] ) && strpos( admin_url(), $_SERVER[ 'HTTP_REFERER' ] ) === false ) {
// if lang request param was set, change locale for AJAX response, else, don't overwrite locale (use frontend locale)
if ( ! empty( $_REQUEST[ 'lang' ] ) ) {
$locale = $_REQUEST[ 'lang' ];
}
} else {
$locale = backend_localization_get_locale();
}
}
return $locale;
}
It will check if an AJAX call was made. If the call was coming from the frontend, it checks for a lang
request param. If one could be found, it set's the $locale
to this value. Otherwise it doesn't changes the locale to be backend setting, so it should be the locale from the frontend, defined in the wp-config.php
file.
Please update to version 2.1 of the plugin and check again.
Thanks again for @Rarst and @cybnet for their hints.
define('WPLANG', 'id_ID');
inwp-config.php
. (kau-boys.com/230/wordpress/kau-boys-backend-localization-plugin)