-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Unpublished Content Language on Language Package Install #11867
Changes from 4 commits
6fbfee8
57f4926
1cb7f1f
3dc390b
9902f77
1a87e40
755c18f
4bbfd4c
661ff82
69a02b5
cb55d32
0cd03f8
b7c5ae4
64ad0bf
9ab5e30
49037b4
58d6e68
5bff1fa
63e9589
52bb74c
defc2c3
5f1eda6
6abce71
c924445
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,17 +107,17 @@ public function install() | |
|
||
$basePath = $client->path; | ||
$clientId = $client->id; | ||
$element = $this->getManifest()->files; | ||
$element = $this->getManifest()->files; | ||
|
||
return $this->_install($cname, $basePath, $clientId, $element); | ||
} | ||
else | ||
{ | ||
// No client attribute was found so we assume the site as the client | ||
$cname = 'site'; | ||
$cname = 'site'; | ||
$basePath = JPATH_SITE; | ||
$clientId = 0; | ||
$element = $this->getManifest()->files; | ||
$element = $this->getManifest()->files; | ||
|
||
return $this->_install($cname, $basePath, $clientId, $element); | ||
} | ||
|
@@ -300,6 +300,51 @@ protected function _install($cname, $basePath, $clientId, &$element) | |
return false; | ||
} | ||
|
||
// Create an unpublished content language. | ||
if ((int) $clientId === 0) | ||
{ | ||
$siteLanguageManifest = JLanguage::parseXMLLanguageFile(JPATH_SITE . '/language/' . $this->get('tag') . '/' . $this->get('tag') . '.xml'); | ||
|
||
$row = JTable::getInstance('language'); | ||
$row->lang_code = $this->name; | ||
$row->title = $siteLanguageManifest['name']; | ||
$row->title_native = $this->get('name'); | ||
$row->image = strtolower(str_replace('-', '_', $this->get('tag'))); | ||
$row->description = ''; | ||
$row->metakey = ''; | ||
$row->metadesc = ''; | ||
$row->sitename = ''; | ||
$row->published = 0; | ||
$row->access = (int) JFactory::getConfig()->get('access', 1); | ||
$row->ordering = 0; | ||
|
||
$sefs = array( | ||
preg_replace('#([a-z]{2,3})-[A-Z]{2}#', '$1', $this->get('tag')), | ||
strtolower($this->get('tag')), | ||
); | ||
|
||
// Try both sef types (xx or xx-xx). For instance, for en-US when you have en-GB installed. | ||
foreach ($sefs as $sef) | ||
{ | ||
$row->sef = $sef; | ||
|
||
if ($row->check() && $row->store()) | ||
{ | ||
$created = true; | ||
break; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should add here an else to deal for an installation language without key
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that fallback is already there. see above // Set the content language as native_name in site xx-XX.ini, fallback to installation language variable, fallback to content language title.
$contentLanguageNativeTitle = $contentLanguageTitle; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
if (!$created) | ||
{ | ||
JLog::add( | ||
JText::sprintf('JLIB_INSTALLER_WARNING_UNABLE_TO_INSTALL_CONTENT_LANGUAGE', $this->get('name'), $row->getError()), | ||
JLog::WARNING, | ||
'jerror' | ||
); | ||
} | ||
} | ||
|
||
// Clobber any possible pending updates | ||
$update = JTable::getInstance('update'); | ||
$uid = $update->find(array('element' => $this->get('tag'), 'type' => 'language', 'folder' => '')); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why two %s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one for the language other for the error message