From 573b5fc879f7f43d4e72fae460892d1da16ac37c Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Wed, 28 Mar 2018 11:29:18 +0000 Subject: [PATCH] Fallback to the default language, for missing entries in the current language, in the dictionary passed client-side. SVN:b1162[5553] --- core/dict.class.inc.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/dict.class.inc.php b/core/dict.class.inc.php index 0e2cdd466..b792660e8 100644 --- a/core/dict.class.inc.php +++ b/core/dict.class.inc.php @@ -359,14 +359,27 @@ class Dict /** * Export all the dictionary entries - of the given language - whose code matches the given prefix + * missing entries in the current language will be replaced by entries in the default language * @param string $sStartingWith * @return string[] */ public static function ExportEntries($sStartingWith) { self::InitLangIfNeeded(self::GetUserLanguage()); + self::InitLangIfNeeded(self::$m_sDefaultLanguage); $aEntries = array(); $iLength = strlen($sStartingWith); + + // First prefill the array with entries from the default language + foreach(self::$m_aData[self::$m_sDefaultLanguage] as $sCode => $sEntry) + { + if (substr($sCode, 0, $iLength) == $sStartingWith) + { + $aEntries[$sCode] = $sEntry; + } + } + + // Now put (overwrite) the entries for the user language foreach(self::$m_aData[self::GetUserLanguage()] as $sCode => $sEntry) { if (substr($sCode, 0, $iLength) == $sStartingWith)