MDL-50829 lang: fix to RTL/LTR bracket confusion
authorDan Poltawski <dan@moodle.com>
Tue, 29 Dec 2015 12:14:51 +0000 (12:14 +0000)
committerDan Poltawski <dan@moodle.com>
Tue, 29 Dec 2015 12:30:18 +0000 (12:30 +0000)
Thanks to ISHIKAWA Takayuki for the initial patch

admin/tool/langimport/index.php
lib/classes/string_manager_standard.php

index c1ee2fb..6017717 100644 (file)
@@ -188,7 +188,7 @@ echo html_writer::end_tag('td');
 $options = array();
 foreach ($availablelangs as $alang) {
     if (!empty($alang[0]) and trim($alang[0]) !== 'en' and !$controller->is_installed_lang($alang[0], $alang[1])) {
-        $options[$alang[0]] = $alang[2].' ('.$alang[0].')';
+        $options[$alang[0]] = $alang[2].' &lrm;('.$alang[0].')&lrm;';
     }
 }
 if (!empty($options)) {
index 38687d1..4d6666f 100644 (file)
@@ -532,6 +532,11 @@ class core_string_manager_standard implements core_string_manager {
         $langdirs = get_list_of_plugins('', 'en', $this->otherroot);
         $langdirs["$CFG->dirroot/lang/en"] = 'en';
 
+        // We use left to right mark to demark the shortcodes contained in LTR brackets, but we need to do
+        // this hacky thing to have the utf8 char until we go php7 minimum and can simply put \u200E in
+        // a double quoted string.
+        $lrm = json_decode('"\u200E"');
+
         // Loop through all langs and get info.
         foreach ($langdirs as $lang) {
             if (strrpos($lang, '_local') !== false) {
@@ -548,7 +553,7 @@ class core_string_manager_standard implements core_string_manager {
             }
             $string = $this->load_component_strings('langconfig', $lang);
             if (!empty($string['thislanguage'])) {
-                $languages[$lang] = $string['thislanguage'].' ('. $lang .')';
+                $languages[$lang] = $string['thislanguage'].' '.$lrm.'('. $lang .')'.$lrm;
             }
         }