Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-10-05 10:11:37
- policleto
- Member
- From: Pisa, Italy
- Registered: 2007-08-28
- Posts: 24
Language override on a specified Section
Hi,
I’m trying to use a specified language (italian) on a section overriding the default language settings for the site (which is english).
I found a plugin: cbs_section_language
But it does not seems to work on my TXP 4.2.0
Any ideas on the right way to achieve this behavior?
Thanks in advance for your help!
— Antonio
Offline
Re: Language override on a specified Section
policleto wrote:
I found a plugin: cbs_section_language But it does not seems to work on my TXP 4.2.0
In what way does it not work? It seems to work fine for me in 4.2.0. I visited Advanced Prefs, entered about in the cbs_section_language_sections box and fr-fr in the cbs_section_language_languages box. When I saved the changes and viewed the site’s about section, the comment form labels and navigation items were rendered in French. What are you expecting the plugin to do for you?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#3 2009-10-05 11:36:06
- policleto
- Member
- From: Pisa, Italy
- Registered: 2007-08-28
- Posts: 24
Re: Language override on a specified Section
Exactly this, but I notice now that also my form labels are in italian. I had comments disabled.
The date is still in English (month names for example) which was the fact that made me think the plugin was not doing the work.
Can you check if you have the same issue?
Thank you.
Last edited by policleto (2009-10-05 11:38:04)
Offline
Re: Language override on a specified Section
policleto wrote:
The date is still in English (month names for example)
Ahhh right, yes, my dates are in English too. This is because the plugin is only changing the language and not updating the locale. You could try editing the plugin. Towards the bottom of the plugin, find the line $prefs['language'] = $language;
and add these lines after it:
$lang_parts = explode('-', $language);
$orig_locl = explode('.', $prefs['locale']);
$new_locl = $lang_parts[0] . '_' . strtoupper($lang_parts[1]) . '.' . $orig_locl[1];
setlocale(LC_ALL, $new_locl);
I think that should fix it. Don’t think it has any other side effects, though it’s not rigorously tested.
If it works, you might want to contact Christophe directly and ask if he’d mind updating the plugin officially to do something like the above (he can probably find a better way to do it); though he might consider it is outside the scope of the plugin.
Hope it helps.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#5 2009-10-05 12:33:12
- policleto
- Member
- From: Pisa, Italy
- Registered: 2007-08-28
- Posts: 24
Re: Language override on a specified Section
It works as expected.
Thanks for your help.
Offline