Page 1 of 1

NEWS - Translation not showing in Detail Template

Posted: Sat Mar 14, 2015 9:29 pm
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..

Re: NEWS - Translation not showing in Detail Template

Posted: Sat Mar 14, 2015 9:33 pm
by Rolf
Read Optional Extensions at my blog https://www.cmscanbesimple.org/blog/mul ... ade-simple

Re: NEWS - Translation not showing in Detail Template

Posted: Sat Mar 14, 2015 11:02 pm
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?

Re: NEWS - Translation not showing in Detail Template

Posted: Sat Mar 14, 2015 11:05 pm
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?

Re: NEWS - Translation not showing in Detail Template

Posted: Sun Mar 15, 2015 12:32 am
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.

Re: NEWS - Translation not showing in Detail Template

Posted: Tue Mar 17, 2015 8:03 pm
by webxtor
No reply... Strange..

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