From 680ebf23157e0d8fe17f7ebc7e16fbaff9f9c4cd Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Tue, 29 Dec 2015 12:14:51 +0000 Subject: [PATCH] MDL-50829 lang: fix to RTL/LTR bracket confusion Thanks to ISHIKAWA Takayuki for the initial patch --- admin/tool/langimport/index.php | 2 +- lib/classes/string_manager_standard.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/admin/tool/langimport/index.php b/admin/tool/langimport/index.php index b49dbd3a74e..f25a07cbb11 100644 --- a/admin/tool/langimport/index.php +++ b/admin/tool/langimport/index.php @@ -176,7 +176,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].' ‎('.$alang[0].')‎'; } } if (!empty($options)) { diff --git a/lib/classes/string_manager_standard.php b/lib/classes/string_manager_standard.php index 38687d19d1d..4d6666fb2be 100644 --- a/lib/classes/string_manager_standard.php +++ b/lib/classes/string_manager_standard.php @@ -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; } }