create an install script for extension.
In the preflight function (or any other function, I have also tried in more cases)
public function __construct() {
$manifest = $this->getItemArray(JFactory::getDbo()->quote($this->extension));
$this->oldRelease = $manifest['version'];
}
public function preflight($type, $parent) {
$this->release = $parent->get('manifest')->version;
if (strtolower($type) == 'update') {
if (version_compare($this->release, $this->oldRelease, '<')) {
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_EXAMPLE_UPDATE_LOWER_VERSION', $this->oldRelease, $this->release), 'error');
return false;
}
return true;
}
The language file in : admin/language/en-GB.com_example.sys.ini
COM_EXAMPLE_UPDATE_LOWER_VERSION="Your version is %s. You cannot downgrade to version %s !"
Error
Your version is 0.1.5. You cannot downgrade to version 0.1.1 !
Error installing component
Error
COM_EXAMPLE_UPDATE_LOWER_VERSION
Error installing component
Joomla Version : 3.8.12
Labels |
Added:
?
|
Title |
|
Category | ⇒ | External Library |
Labels |
Added:
J3 Issue
|
Status | New | ⇒ | Information Required |
/language/en-GB.com_example.ini
or /language/en-GB/en-GB.com_example.ini
?
can't find a doc on preflight
The Language ini file is not the problem. The following Is translated fine.
JText::_('COM_EXAMPLE_UPDATE_LOWER_VERSION')
If you check the docs you will notice this :
note: If you want that these languages KEYs to be used at the first install of the component, the sys.ini language file must be stored in the component folder (admin/language/en-GB/en-GB.com_helloworld.sys.ini), and the xml manifest file must contains a folder tag for copying language in the component folder. Modify your Manifest file accordingly:
@infograf768 can you please comment?
can't help without getting such an extension.
that would help, yes, as I see no reason for JText to work and JText::sprintf not
My guess is that the string should be in components/extension/language/xx-XX/xx-XX.extension.sys.ini
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-03-16 05:54:58 |
Closed_By | ⇒ | joomla-cms-bot |
Closed_By | joomla-cms-bot | ⇒ | franz-wohlkoenig |
Closed as no Answer, please reopen if needed.
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/22179
You haven’t included the language file on the preflight since it’s not installed.
iirc for it to be loaded on the installer it needs to be in:
/language/en-GB.com_example.ini