The error messages can't be translated

mairav - September 6, 2009 - 07:02
Project:CustomError
Version:6.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I had to hack the customerror.module file and the t() to the title and output, so I can translated to different languages.

#1

mairav - September 6, 2009 - 07:03

Sorry, I miss the word "add" before. I mean, I had to add the t() function to the title and output, so they can be translated.

#2

mairav - September 28, 2009 - 21:17

Me again.

It can be translated if the message is static, but if it has some programming as the 403 error, it doesn't work, cause I would need to translate the same text for each user or page the user tryes to go in.

So, I change what I did before, only adding the t() funcion to the title. In customerror.module around line 163 you'll find:

      drupal_set_title(variable_get('customerror_'. $code .'_title', _customerror_fetch_error($code)));

that I changed for:

      drupal_set_title(t(variable_get('customerror_'. $code .'_title', _customerror_fetch_error($code))));

Then, in admin/settings/customerror I allow PHP code to be executed for 404 and 403 and added the following:

<?php
global $language;
if (
$language->language == 'en') {
?>


<p>Sorry, no content was found at the requested path - it's possible that you've requested this page in error.</p>
<p>Go to the <a href="/en" title="Home Page">home page</a> or visit the <a href="sitemap" title="Site Map">site map</a>.</p>

<?php }else{?>

<p>Disculpe, no se ha encontrado contenido en la página solicitada. Es posible que haya solicitado esta página por error.</p>
<p>Vaya a la <a href="/" title="Página de Inicio">página de inicio</a> o visite el <a href="mapa-del-sitio" title="Mapa del Sitio">mapa del sitio</a>.</p>


<?php } ?>

It's not great, but at least the error messages are translated.

 
 

Drupal is a registered trademark of Dries Buytaert.