diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index f5be824..f2710a3 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -5379,6 +5379,19 @@ function get_string($identifier, $module='', $a=NULL, $extralocations=NULL) {
         $module = 'moodle';
     }
 
+    // search for parentlanguage use
+    $f = '/lang/'.$lang .'/'.$filetocheck;
+    $locs = array($CFG->dataroot.$f, $CFG->dirroot.$f);
+    $parentlang = '';
+    foreach ($locs as $l) {
+        if (file_exists($l)) {
+            $have_parent = get_string_from_file('parentlanguage', $l, "\$parentlang");
+            break;
+        } else {
+            $have_parent = '';
+        }
+    }
+
 /// If the "module" is actually a pathname, then automatically derive the proper module name
     if (strpos($module, '/') !== false) {
         $modulepath = split('/', $module);
@@ -5495,31 +5508,29 @@ function get_string($identifier, $module='', $a=NULL, $extralocations=NULL) {
 
     foreach ($locations as $location) {
         $langfile = $location.$lang.'/'.$filetocheck;
-        if (file_exists($langfile)) {
-            if ($result = get_string_from_file('parentlanguage', $langfile, "\$parentlang")) {
-                if (eval($result) === FALSE) {
-                    trigger_error('Lang error: '.$identifier.':'.$langfile, E_USER_NOTICE);
-                }
-                if (!empty($parentlang)) {   // found it!
-
-                    //first, see if there's a local file for parent
-                    $locallangfile = $location.$parentlang.'_local'.'/'.$module.'.php';
-                    if (file_exists($locallangfile)) {
-                        if ($result = get_string_from_file($identifier, $locallangfile, "\$resultstring")) {
-                            if (eval($result) === FALSE) {
-                                trigger_error('Lang error: '.$identifier.':'.$locallangfile, E_USER_NOTICE);
-                            }
-                            return $resultstring;
+        if ($have_parent) {
+            if (eval($have_parent) === FALSE) {
+                trigger_error('Lang error: '.$identifier.':'.$langfile, E_USER_NOTICE);
+            }
+            if (!empty($parentlang)) {   // found it!
+
+                //first, see if there's a local file for parent
+                $locallangfile = $location.$parentlang.'_local'.'/'.$module.'.php';
+                if (file_exists($locallangfile)) {
+                    if ($result = get_string_from_file($identifier, $locallangfile, "\$resultstring")) {
+                        if (eval($result) === FALSE) {
+                            trigger_error('Lang error: '.$identifier.':'.$locallangfile, E_USER_NOTICE);
                         }
+                        return $resultstring;
                     }
+                }
 
-                    //if local directory not found, or particular string does not exist in local direcotry
-                    $langfile = $location.$parentlang.'/'.$module.'.php';
-                    if (file_exists($langfile)) {
-                        if ($result = get_string_from_file($identifier, $langfile, "\$resultstring")) {
-                            eval($result);
-                            return $resultstring;
-                        }
+                //if local directory not found, or particular string does not exist in local direcotry
+                $langfile = $location.$parentlang.'/'.$module.'.php';
+                if (file_exists($langfile)) {
+                    if ($result = get_string_from_file($identifier, $langfile, "\$resultstring")) {
+                        eval($result);
+                        return $resultstring;
                     }
                 }
             }
