Guys,

if i have a string like "Area" but the translation is "Área" (unicode), Coder wrongly detect it as different first letter case.

The fix to be placed on coder_i18n.inc, around line 123, replace:

    // Check the translation first capitable letter.
    if (ctype_upper($msgid[0]) != ctype_upper($msgstr[0])) {
      $rule = array(
        '#warning' => "The first letter in the translation text should have the same capitalisation as it's original text.",
      );
      _coder_error($results, $rule, $severity_name, $lineno, $msgstr);
    }

to

    // Check the translation first capitable letter.
    $first_msgid = drupal_substr($msgid, 0, 1);
    $first_msgstr = drupal_substr($msgstr, 0, 1);
    if (($first_msgid == drupal_strtoupper($first_msgid) and $first_msgstr != drupal_strtoupper($first_msgstr)) or
      ($first_msgid == drupal_strtolower($first_msgid) and $first_msgstr != drupal_strtolower($first_msgstr))) {
      $rule = array(
        '#warning' => "The first letter in the translation text should have the same capitalization as it's original text.",
      );
      _coder_error($results, $rule, $severity_name, $lineno, $msgstr);
    }

regards,

massa

Comments

douggreen’s picture

Version: 6.x-1.0 » 7.x-2.x-dev
Assigned: Unassigned » douggreen
douggreen’s picture

This has not been fixed yet, but the solution here looks a little complicated. I'm going to ask @gabor to comment.

gábor hojtsy’s picture

I would not say that there is an easy way or any way for that matter that Drupal core uses to tell whether characters are collated to the same character but lowercase/uppercase. Theoretically I don't see anything wrong with this patch. Have not tried it.

douggreen’s picture

Status: Needs review » Closed (fixed)