User tests: Successful: Unsuccessful:
Pull Request for Issue # .
Change ActionlogsHelper to load translation files for packages from /language instead of administrator/language
Install a package with a translated package name e.g. YourSites (from https://www.yoursites.net) or JCE (from https://www.joomlacontenteditor.net/) and then view the action logs.
The package name is not translated
The reason is that package language files are installed in the frontend and not the backend language folder but action logs tries to load these from the backend
With the change in this PR action logs load the language files from the frontend and the package name is translated properly
Package name should be translated
Package name is not translated
Status | New | ⇒ | Pending |
Category | ⇒ | Administration |
Adding the pkg is a good idea. That file needs more to cope with other situations.
Please see #22816 (comment)
I never got a reply there.
Sorry, been busy. @infograf768 send it up as a PR.
I'll have a look at the other issue - this PR deals with one specific situation, the translation of package names.
The issue arises because the Installer\parseLanguages method takes a $cid argument.
So strictly speaking my PR should be amended so that the function reads more like:
`public static function loadTranslationFiles($extension)
{
static $cache = array();
$extension = strtolower($extension);
if (isset($cache[$extension]))
{
return;
}
$lang = JFactory::getLanguage();
switch (substr($extension, 0, 3))
{
case 'com':
default:
$source = JPATH_ADMINISTRATOR . '/components/' . $extension;
break;
case 'lib':
$source = JPATH_LIBRARIES . '/' . substr($extension, 4);
break;
case 'mod':
$source = JPATH_SITE . '/modules/' . $extension;
break;
case 'plg':
$parts = explode('_', $extension, 3);
$source = JPATH_PLUGINS . '/' . $parts[1] . '/' . $parts[2];
break;
case 'tpl':
$source = JPATH_BASE . '/templates/' . substr($extension, 4);
break;
}
switch (substr($extension, 0, 3))
{
case 'com':
case 'mod':
case 'tpl':
default:
// Language files can be in frontend or backend only - load priority is extension specific, followed by backend then frontend
$lang->load($extension, $source, null, false, true)
|| $lang->load($extension, JPATH_ADMINISTRATOR, null, false, true)
|| $lang->load($extension, JPATH_SITE, null, false, true);
if (!$lang->hasKey(strtoupper($extension)))
{
$lang->load($extension . '.sys', $source, null, false, true)
|| $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, true)
|| $lang->load($extension . '.sys', JPATH_SITE, null, false, true);
}
break;
case 'plg':
// Language files in backend only
$lang->load($extension, $source, null, false, true)
|| $lang->load($extension, JPATH_ADMINISTRATOR, null, false, true);
if (!$lang->hasKey(strtoupper($extension)))
{
$lang->load($extension . '.sys', $source, null, false, true)
|| $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, true);
}
break;
case 'lib':
case 'pkg':
// Language files in frontend only
$lang->load($extension, $source, null, false, true)
|| $lang->load($extension, JPATH_SITE, null, false, true);
if (!$lang->hasKey(strtoupper($extension)))
{
$lang->load($extension . '.sys', $source, null, false, true)
|| $lang->load($extension . '.sys', JPATH_SITE, null, false, true);
}
break;
}
$cache[$extension] = true;
}`
which is, in essence, a variation on your code. So if you can add the package handling into your PR I can test your PR and we can then close this one.
@GeraintEdwards
Please complete your PR with the right code. More simple. :)
I have tested this item
p.s
@infograf768 for #22816 (comment)
let's continue the issue there.... this is a simple good fix for now ...
@alikon
#22816 is not a PR, just an issue.
Or we create a new PR including the pkg code added here as @GeraintEdwards suggests, or we do complete this one here.
@infograf768 As @alikon says - this current PR is very simple and solves a specific issue.
I'll open a new PR with my second code block as a potential solution to #22816
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-11-17 17:29:49 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
|
Adding the pkg is a good idea. That file needs more to cope with other situations.
Please see #22816 (comment)
I never got a reply there.