 Arian
|
Hi there,
I have a similar problem as the following topic: http://wpml.org/forums/topic/wpml-loads-wrong-mo-file-in-ajax-response/
I have tried many things but is still won't work. It just shows the default.
I use the following code:
<?php
require_once('../../../wp-load.php');
global $sitepress;
$sitepress->switch_lang('en', true);
$loaded = load_textdomain( 'blueprint', ABSPATH .'wp-content/languages/BlackBerry/'. get_locale() .'.mo');
// when i echo $sitepress->get_current_language() here, it displays 'en'
// when i echo get_locale() here, it displays 'en_US'
// the following file holds the translation fields
require_once('buildTicket.php');
I have tried the following:
- I have loaded the buildTicket.php file from within the template, then everything works fine, the file is perfectly translated in all languages i have. (So the .mo file is correct)
- I made some checkpoints in the load_txtdomain function (wp-includes/I10n.php) to check if the .mo file i am loading is the right one. The function starts loading the en_US.mo and it merges but after that, we still have the default language.
I have the problem in wp 3.3.2 with wpml 2.4.3. I have upgraded to wp 3.4 and wpml 2.5.1 but the problem is still there..
Can anyone tell me what the next step can be in the debugging process
|
 brooks
|
Dear Arian,
Is the ICL_LANGUAGE_CODE constant is changing ?
|
 Arian
|
Dear brooks,
A constant is designed to be constant, it stays the same in the execution time of the script.
|
 brooks
|
$loaded = load_textdomain( 'blueprint', ABSPATH .'wp-content/languages/BlackBerry/'. get_locale() .'.mo');
what does $loaded have? because it seems its not loading the mo file
|
 Arian
|
Dear brooks,
var_dump($loaded); says: bool(true)
So it should be loaded, but it is not..
I have tried to print the global that holds the values:
print_r($l10n['blueprint']);
But all the fields have the (default) 'de_DE' values, not the 'en_US' that i have requested.
|
 brooks
|
here http://codex.wordpress.org/Function_Reference/load_textdomain it says that:
If the domain already exists, the inclusion will fail. If the MO file is not readable, the inclusion will fail.
So maybe we need to unload_textdomain('blueprint');
|
 Arian
|
Hi Brooks,
I have tested the unload function and it seems to work!
I had examined the i10n.php file and i expcet it would overwrite the language but it doesn't, it only merges withoud overwrite.
Thanks!
|