All language share one local string patch

All language share one local string patch

by Zhigang Sun -
Number of replies: 0
By creating a langname_local directory, admin can make our own string for langname. If I make a string in zh_cn_utf8_local, the user who use en, es, ko and etc. can't see the string. I don't know so many languages to patch many _local. So I have this idea.

Create a directory named local_global and construct it just like *_local. In get_string(), read *_local first. If the string is absent, then read local_global, then normal langpack.

The following is the patch:

Index: lib/moodlelib.php
===================================================================
--- lib/moodlelib.php  
+++ lib/moodlelib.php 
@@ -4782,6 +4782,15 @@
             }
         }
         //if local directory not found, or particular string does not exist in local direcotry
+        $localgloballangfile = $location.'local_global'.'/'.$module.'.php';    //second, see if there's a local global file
+        if (file_exists($localgloballangfile)) {
+            if ($result = get_string_from_file($identifier, $localgloballangfile, "\$resultstring")) {
+                eval($result);
+                return $resultstring;
+            }
+        }
+
+        //if local global directory not found, or particular string does not exist in local global direcotry
         $langfile = $location.$lang.'/'.$module.'.php';
         if (file_exists($langfile)) {
             if ($result = get_string_from_file($identifier, $langfile, "\$resultstring")) {
Average of ratings: -