[4.0] Adding Joomla Version in Quickicon#23061
[4.0] Adding Joomla Version in Quickicon#23061infograf768 wants to merge 3 commits intojoomla:4.0-devfrom
Conversation
This comment was marked as abuse.
This comment was marked as abuse.
|
@PhilETaylor |
This comment was marked as abuse.
This comment was marked as abuse.
That one is only due to the fact that the available version is an alpha. NOTE as a reminder: has done the trick here for LTR languages. For compatibility with RTL, we need to create a new specific class to replace
I do not really see this as a problem, but, if desired, we can use the Warning color for quickicons and get
This is also a simple change in the JS. |
|
@dgrammatiko For example, in https://github.com/joomla/joomla-cms/blob/4.0-dev/build/media_src/plg_quickicon_extensionupdate/js/extensionupdatecheck.es6.js#L34 |
|
@infograf768 what is the problem, the code seems fine? |
|
@infograf768 hold on you cannot use the plural version of a string in the browser (js) without prior sending all the required stings to the browser!!! I don't think that Joomla has a way to deal with this atm. What you can do is send the required strings in the browser using switch (number) {
case 1:
el.innerHTML = string1;
break;
} |
|
not sure I made myself clear. I would like to use our specific JText:plural in the js with strings like WHATEVER_N_ITEMS_1 as the method seems to allow. |
@infograf768 sorry I don't think that the method allows it. I don't see anywhere in that method the string to be enqueued for the javascript world. Thus you need to queue manually all the instances WHATEVER_N_ITEMS_1
EDIT I'm wrong, the method should push all the strings in the browser. |
|
on ipad now. will post here tomorrow what i tried to do and th error I got. |
|
@infograf768 I was right for the part that the dev has to push all the variations to the js. So here is what I did: So you still have to push each and every string you need to the js and then introduce that switch (or if/else statement) to control which of the available strings will be displayed, eg: const a = 1;
if (a === 1) {
alert(Joomla.Text._('PLG_QUICKICON_JOOMLAUPDATE_TEST_ITEMS_' + a))
} else {
alert(Joomla.Text._('PLG_QUICKICON_JOOMLAUPDATE_TEST_ITEMS_MORE' ))
}Hope this helps |
|
Thanks @dgrammatiko Therefore we can't use your proposal because, depending on the language, the plural form may be different and quite complex, i.e for example in Russian, one would have 1, 2, MORE and other languages even more variations. For Scottish Let me explain what I expected would work. I included
and added the necessary strings (depending on language plural forms) in the ini file. Moved around the supplementary closing parenthesis and always got this error: It would really be great to implement a true plural form for direct js. Can do? |
Possible, but someone else needs to code that |
|
@infograf768 you can do it, it's an easy on:
Text = { // This part already exists
// Add the following code before the last closing bracket `}`
plural = function (name, value) {
if (isNaN(value)) {
return;
}
switch (value) {
case 1:
if (Joomla.Text._(name + '_1')) {
return Joomla.Text._(name + '_1');
} else {
throw new Error('Plural sting: ' + name + '_1' + ' is not available, check the PHP part');
}
case 2:
if (Joomla.Text._(name + '_2')) {
return Joomla.Text._(name + '_2');
} else if (Joomla.Text._(name + '_MORE')) {
return Joomla.Text._(name + '_MORE');
} else {
throw new Error('Plural sting: ' + name + '_2' + ' is not available, check the PHP part');
}
// ... continue this pattern for all possible values...
}
}
}
Joomla.Text.plural('SOME_STRING_ITEMS', 1)
// Will output the value of the string SOME_STRING_ITEMS_1
Joomla.Text.plural('SOME_STRING_ITEMS', 2)
// Will output the value of the string SOME_STRING_ITEMS_2 if that exists or SOME_STRING_ITEMS_MORE |
|
Sorry, it is not an easy one at all for me. On the PHP part (I guess you mean in the
because I have no way to know all possible values. |
Well, I'm not aware of the possible values as well but I guess with some research on the language files and their plural implementation someone can come up with the highest number the for loop in PHP and the switch in JS should go through. Anyways this was my 2c here |
|
I have tested this item ✅ successfully on 60d9c23 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23061. |
|
@dgrammatiko Even that snippet wouldn't work in the JS API, to do it right the JS API would need something very similar to the PHP API's |
|
@mbabker I guess my proposal was on En-UK. For each other language you're right the plural function needs to be a 1-1 thing of the PHP, but then that doesn't need to be included in each page load. Thus, similarly to the approach of the calendar locales a small script that overrides this function (whenever the plural method in PHP is invoked with the |
|
I not very imagine how it can work. Not a quick fix 😄 |
|
@tuum |
|
Closing. Please test #23095 |






Pull Request for NOTE in Issue #23047 (comment)
Summary of Changes
Display the JVersion instead of 0 when an Update is available, both in the Message and the icon itself.
Make the
Update Nowbutton the same size as for Extensions Update message by usingbtn-smTesting Instructions
To test on 4.0-dev branch
Modify version.php line 63 to
const EXTRA_VERSION = 'alpha4-dev';Go to database and Fix database.
Then in JoomlaUpdate Options choose Custom URL and add this link (Thanks Tobias) :
https://update.joomla.org/core/nightlies/next_major_list.xml
Save Options.
Display Control Panel.
Run npm ci
After patch
@laoneo @PhilETaylor