Recent Topics

1 Jun 30, 2006 05:33    

When a guest visits the page and has a special locale, lets say fr-fr, _main.inc.php handles it properly setting the locale as that value, but then it is overwritten in _blog_main.inc.php on line 142 with:

$Debuglog->add( 'Activating blog locale: '.$Blog->get('locale'), 'locale' );
locale_activate( $Blog->get('locale') );

It is originally and correctly set in _main.inc.php on line 381 with:

$default_locale = locale_from_httpaccept(); // set default locale by autodetect
$Debuglog->add( 'default_locale from HTTP_ACCEPT: '.$default_locale, 'locale' );

if( ($locale_from_get = param( 'locale', 'string', NULL, true ))
		&& $locale_from_get != $default_locale
		&& isset( $locales[$locale_from_get] ) )
{
	$default_locale = $locale_from_get;
	$Debuglog->add( 'Overriding locale from REQUEST: '.$default_locale, 'locale' );
}

Could be quite a problem of international users...

2 Jun 30, 2006 06:07

Someone smarter than me can correct this, but AFAIK the way localization works prioritizes stuff is visitor then blog then post, meaning a post written in BL-AH will be displayed that way even if the visitor prefers FO-OO for their locale. I'm sorta pretty sure that's right, and it sort of makes sense if you figure the post is written in "BL-AH" so why display any of the stock content in "FO-OO".

I could be extremely wrong!

3 Jun 30, 2006 06:09

Eh... The locales are only used to translate things like;
This post was written by blah
Login
Categories
Etc.

Not the actual post contents.

But yeh, just commenting out the first code snippet i posted above works, but not sure wether it is the correct fix...

4 Jul 01, 2006 01:04

I've commented it out locally, also.

François said that it's a feature, but I really don't get, why a blog's locale (which cannot be "NULL") should override the user's profile or browser settings..

5 Jul 01, 2006 01:11

But the only thing the user wouldn't want in their own language is a post's contents, everything else should be translated... Which happens anyway...

As far as i can see it, the users/guests locale should be used, and the blog locales should only be used as a last resort... and for the post's contents but post locales are specified by the post, not the blogs default...

Doesn't really make sense to me at all why their even is blog locales...

6 Jul 01, 2006 01:25

I'd say to use a flag (global var) in _main.inc.php to remember if a user specific locale has been set (other than the global default locale).

If so, the blog should not override it.

I've asked François to comment on this, so let's wait and see what he says about it.

7 Jul 01, 2006 14:30

Imagine your own locale is japanese and you visit a blog written in english.

All the posts are in English. There is no point in having "next page" "archives" "categories" etc written in Japanese. This is why blog locale has priority over user locale.

Next, now imagine ONE of all the posts is not in English but in German, as an exception. There is no point in having german text followed by "=> More" or "leave a comment" written in English or in Japanese. "more" should be in German. This is why post locale has absolute priority.

This is how it works and EdB's got it right. And I intend to keep it as such by default.

Now I realize there may be specific situations where this doesn't fit your needs. Commenting out the switches is okay.

If you want you can put options into the individual blog settings. I'd go for a radio button like:
Localization:
o Posts by post (default) (= current behaviour)
o Blog locale (disables post by post)
o User locale (disables blog locale)

Any further discussion on this topic should go there:
http://todo.b2evolution.net/todo.php?title=locale_switching_priorities&more=1&c=1&tb=1&pb=1


Form is loading...