Skip to content

Commit

Permalink
MDL-50829 lang: fix to RTL/LTR bracket confusion
Browse files Browse the repository at this point in the history
Thanks to ISHIKAWA Takayuki for the initial patch
  • Loading branch information
danpoltawski committed Dec 29, 2015
1 parent ea3ebbf commit 0a7051f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion admin/tool/langimport/index.php
Expand Up @@ -188,7 +188,7 @@
$options = array(); $options = array();
foreach ($availablelangs as $alang) { foreach ($availablelangs as $alang) {
if (!empty($alang[0]) and trim($alang[0]) !== 'en' and !$controller->is_installed_lang($alang[0], $alang[1])) { 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)) { if (!empty($options)) {
Expand Down
7 changes: 6 additions & 1 deletion lib/classes/string_manager_standard.php
Expand Up @@ -532,6 +532,11 @@ public function get_list_of_translations($returnall = false) {
$langdirs = get_list_of_plugins('', 'en', $this->otherroot); $langdirs = get_list_of_plugins('', 'en', $this->otherroot);
$langdirs["$CFG->dirroot/lang/en"] = 'en'; $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. // Loop through all langs and get info.
foreach ($langdirs as $lang) { foreach ($langdirs as $lang) {
if (strrpos($lang, '_local') !== false) { if (strrpos($lang, '_local') !== false) {
Expand All @@ -548,7 +553,7 @@ public function get_list_of_translations($returnall = false) {
} }
$string = $this->load_component_strings('langconfig', $lang); $string = $this->load_component_strings('langconfig', $lang);
if (!empty($string['thislanguage'])) { if (!empty($string['thislanguage'])) {
$languages[$lang] = $string['thislanguage'].' ('. $lang .')'; $languages[$lang] = $string['thislanguage'].' '.$lrm.'('. $lang .')'.$lrm;
} }
} }


Expand Down

0 comments on commit 0a7051f

Please sign in to comment.