Ticket #380 (new enhancement)

Opened 4 months ago

Last modified 4 months ago

My enhancement in utils/i18n.php

Reported by: mariuszekpl Assigned to: nobody
Priority: normal Milestone: 0.9.1
Component: core Version: 0.9.1
Severity: normal Keywords: i18n, translation, enhancement
Cc: Patch Included: 1
Review Stage: unreviewed

Description

I add small enhancement in utils/i18n.php

I add code in function scan() before $result[]= array('file'=>$_file,'string'=>$_line);

          if ( strlen($_line)>1  )
          {
            // change first char ' to "
            if ($_line[0]="'")
              $_line[0] = '"';

            // change last char ' to "
            if ($_line[strlen($_line)-1]="'")
              $_line[strlen($_line)-1] = '"';

            // replace \' to '
            $_line=str_replace("\'","'" ,$_line);


            // replace " to \" in text but not first end last char "
            // 1) copy only text
            $_only_text=substr($_line,1, strlen($_line) -2);
            //
            $_only_text=str_replace('\"','"' ,$_only_text);
            $_only_text=str_replace('"','\"' ,$_only_text);

            $_line= $_line[0].$_only_text.    $_line[strlen($_line)-1];

          }
          $result[]= array('file'=>$_file,'string'=>$_line);

This code fix: -error when last and first char is ' -error when in string is \' -error when in string is char "

Attachments

i18n.php (7.6 kB) - added by mariuszekpl on 07/23/08 10:47:34.
My i18n.php file

Change History

07/23/08 10:47:34 changed by mariuszekpl

  • attachment i18n.php added.

My i18n.php file

07/23/08 10:58:15 changed by mariuszekpl

  • keywords set to i18n, translation, enhancement.
  • haspatch set to 1.