Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-70289

Fix AMOS translator backslash escaping

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.5.15, 3.7.9, 3.8.6, 3.9.3, 3.10
    • Fix Version/s: None
    • Component/s: Calendar, General, Language
    • Labels:
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_35_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE

      Description

      AMOS translator breaks translations when importing from file when the strings end in single quotes escaped by backslashes. Example in slovenian:

      Local (already fixed) translation in Moodle for string

      'core_completion/completionexpectedfor':
      Pričakovana zaključenost za '{$a->modulename}' dejavnost '{$a->instancename}'

       

      Saved PHP file moodledata/lang/sl_local/completion.php:

      $string['completionexpectedfor'] = 'Pričakovana zaključenost za \'{$a->modulename}\' dejavnost \'{$a->instancename}\'';

       

      Text to be imported to AMOS from said file:

      Pričakovana zaključenost za '{$a->modulename}' dejavnost '{$a->instancename}\
      

       When I searched for strings ending with a backslash in AMOS, I found 317 hits in default English. We stumbled across this problem, when the Timeline started throwing an error described in this issue and fixed it by changing the local translations and running the query on the database manually:

      UPDATE mdl_event SET name = REGEXP_REPLACE( name,"\\\\$","'") WHERE name LIKE "%\\";
      

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              tjazbec Timotej Jazbec
              Participants:
              Component watchers:
              Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, David Mudrák (@mudrd8mz), Helen Foster, Víctor Déniz Falcón
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: