NEWS - Translation not showing in Detail Template

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
webxtor
New Member
New Member
Posts: 5
Joined: Wed Mar 11, 2015 8:28 pm

NEWS - Translation not showing in Detail Template

Post by webxtor »

I am building a multilingual web site.

By absolutely no means cannot get the new module details page system text strings like author, date to be translated.

I found a similar thread:

http://forum.cmsmadesimple.org/viewtopi ... 28&t=61075

But the solution will not work for me, as I would need it for 3 languages to be set automatically. And why to translate the strings within the template if they are already translated within the module.

Just need to find a way to tell the module to use the language set in URL.
Or somehow change the site default language "on fly".

Thanks for looking..
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: NEWS - Translation not showing in Detail Template

Post by Rolf »

Read Optional Extensions at my blog https://www.cmscanbesimple.org/blog/mul ... ade-simple
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
webxtor
New Member
New Member
Posts: 5
Joined: Wed Mar 11, 2015 8:28 pm

Re: NEWS - Translation not showing in Detail Template

Post by webxtor »

Thanks for the fast reply, but I don't quite understand...

Do you suggest to alter the news module detail page template to change say {$author_label} that I am desperately trying to become language aware to something like:

{$languagestring.author_label} ?

And this way, again, manually translate the already translated module?
webxtor
New Member
New Member
Posts: 5
Joined: Wed Mar 11, 2015 8:28 pm

Re: NEWS - Translation not showing in Detail Template

Post by webxtor »

Can't I somehow change the $param['lang'] from within the UDT or something before it will affect the news module detail page?
webxtor
New Member
New Member
Posts: 5
Joined: Wed Mar 11, 2015 8:28 pm

Re: NEWS - Translation not showing in Detail Template

Post by webxtor »

I've came up with a VERY dirty solution.. But it works towards the way it should be:

Code: Select all

$_SERVER['REQUEST_URI_PATH'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$segments = explode('/', $_SERVER['REQUEST_URI_PATH']);

if (isset($segments[1]) && strlen($segments[1]) == 2) {
	$lang = $segments[1];
	$page_lang=$lang;//$cgsimple->get_root_alias();
	if ($page_lang=='en') {
		$page_lang_suffix = "US";
	} else {
		$page_lang_suffix = strtoupper($page_lang);
	}

	if (get_site_preference('frontendlang') != $page_lang.'_'.$page_lang_suffix){
		set_site_preference('frontendlang',$page_lang.'_'.$page_lang_suffix);
		header('Location: '.$_SERVER['REQUEST_URI']);
		exit;
	}
}
If I put this into a UDT included as the first thing in the template, it works.
webxtor
New Member
New Member
Posts: 5
Joined: Wed Mar 11, 2015 8:28 pm

Re: NEWS - Translation not showing in Detail Template

Post by webxtor »

No reply... Strange..

Another question, is how to make news articles to be linked with each their correspondences in other languages?
Post Reply

Return to “The Lounge”