On my new blog on http://artipc10.vub.ac.be/serendipity there seems to be a problem with the multilingual plugin. As you can see, I have two times English for each post, one time as "default",one time as "en". Is this normal?
I have English defined as the blog's default language, and my personal preferred language for when I'm logged in, is also set to English. However, my Firefox installation prefers Dutch, and because of this, the admin setup appear completely in Dutch. Could this be related to this problem, maybe Serendipity is confused about the default language?
Multilingual plugin: two times English as language
Bug
Further testing confirms that this is indeed the cause of the bug (maybe somebody should move this thread to the bugs forum).
The default language in serendipity is set to English, the preferred language by admin is also English. If admin logs in with an English browser, all is OK: in the multilingual combo box when editing a post, I see Default language and Dutch.
Now if I use a browser which prefers Dutch, then the admin interface will be in Dutch (in contrary to the admin's preferred language. This is already wrong: it's not that because I'm using a browser in another language, that the interface should change language too when I'm logged in!). The languages in the combo box are now: Default and English. There is no Dutch anymore in the combo box, so apparently it thinks Dutch is the default language. When you now create an entry, it is saved as the default language (which in reality is English) and you can add an English translation -> hence two different English versions of the same post on my blog. And of course, you cannot add a Dutch translation, as it's not in the list.
The default language in serendipity is set to English, the preferred language by admin is also English. If admin logs in with an English browser, all is OK: in the multilingual combo box when editing a post, I see Default language and Dutch.
Now if I use a browser which prefers Dutch, then the admin interface will be in Dutch (in contrary to the admin's preferred language. This is already wrong: it's not that because I'm using a browser in another language, that the interface should change language too when I'm logged in!). The languages in the combo box are now: Default and English. There is no Dutch anymore in the combo box, so apparently it thinks Dutch is the default language. When you now create an entry, it is saved as the default language (which in reality is English) and you can add an English translation -> hence two different English versions of the same post on my blog. And of course, you cannot add a Dutch translation, as it's not in the list.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Bug
Hi!
Did you try to disable the option "Use Browser language?" in the global Serendipity configuration?
Best regards,
Garvin
Did you try to disable the option "Use Browser language?" in the global Serendipity configuration?
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
I guess that this would work-around the problem, but I don't consider that an acceptable solution, as this means that anonymous visitors will have to choose language themselves.
Automatic language selection based on browser should only happen for anonymous users. Registered users should always have their own language: if I'm looking at my site in Germany with a local web browser, I don't suddenly want the administration appear in a language which I don't know myself.
This patch fixes this issue:
(PS: I'm currently thinking that probably the one testing for the GET value should be first of all: if I'm explicitely asking for another language with GET variable, this should override cookie setting. And maybe even the test for the preferred language for authenticated users should become before the cookie test: it could be that I have an old cookie lying around, maybe even from another visitor, which I do not want to use).
But then even if I set another language than the default one as my own language, serendipity should still not be confused about the default language, and proposing me to create two different entries for the same language, as it is doing now.
It seems that both $serendipity["lang"] as $serendipity["default_lang"] (what is the difference between these two, as there is also $serendipity["content_lang"]), become nl when I select Dutch as language, even though the blogs's default language is English.
I discovered a related problem in mail notification when a comment is posted: I received the mail notification in the visitor's language instead of the blog's default language.
Automatic language selection based on browser should only happen for anonymous users. Registered users should always have their own language: if I'm looking at my site in Germany with a local web browser, I don't suddenly want the administration appear in a language which I don't know myself.
This patch fixes this issue:
Code: Select all
--- serendipity/include/functions_config.inc.php.orig 2007-03-13 21:47:06.000000000 +0100
+++ serendipity/include/functions_config.inc.php 2007-03-13 21:58:43.000000000 +0100
@@ -806,20 +806,20 @@
if (isset($_REQUEST['user_language']) && (!empty($serendipity['languages'][$_REQUEST['user_language']])) && !headers_sent()) {
serendipity_setCookie('serendipityLanguage', $_REQUEST['user_language']);
}
-
+
if (isset($serendipity['COOKIE']['serendipityLanguage'])) {
if ($serendipity['expose_s9y']) serendipity_header('X-Serendipity-InterfaceLangSource: Cookie');
$lang = $serendipity['COOKIE']['serendipityLanguage'];
} elseif (!empty($serendipity['languages'][$serendipity['GET']['lang_selected']])) {
if ($serendipity['expose_s9y']) serendipity_header('X-Serendipity-InterfaceLangSource: GET');
$lang = $serendipity['GET']['lang_selected'];
- } elseif (serendipity_db_bool($serendipity['lang_content_negotiation'])) {
- if ($serendipity['expose_s9y']) serendipity_header('X-Serendipity-InterfaceLangSource: Content-Negotiation');
- $lang = serendipity_detectLang();
} elseif ($_SESSION['serendipityAuthedUser']) {
if ($serendipity['expose_s9y']) serendipity_header('X-Serendipity-InterfaceLangSource: Database');
$lang = $serendipity['lang'];
- }
+ } elseif (serendipity_db_bool($serendipity['lang_content_negotiation'])) {
+ if ($serendipity['expose_s9y']) serendipity_header('X-Serendipity-InterfaceLangSource: Content-Negotiation');
+ $lang = serendipity_detectLang();
+ }
if (!isset($lang) || !isset($serendipity['languages'][$lang])) {
$lang = $serendipity['lang'];
But then even if I set another language than the default one as my own language, serendipity should still not be confused about the default language, and proposing me to create two different entries for the same language, as it is doing now.
It seems that both $serendipity["lang"] as $serendipity["default_lang"] (what is the difference between these two, as there is also $serendipity["content_lang"]), become nl when I select Dutch as language, even though the blogs's default language is English.
I discovered a related problem in mail notification when a comment is posted: I received the mail notification in the visitor's language instead of the blog's default language.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
In our recent 1.2 testing release we've changed a lot in terms of language detection (see http://board.s9y.org/viewtopic.php?t=8413) so your offered patch currently doesn't apply anymore.
I must admit I'm currently not very deep into the language thing, so I also can't offer an explanation about the lang_selected, lang etc. variables. They're all pretty complicated and I would need to work myself into it again.
Maybe you'd like to check out a 1.2 snapshot testing installation to see how things work there?
The only way to make that work would be to create one additional HTTP request, and then one to redirect to the visitors language again. That would then mean 3 HTTP requests for issuing a comment. Because spammers hits the comment routine often, I don't really think doing that would be a wise idea.
So for this notification mail system to work in the target language of the author, either the whole language system would need to be changed (which would result in a BC break for all plugins and themes out there) or the mail sending system needs to get their own language files that are included based on the author language. This would mean some larger rework as well, which I currently think the effort at least for me is too high - but we could definitely add it to our ToDo-List on SourceForge.net!
Best regards,
Garvin
In our recent 1.2 testing release we've changed a lot in terms of language detection (see http://board.s9y.org/viewtopic.php?t=8413) so your offered patch currently doesn't apply anymore.
I must admit I'm currently not very deep into the language thing, so I also can't offer an explanation about the lang_selected, lang etc. variables. They're all pretty complicated and I would need to work myself into it again.
Maybe you'd like to check out a 1.2 snapshot testing installation to see how things work there?
Sadly this is a problem that won't be really fixable. Notification mails are sent within the page request of the visiting users, and his language determines all language constants that are loaded. SO when a mail is sent, the constants are all in his language. Constants can't be overloaded, so we can'T load the strings of YOUR target language into it there again.I discovered a related problem in mail notification when a comment is posted: I received the mail notification in the visitor's language instead of the blog's default language.
The only way to make that work would be to create one additional HTTP request, and then one to redirect to the visitors language again. That would then mean 3 HTTP requests for issuing a comment. Because spammers hits the comment routine often, I don't really think doing that would be a wise idea.
So for this notification mail system to work in the target language of the author, either the whole language system would need to be changed (which would result in a BC break for all plugins and themes out there) or the mail sending system needs to get their own language files that are included based on the author language. This would mean some larger rework as well, which I currently think the effort at least for me is too high - but we could definitely add it to our ToDo-List on SourceForge.net!
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Sadly multilingual plugin feature were added when the "autodetect user langauge based on host" was not existing, so those two features do collide, as you mention. I'm very sorry for that, but sadly multilingual blogging is a feature that is not used by many Serendipity users - and that means we have little reports of users like you that enable us to look for errors.
Since you already seemed to have a good look at it, do you maybe have a suggestion for patching serendipity 1.2 like you offered a patch for 1.1 that makes it work for you?
Best regards,
Garvin
Sadly multilingual plugin feature were added when the "autodetect user langauge based on host" was not existing, so those two features do collide, as you mention. I'm very sorry for that, but sadly multilingual blogging is a feature that is not used by many Serendipity users - and that means we have little reports of users like you that enable us to look for errors.
Since you already seemed to have a good look at it, do you maybe have a suggestion for patching serendipity 1.2 like you offered a patch for 1.1 that makes it work for you?
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/