Home

OFF-SOFT.net

OFF-SOFT.net

This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?[:]

Joom! Fish to set the default language of the user's first visit

Published on| April 6th, 2009 | No Comment.
Description:
To manage the site, Joom! Fish Upon introduction, the language user to make the first visit, I thought I should do? Typically, a good site in the native language of management, which manages the site, you automatically switching requests in the language specified in each user's Web browser. When such, Joom! Fish, Should I choose?

Joom! Fish set in
The following screen plugins (extensions - plug-in), you have to switch automatically the parameters specified in each user's browser language.
Let's set.
System - jfrouter selections.


Parameter settings (right) in the "Language selection for new visitors? "" Browser settings "you set.


This designation means the following.
Ordering of languages in Joom! Fish component Joom! Fish language in order to follow
Browser settings Follow the user's browser language settings
Site default language Joomla! To specify the default language sites are specified in

If a user has specified a language, and works well with the above.
However, by the user, to prioritize, you may have specified more than one language. (I think that many Japanese set the browser language to Japanease at first language , English at secound language. ) At this time, in order of priority, may not be able to choose correctly.


To address this, the following is a good change I'll give you some source code.

/plugin/system/jfrouter.php Line 186 around, and the following changes, you can choose correctly.

Previous the change)
1
2
3
4
5
6
7
8
foreach ($activeLanguages as $alang) {
	$active_iso[] = $alang->iso;
	if( eregi('[_-]', $alang->iso) ) {
		$isocountry = split('[_-]',$alang->iso);
		$active_isocountry[] = $isocountry[0];
	}
	$active_code[] = $alang->shortcode;
}

After the change)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
foreach ($activeLanguages as $alang) {
//	--start--  add languae priority
	$iso_array = split(',',$alang->iso);
	if(isset($iso_array) && count($iso_array)>0){
		foreach ($iso_array as $alang2_iso) {
			$alang2_iso=trim($alang2_iso);
			$active_iso[] = $alang2_iso;
			$isocountry = split('[_-]',$alang2_iso);
			if(isset($isocountry) && count($isocountry)>0){
				$active_isocountry[] = $isocountry[0];
			}
			$active_code[] = $alang->shortcode;
		}
	} else {
//	--end-- add languae priority
		$active_iso[] = $alang->iso;
		if( eregi('[_-]', $alang->iso) ) {
			$isocountry = split('[_-]',$alang->iso);
			$active_isocountry[] = $isocountry[0];
		}
		$active_code[] = $alang->shortcode;
//	--start-- add languae priority
	}
//	--end-- add languae priority
}


Comments

Leave a Reply







  • はてなブックマークへ追加する
  • Facebookでシェアする
  • twitter でつぶやく
  • Google Plusでシェアする
  • Pocketでシェアする
ページトップへ