Page 1 of 1

Display a message before an untranslated page

Posted: Thu Nov 13, 2008 1:27 am
by will83
Hello,

After the topic I want to display "default language" page if current language page is not ready (empty content)

is it possible to automaticaly display a personalized message (with html) before the {content} tag if a page isn't translated?

Like : This page has not yet been translated into your language navigation. We apologize for the inconvenience...

Thank you & excuse my English, i'm french.

Re: Display a message before an untranslated page

Posted: Thu Nov 13, 2008 7:42 am
by alby
will83 wrote: After the topic I want to display "default language" page if current language page is not ready (empty content)

is it possible to automaticaly display a personalized message (with html) before the {content} tag if a page isn't translated?
In newer version you must browse "manually" for retrieve language page not ready

Alby

Re: Display a message before an untranslated page

Posted: Thu Nov 13, 2008 10:54 pm
by will83
Excuse me, I forgot details.
I use the latest version of MLE, and my untranslated pages contain the contents of the other language.

This would be interesting would be to display a message above the content untranslated (just to inform the user that if he sees his page in French it is not a mistake, but just an untranslated)

Re: Display a message before an untranslated page

Posted: Fri Nov 14, 2008 1:40 pm
by alby
will83 wrote: Excuse me, I forgot details.
I use the latest version of MLE, and my untranslated pages contain the contents of the other language.

This would be interesting would be to display a message above the content untranslated (just to inform the user that if he sees his page in French it is not a mistake, but just an untranslated)
In function.content.php, try to add:
//Start MLE
global $hls, $hl, $mleblock, $mleblockfallback;
$result = $smarty->fetch(str_replace(' ', '_', 'content:'.(isset($params['block']) ? "{$params['block']}{$mleblock}" : 'content_en')), '', $pageinfo->content_id.'-'.$hl);
if(empty($result) && !empty($mleblockfallback))
{
$def_lang = DEFAULT_LANG;
$result = $smarty->fetch(str_replace(' ', '_', 'content:'.(isset($params['block']) ? "{$params['block']}_{$hls[$def_lang]['block']}" : "content_{$hls[$def_lang]['block']}")), '', "{$pageinfo->content_id}-{$def_lang}");
$result = 'This page has not yet been translated into your language navigation. We apologize for the inconvenience... '. $result;
}
//End MLE
report if work
Alby

Re: Display a message before an untranslated page

Posted: Sat Nov 15, 2008 12:54 pm
by will83
Thank you, but it does not work on the untranslated pages that display the default language.

But this code displays the message, but on every page:
// Start MLE
global $hls, $hl, $mleblock, $mleblockfallback;
$result = $smarty->fetch(str_replace(' ', '_', 'content:'.(isset($params['block']) ? "{$params['block']}{$mleblock}" : 'content_en')), '', $pageinfo->content_id.'-'.$hl);
$result = 'This page has not yet been translated into your language navigation. We apologize for the inconvenience... '. $result;
if (empty($result) && !empty($mleblockfallback))
{
$def_lang = DEFAULT_LANG;
$result = $smarty->fetch(str_replace(' ', '_', 'content:'.(isset($params['block']) ? "{$params['block']}_{$hls[$def_lang]['block']}" : "content_{$hls[$def_lang]['block']}")), '', "{$pageinfo->content_id}-{$def_lang}");

}
// End MLE

Re: Display a message before an untranslated page

Posted: Sat Nov 15, 2008 1:02 pm
by alby
will83 wrote: Thank you, but it does not work on the untranslated pages that display the default language.

But this code displays the message, but on every page:
Yes, this is a broke code and disply message in empty page also ....
Use my code and enable DEFAUL LANG FALLBACK in Global settings

Alby

Re: Display a message before an untranslated page

Posted: Mon Nov 17, 2008 12:33 am
by will83
DEFAUL LANG FALLBACK in Global settings is enabled.
I have exactly replace the original code by this one, but the code don't work.
Does this code work for you?

Thank you for your help!

Re: Display a message before an untranslated page

Posted: Mon Nov 17, 2008 6:21 pm
by alby
will83 wrote: Does this code work for you?
No, it was UNTESTED
Tomorrow I try

Alby

Re: Display a message before an untranslated page

Posted: Tue Nov 18, 2008 4:22 pm
by alby
alby wrote: Tomorrow I try
Yes, not work

Alby