mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-12-04 19:03:26 +00:00
Merge pull request #210 from dryabov/patch-75
Add support of "modern" language filenames (without language tag prefix)
This commit is contained in:
commit
64a81007e7
@ -268,12 +268,12 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule
|
|||||||
* Locate and load extension's .sys.ini translation file
|
* Locate and load extension's .sys.ini translation file
|
||||||
*
|
*
|
||||||
* @param SimpleXMLElement $xml Extension's XML manifest
|
* @param SimpleXMLElement $xml Extension's XML manifest
|
||||||
* @param string $langDir The basepath
|
* @param string $rootDir The basepath
|
||||||
* @param string $langTag The language to load
|
* @param string $langTag The language to load
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function loadExtensionLanguage($xml, $langDir, $langTag = 'en-GB')
|
protected function loadExtensionLanguage($xml, $rootDir, $langTag = 'en-GB')
|
||||||
{
|
{
|
||||||
// Get extension's element name (simulates work of Joomla's installer)
|
// Get extension's element name (simulates work of Joomla's installer)
|
||||||
$extension = JEDCheckerHelper::getElementName($xml);
|
$extension = JEDCheckerHelper::getElementName($xml);
|
||||||
@ -334,19 +334,25 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule
|
|||||||
|
|
||||||
$lookupLangDirs = array_unique($lookupLangDirs);
|
$lookupLangDirs = array_unique($lookupLangDirs);
|
||||||
|
|
||||||
|
$lookupLangFiles = array(
|
||||||
|
$langTag. '.' . $extension . '.sys.ini', // classical filename
|
||||||
|
$extension . '.sys.ini', // modern filename
|
||||||
|
);
|
||||||
|
|
||||||
// Looking for language file in specified directories
|
// Looking for language file in specified directories
|
||||||
foreach ($lookupLangDirs as $dir)
|
foreach ($lookupLangDirs as $dir)
|
||||||
{
|
{
|
||||||
$langSysFile =
|
foreach ($lookupLangFiles as $file)
|
||||||
$langDir . '/' .
|
{
|
||||||
($dir === '' ? '' : $dir . '/') .
|
$langSysFile = $rootDir . '/' . ($dir === '' ? '' : $dir . '/') . $file;
|
||||||
$langTag. '.' . $extension . '.sys.ini';
|
|
||||||
if (is_file($langSysFile))
|
if (is_file($langSysFile))
|
||||||
{
|
{
|
||||||
$loadLanguage = new ReflectionMethod($lang, 'loadLanguage');
|
$loadLanguage = new ReflectionMethod($lang, 'loadLanguage');
|
||||||
$loadLanguage->setAccessible(true);
|
$loadLanguage->setAccessible(true);
|
||||||
$loadLanguage->invoke($lang, $langSysFile, $extension);
|
$loadLanguage->invoke($lang, $langSysFile, $extension);
|
||||||
break;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user