Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions component/admin/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@
default=".sys"
label="COM_LOCALISE_LABEL_SUFFIXES"
description="COM_LOCALISE_LABEL_SUFFIXES_DESC" />
<field
name="priority"
type="radio"
class="btn-group btn-group-yesno"
default="0"
label="COM_LOCALISE_LABEL_PRIORITY"
description="COM_LOCALISE_LABEL_PRIORITY_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="clientID"
type="text"
Expand Down
7 changes: 5 additions & 2 deletions component/admin/helpers/localise.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,11 +515,14 @@ public static function isCorePackage($path)
*/
public static function findTranslationPath($client, $tag, $filename)
{
$path = static::getTranslationPath($client, $tag, $filename, 'local');
$params = JComponentHelper::getParams('com_localise');
$priority = $params->get('priority', '0') == '0' ? 'global' : 'local';
$path = static::getTranslationPath($client, $tag, $filename, $priority);

if (!is_file($path))
{
$path = static::getTranslationPath($client, $tag, $filename, 'global');
$priority = $params->get('priority', '0') == '0' ? 'local' : 'global';
$path = static::getTranslationPath($client, $tag, $filename, $priority);
}

return $path;
Expand Down
2 changes: 2 additions & 0 deletions component/admin/language/en-GB/en-GB.com_localise.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ COM_LOCALISE_LABEL_COPYRIGHT="Copyright"
COM_LOCALISE_LABEL_COPYRIGHT_DESC="Standard copyright information"
COM_LOCALISE_LABEL_LICENSE="License"
COM_LOCALISE_LABEL_LICENSE_DESC="GNU/GPL"
COM_LOCALISE_LABEL_PRIORITY="Priority to extension folder"
COM_LOCALISE_LABEL_PRIORITY_DESC="If the file exists, setting this to Yes will present as reference the files from the extension folder. Default is No, i.e. use the files from core folder."
COM_LOCALISE_LABEL_SUFFIXES="Suffixes of language's files"
COM_LOCALISE_LABEL_SUFFIXES_DESC="Enter the suffixes of your language files. Separate suffixes with a comma. Example: if the name of your language files are 'en-GB.com_admin.sys.ini' and 'en-GB.com_admin.menu.ini', suffixes should be '.sys, .menu'"

Expand Down
73 changes: 32 additions & 41 deletions component/admin/models/translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,53 +425,44 @@ private function scanReference()
{
foreach ($files as $file)
{
// Coping with Core files not considered as reference
if ($file == $reftag . '.com_messages.ini' || $file == $reftag . '.com_mailto.sys.ini'
|| $file == $reftag . '.com_wrapper.ini'|| $file == $reftag . '.com_wrapper.sys.ini' || $file == $reftag . '.finder_cli.ini'
|| $file == $reftag . '.com_weblinks.ini' || $file == $reftag . '.com_weblinks.sys.ini' || $file == $reftag . '.mod_weblinks.ini'
|| $file == $reftag . '.mod_weblinks.sys.ini' || $file == $reftag . '.plg_finder_weblinks.ini' || $file == $reftag . '.plg_finder_weblinks.sys.ini'
|| $file == $reftag . '.plg_search_weblinks.ini' || $file == $reftag . '.plg_search_weblinks.sys.ini'
|| $file == $reftag . '.plg_installer_webinstaller.ini' || $file == $reftag . '.plg_installer_webinstaller.sys.ini')
{
$reftaglength = strlen($reftag);
$reftaglength = strlen($reftag);

$name = substr($file, 0, -4);
$name = substr($name, $reftaglength + 1);
$name = substr($file, 0, -4);
$name = substr($name, $reftaglength + 1);

$origin = LocaliseHelper::getOrigin($name, $client);
$origin = LocaliseHelper::getOrigin($name, $client);

foreach ($tags as $tag)
foreach ($tags as $tag)
{
if (JFile::exists($client_folder . '/' . $tag . '/' . $tag . '.xml'))
{
if (JFile::exists($client_folder . '/' . $tag . '/' . $tag . '.xml'))
if (array_key_exists("$client|$reftag|$name", $this->translations))
{
if (array_key_exists("$client|$reftag|$name", $this->translations))
{
$reftranslation = $this->translations["$client|$reftag|$name"];
$reftranslation = $this->translations["$client|$reftag|$name"];

if (array_key_exists("$client|$tag|$name", $this->translations))
{
$this->translations["$client|$tag|$name"]->setProperties(array('refpath' => $reftranslation->path, 'state' => 'inlanguage'));
}
else
{
$path = constant('LOCALISEPATH_' . strtoupper($client)) . "/language/$tag/$tag.$name.ini";
$translation = new JObject(
array(
'type' => 'library',
'tag' => $tag,
'client' => $client,
'storage' => 'global',
'filename' => $name,
'name' => $name,
'refpath' => $reftranslation->path,
'path' => $path,
'state' => 'unexisting',
'writable' => LocaliseHelper::isWritable($path),
'origin' => 'core'
)
);
$this->translations["$client|$tag|$name"] = $translation;
}
if (array_key_exists("$client|$tag|$name", $this->translations))
{
$this->translations["$client|$tag|$name"]->setProperties(array('refpath' => $reftranslation->path, 'state' => 'inlanguage'));
}
else
{
$path = constant('LOCALISEPATH_' . strtoupper($client)) . "/language/$tag/$tag.$name.ini";
$translation = new JObject(
array(
'type' => '',
'tag' => $tag,
'client' => $client,
'storage' => 'global',
'filename' => $name,
'name' => $name,
'refpath' => $reftranslation->path,
'path' => $path,
'state' => 'unexisting',
'writable' => LocaliseHelper::isWritable($path),
'origin' => 'core'
)
);
$this->translations["$client|$tag|$name"] = $translation;
}
}
}
Expand Down