Ticket #5397 (closed defect: fixed)

Opened 2 months ago

Last modified 2 months ago

Some picklist values don't get translated

Reported by: elmue.gmx Assigned to: developer
Priority: minor Milestone: 5.1.0
Component: vtigercrm Version: 5.0.4
Keywords: Cc:

Description

There is a bug in the code which results that the picklist value

"Foods & Beverage" is not translated to other languages.

The reason is that the translation function receives as input:

"Foods & Beverage"

The order of translation and conversion to HTML has to be reverse:

File: DetailViewUtils?.php

Line: 163

Wrong code:

$pickListValue = to_html($pickListValue);

$options[] = array(getTranslatedString($pickListValue),$pickListValue,$chk_val );

Corrected code:

$translatedValue = getTranslatedString($pickListValue);

$options[] = array(to_html($translatedValue), to_html($pickListValue), $chk_val);

Elmü

Change History

11/12/08 08:12:33 changed by elmue.gmx

  • status changed from new to closed.
  • resolution set to fixed.

11/12/08 08:32:19 changed by elmue.gmx

The same applies to EditViewUtils?.php

Additionally there is a SECOND bug in this file: It is nonsense to first apply to_html() and then htmlentities() on the same string!

Wrong code:

$pickListValue = to_html($pickListValue);
if(isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate')
  $options[] = array(htmlentities(getTranslatedString($pickListValue),ENT_QUOTES,$default_charset),$pickListValue,$chk_val );
else
  $options[] = array(getTranslatedString($pickListValue),$pickListValue,$chk_val );

Corrected code:

$translatedValue = getTranslatedString($pickListValue);
if(isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate')
   $options[] = array(htmlentities($translatedValue,ENT_QUOTES,$default_charset),to_html($pickListValue),$chk_val );
else
  $options[] = array(to_html($translatedValue),to_html($pickListValue),$chk_val );