From 54f2d0c49ef97ca0364d2b7e03419f1605ca6c36 Mon Sep 17 00:00:00 2001
From: Marina Glancy <marina@moodle.com>
Date: Sat, 20 Jul 2019 18:02:56 +0300
Subject: [PATCH] MDL-66197 core: correct get parent language

---
 lib/moodlelib.php | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index ea2f517105f..9f1430d26aa 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -7070,21 +7070,12 @@ function current_language() {
  */
 function get_parent_language($lang=null) {
 
-    // Let's hack around the current language.
-    if (!empty($lang)) {
-        $oldforcelang = force_current_language($lang);
-    }
+    $parentlang = get_string_manager()->get_string('parentlanguage', 'langconfig', null, $lang);
 
-    $parentlang = get_string('parentlanguage', 'langconfig');
     if ($parentlang === 'en') {
         $parentlang = '';
     }
 
-    // Let's hack around the current language.
-    if (!empty($lang)) {
-        force_current_language($oldforcelang);
-    }
-
     return $parentlang;
 }