The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Fri Apr 20, 2012 6:04 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Dec 21, 2010 11:25 pm
Posts: 109
Hi,
The following may not make sense but bear with me please :-[ .

I have created my own language pack, and I set the language filter plugin to select the language for the user based on their browser settings.

My custom language pack contains a unique language prefex, and I would like the users to be redirected to this language if their browsers are set to Japanese or Chinese for example. How can I set this rule please?


Top
 Profile  
 
PostPosted: Sat Apr 21, 2012 6:11 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16668
Location: **Translation Matters**
What is this "unique language prefix"

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Sat Apr 21, 2012 12:17 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Dec 21, 2010 11:25 pm
Posts: 109
Hi infograf,
Thank you for your reply. The unique language prefix is cj-CJ.


Top
 Profile  
 
PostPosted: Sat Apr 21, 2012 5:20 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16668
Location: **Translation Matters**
Redirect to Browsers settings is only possible for New Visitors in the languagefilter plugin. Therefater, a cookie is set and it is the last language used that should display.
(There is a bug in 2.5.4 which is now corrected in trunk and will be available in next release)
Redirecting from zh-CN or zh-TW or ja-JP to this artificial language code would imply a hack of the plugin.

I do not think it is a good idea. Search engines will choke on this unexisting language code.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Sat Apr 21, 2012 6:20 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Dec 21, 2010 11:25 pm
Posts: 109
infograf768 wrote:
Redirect to Browsers settings is only possible for New Visitors in the languagefilter plugin. Therefater, a cookie is set and it is the last language used that should display.


Yes I completely understand this, however it is a feature that is very helpful feature nonetheless. :)

infograf768 wrote:
Redirecting from zh-CN or zh-TW or ja-JP to this artificial language code would imply a hack of the plugin.

I do not think it is a good idea. Search engines will choke on this unexisting language code.


I think this was quite a given based on the title of the post. I know overrides are not recommended, but I realy need this feature and would really appreciate if you could help me achieve it ;) . Regarding the search engines, I can change the xml:lang="" to a valid prefix. I just need all the users that have set their Browser Language to Chinese or Japanese to be directed to the custom language part of my website :) .


Top
 Profile  
 
PostPosted: Sat May 05, 2012 3:36 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Dec 21, 2010 11:25 pm
Posts: 109
Question, could this be done using the locale tag in the language?


Top
 Profile  
 
PostPosted: Sat May 05, 2012 4:16 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16668
Location: **Translation Matters**
The locale is only used (when server permits, which is usually the case for only a few languages) for items ordering in Managers.

I suggest you just batch copy the concerned items in Japanese and Chinese, making them correct Content Languages, as should.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Sat May 05, 2012 4:35 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Dec 21, 2010 11:25 pm
Posts: 109
I have thought about this but it won't work efficiently. As, I would then have a multiple of all the articles, menus, and modules. I would then have to change the language switcher to include all the languages as one flag.

Rather, if I can just find where the comparison is done in the languagefilter plugin between the browser language and the site languages, then I can just add an if statement to it with my grouped languages.

I believe you have great knowledge in this, could you advise me on this? I'm presuming it's somewhere before the cookie is created, however am still rather new to the code being used in such plugin. Is it in the "public function __construct(&$subject, $config)" function?


Top
 Profile  
 
PostPosted: Sat May 05, 2012 4:58 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16668
Location: **Translation Matters**
Quote:
I have thought about this but it won't work efficiently. As, I would then have a multiple of all the articles, menus, and modules.


You can avoid easily the duplicate for articles.
Create a Home menu item and its menu and menu module for Japanese and same for Chinese.
Then, just create a ROOT article category set to ALL and sub-categories to fit + tag all the articles concerned to ALL.
Then create Menus for each language with menu items linking to these articles and tagged to the language concerned (Japanese or Chinese) + their menu modules also tagged to these languages.

In this case the duplication is only necessary for menus and their menu items, and their respective menu modules.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Sat May 05, 2012 5:43 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Dec 21, 2010 11:25 pm
Posts: 109
It will show the users in each region the same content yes, but it will give me two flags. I will also have other languages that do not need to be grouped too, e.g. english and german. This means I'll still need to modify code, but instead of the languagefilter, it would be the languageswitcher module.

I have thought about this extensively. By choosing the langaugefilter route, I won't have any "extras" to maintain in the backend (eg when adding menu items), and all the grouping can be done via the plugin.

I'm just trying to to get a working solution. After that in terms of hacking, a new plugin could be created, and the default languagefilter plugin disabled.


Top
 Profile  
 
PostPosted: Sun May 06, 2012 5:44 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16668
Location: **Translation Matters**
If you go on this way, you will need a lot of hacks.
The function is
public static function detectLanguage()
in the library file
/libraries/joomla/language/helper.php

This is used in many parts of Joomla, including installation.
I advise you to NOT touch this. You would be on your own.

What maybe could be done is to create a new specific function of that type with conditionals in languagefilter.php or in a helper to languagefilter where you would play with
$primary_browserLang

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Mon May 07, 2012 12:37 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Dec 21, 2010 11:25 pm
Posts: 109
Thank you very much for that information and advice. I will inspect those files and try what you suggested. This has been much appreciated. :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 



Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group