MDL-50829 lang: fix to RTL/LTR bracket confusion

Thanks to ISHIKAWA Takayuki for the initial patch
This commit is contained in:
Dan Poltawski 2015-12-29 12:14:51 +00:00
parent ea3ebbf20e
commit 0a7051ff5a
2 changed files with 7 additions and 2 deletions

View 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].' ‎('.$alang[0].')‎';
}
}
if (!empty($options)) {

View 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;
}
}