Hi,
I've recently being playing around with the latest 6.x version of the i18n module(s). You may be aware of this already, but I've just noticed that multilingual variable support appears to be broken or no longer exists. Though maybe it's just the documentation that is out of date - http://drupal.org/node/134002.
Using the faq module as an example, I configured the following in my settings.php file:
$conf['i18n_variables'] = array(
'lightbox2_node_link_text',
'lightbox2_image_count_str',
'lightbox2_page_count_str',
'faq_title',
'faq_description',
'faq_question_label',
'faq_answer_label',
'faq_back_to_top'
);
When I go to the faq settings pages, the "This is multilingual content" appears beside the form elements for faq_question_label, faq_answer_label and faq_back_to_top, but not for the other 2 faq variables: faq_title and faq_description.
In fact, I get the following error when I try to configure multilingual strings for these 2 variables:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':8:s:24:"lightbox2_node_link_text";s:18:"View Image Details";s:25:"lightbox2_ima' at line 1 query: UPDATE a:8:s:24:"lightbox2_node_link_text";s:18:"View Image Details";s:25:"lightbox2_image_count_str";s:28:"Image !current of !total foo";s:24:"lightbox2_page_count_str";s:23:"Page !current of !total";s:9:"faq_title";s:11:"FAQ Page de";s:15:"faq_description";s:11:"FAQ desc de";s:18:"faq_question_label";s:0:"";s:16:"faq_answer_label";s:0:"";s:15:"faq_back_to_top";s:0:""; SET data = 'cache', created = 1209400662, expire = 0, headers = '', serialized = 0 WHERE cid = 'variables:de' in /var/www/drupal_6.2_20080411/html/includes/cache.inc on line 109.
For the variables that I was able to configure multilingual settings for, when I switch between languages on the 'faq' page, it's always the last language text configured that appears - even though I can see the others are still stored in the db.
If you need more info, please let me know.
Cheers,
Stella
Comments
Comment #1
mediameriquat commentedOur website is running Drupal 5.7., and all the additional strings that we added in accordance with the documentation page mentioned above, stopped working for no explainable reason.
Our multilingual variable support is dead.
We don't even get an error message... not a single clue that could help me better describe the problem.
But one thing is sure, the problem is not limited to D6.
Pierre @ Koumbit.org
Comment #2
mediameriquat commentedI should add that the Synchronization experimental module that's part of the 5.x Internationalization package is what causes the most error messages in D5. Maybe that still is the case in D6.
Comment #3
stella commentedI'm not using the Synchronization module, so I don't think that is the cause of the problem in D6.
Comment #4
stella commentedComment #5
Luca O commentedI've manually set i18n_variables variable and the module created a new table in my database. Then i've added some translated variables directly in the table, but still doesn't work (and, in the code, i can't understand how this should works).
Are multilingual variables still in development?
Comment #6
marcoBauli commentedyep, seems variables translation does not work on Drupal 5.2 neither..
Comment #7
rubeuspotter commentedHello everyone!
I think is very important to fix this problem and I've tried to fix it by myself, but I don't know how to do it, it's too difficult for me.
I guess some persons like stella are working on it, but for the last month there hasn't had any post.
So, is there any new about this?
Thank you very much,
Potter
Comment #8
Freso commentedSubscribing. (Yeah, they're b0rked for me too. :/)
Comment #9
rubeuspotter commentedHello,
any new? I'm worried, without news for so long.... I'm trying to fix it by myself but this problems is beyond my knowledge :-S.
Regards,
Potter.
Comment #10
mediameriquat commentedHello again,
This is another, more technical look at the issue:
http://drupal.org/node/235076
I haven't found an answer there either :( but apparently some people did.
Comment #11
rubeuspotter commentedHello,
That thread hasn't help me, I'm using Drupal 6.3 and when I used Drupal 5.x I had no problems with multilingual variables.
Just one thing I'm not sure if is related with this issue:
I know that for a multilingual variable I have to set its value in one language, then switch to the other language and then set again the translated value.
I have multilingual slogan and footer, but when I enter in the Administration->Site configuration->Site Information to set their values I think this page has no language, Drupal doesn't know if that page is in English or Spanish. I think this, because I have highlighted the selected language in the Language Switcher with all my pages but the Administrator pages. Maybe this is the problem with the multilingual variables? That Drupal doesn't know which language is selected in the Administrator pages?
It is just a thought.
Comment #12
mediameriquat commentedThe problem is not about editing variables through the admin interface. On my part I've done that many times, with great success, thanks to the online documentation (see link on top of this thread).
We're talking of a more serious bug or database problem : for some reason i18n variables stop working – or never get to work – on some websites, while they're A-OK on other websites installed on the same server, with the same version of Drupal and same modules!
That drives me crazy.
Comment #13
rubeuspotter commentedIf you're right, then it's impossible that I'm able to fix it, I know very very few about databases :-S.
I hope that someone finds the answer as soon as posible. This problems has ruined a lot of sites :-S.
Comment #14
jose reyero commentedAFAIK, and I've just tested it again, multilingual variables are working with Drupal 6.
Maybe the issue is related to this one, http://drupal.org/node/235076
If you override $conf variable in settings.php, multilingual variables settings will be lost, so move the $conf['i18n_variables'] part to the bottom of the file.
Comment #15
rubeuspotter commentedHello again!
I've checked my settings.php and my database tables.
My $conf['i18n_variables'] block is at the bottom of the settings.php file, there is nothing below it.
In my database I have a table named myprefix_i18n_variable, whose content is this:
name language value
------------------------------------------
site_slogan en s:23:"My slogan"
site_footer en s:234:"My footer"
site_slogan es s:26:"Mi eslogan"
site_footer es s:186:"Mi pie de pagina"
In my Administration->Site configuration->Site Information page, slogan and footer are marked as "This is a multilingual variable".
But they always appear in Spanish in my website.
I've just tried to change the value of slogan variable selecting English and Spanish and it only affects to the site_slogan (es) entry of the table. I guess that the (en) entries keep their values since they where set in my old Drupal 5.x website.
So my questions are:
- If I have the English entries in my database table, Why don't these values appear when the English language is selected in my website?
- As I said in my previous post, Don't you think that it's possible that the Administrator pages have no language affects the setting of the variables?
What could I see? I'm lost.
Thank you very much.
Comment #16
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #17
rubeuspotter commentedHello again,
I'm desperate. I've been working on this issue for a long time and I haven't been able to fix it. I've even installed all my website with other hosting, and I still have the same problem, my multilingual variables doesn't work. They worked with Drupal 5.x but not with Drupal 6.x.
I have Drupal 6.4 with i18n module version 6.x-1.0-beta3. I've actived all i18n submodules except Multilingual Poll, Multilingual taxonomy, Translation Synchronization and Views Translation. Well, I've done all my tests activating these modules too and the results are the same.
In my database I have the i18n_variable table with these values:
name language value
site_slogan es s:27:"Mi slogan en español";
site_slogan en s:27:"My slogan in Spanish"
But the slogan always appears in Spanish. So the multilingual variables doesn't work for me.
Any of you could help me? Where could I see? Any of you knows how the i18n passes the value of the variables to the Drupal pages?
Really, I'm desperate, this is almost the last thing my web needs to be launched, and I cannot do it until I fix this. Any help will be very very appreciated.
EDIT:
I've made a modification in my page.tpl.php file, in order to show the current user's language instead of the slogan. Instead of
print $site_slogan;I useprint i18n_get_lang();. This always writes "es" (Spanish is my default language), even if I choose "English" with the Switching language block. Maybe is this the problem? that the current user's language is always the default language?Please, help me with this issue.
Thank you very much again.
Potter.
Comment #18
Luca O commentedIn D6 exists the global variable $language, $language->language works right for you?
A way to move around this issue is to print in page.tpl.php l($site_slogan), l($mission), etc. It's not really the best solution, but works pretty well.
Comment #19
rubeuspotter commentedHello Luca, thank you very much for the answer.
I've put in my page.tpl.php file the "print $language->language" line and it always shows "es", as with i18n_get_lang, even if my current language is English.
Printing l($site_slogan) shows my slogan as a link, but always in Spanish. I've tried too printig t($site_slogan), but again it shows "es" always.
What I'm trying to see is how the language->language variable is set, to see why it always has the "es" value even when I have selected English language with the Switcher block. Until now I don't have discovered how it is made.
Any advise?
Comment #20
Luca O commentedUh, sorry, i misspelled, t() is right. Using t(), anyway, you have to go to admin/build/translate and (re-)translate the strings, as any other string. Have you did it?
Is really strange that $language->language doesn't output your corrent language, according to the api should works and, actually, works for me.
Try to do some attempts like: create a new language, disable i18n modules, print print_r($language,TRUE)
Comment #21
rubeuspotter commentedHello Luca,
Thank you very much again for you help.
Yes, I've tried what you have said me: I've refreshed the string translation, I've cleaned the Drupal cache, my Browser cache, I've disabled all my i18n modules and I've enabled them again, I've added a new language and so on.
I've written the value of print_r($language, TRUE) and $language->language and they always show the values corresponding to my default language even if I choose other language with the Language Switcher Block.
The question is, Why does the $language->language variable contain always the default language instead of the current-selected language? Is there any other variable that contains the value of the current language?
Thank you again.
Potter.
Comment #22
Luca O commentedInvestigating in language_initialize function, $language is set here:
So, last two possibilites are to try with another user (but i think you already tried it) or with another browser.
If you still get fail, i suggest you to backup your db and re-install drupal, then restore the tables gradually, so, if something go wrong, you will be able to localize the evil issue.
At this point, anyway, good luck Potter! :P
Comment #23
rubeuspotter commentedYes, I've tried with other browser and with other user, and I got the same problem.
What stranges to me is that I've installed all my website in two different hosts, using Drupal 6.2 and i18n 6.x-1.0-beta1 in one of them and Drupal 6.4 and i18n 6.x-1.0-beta3 in the other one, and I have the same problem. When I had my website in Drupal 5.x and i18n 5.x all these issues worked very well for me, and I've followed using the same modules, the same configuration...so this makes me think that it's a problem of Drupal 6.x or i18n 6.x or I'm missing something.
Well, I'll keep investigating this. The language_initialize function is a clue for me.
Thank you very much once again.
Comment #24
rubeuspotter commentedNew information:
Looking at the language_initialize function I've seen that my language always will be the default language because my URLs never have "es" or "en".
I'm using "Path prefix only" and my URLs are always www.mywebsite.com/alias_of_node_x.
If I select "Path prefix with language fallback" my URLs are www.mywebsite.com/es/alias_of_node_x, even if I have an English page.
If I select "Domain name only" (and set the language domain of every language) it seems that everything works wrong, some URLs crashes and, for example, if I'm in www.mysite.com/es/node/1 and go to other page the URL is www.mysite.com/es/node/1/es/node/5!!!
Well, other question, What must I do to have the "es" or "en" prefix in the URL?
Comment #25
Luca O commentedWith Domain name only you can't access pages via www.mysite.com/es/node/1, but you must use this pattern:es.mysite.com/node/1.
Anyway it's weird, i used both domain name and path prefix during testing, and both worked (using 3 languages, btw)! Definitively, it's not a d6 or i18n issue.
Still an attempt to try: upload a live demo to let others to test it.
Comment #26
rubeuspotter commentedYes, it's really weird. According with Jose A Reyero, you and other persons, multilingual variables works for Drupal 6.x, and I don't doubt it. That's the problem, that it seems is a problem of my website configuration and so it's very difficult that someone can help me.
Since I'm still developing the web it's very difficult for me to give you a demo, but I'll try it.
For the moment I'll keep looking at the code of locale and i18n modules to see if I find something.
Thank you very much again for your help.
Comment #27
stella commentedI finally found the time to retest this issue with the 6.x-1.0-beta6 version. However I still have the same problem as I reported in the original issue above. I have the following at the bottom of my settings.php:
Neither 'faq_title' or 'faq_description' have the text 'This is a multilingual variable.' beside the form field, so I can't translate them. However, the sql error I reported no longer appears.
If you need any more info, please let me know.
Cheers,
Stella
Comment #28
jose reyero commented@stella,
These multilingual variables only work for settings forms, maybe that other modules don't use standard settings forms (the ones created with system_settings_form) for that variables.. ?
Comment #29
stella commented@jose yes that was the problem, thanks!
Comment #30
Farreres commentedHey, I need some help with this. I am using a module called Page Title which sets titles for pages following patterns in the way pathauto works. By default the module doesn't support multilinguality, but patterns are stored as variables, so I have added one variable to the $conf. In the form I see the text This is a multilingual variable but if I edit it in one language, the other one is also changed. I suppose it is related to this system_settings_form problem. The module uses page_title_form_alter for implementing hook_form_alter. Does it make sense that multilingual variables are not working for it?
Comment #31
Farreres commentedComment #32
Farreres commentedHehe it seems cron is related to this. When you define a multilingual variable (check write permissions on settings.php to allow editing) just run cron and it works!
Comment #34
wranglon commentedAny news on this? I've been struggling the last week with this issue. I am trying to setup a multilingual website with negotiation domain name only. It's impossible change the front page depending on the language since the multilingual variable support seems broken. When I switch domain and change the Default front page value, it is saved across all domains...