User tests: Successful: Unsuccessful:
Pull Request for Issue #17093
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Language & Strings JavaScript Front End Plugins |
min.js
to .js
here: https://github.com/joomla/joomla-cms/pull/19002/files#diff-6294ff5e58aa4525944e7824423ff18dR60=== 0
to !== 0
here: https://github.com/C-Lodder/joomla-cms/blob/f035ae1ca261bd1838b09f283713fe25dac3aa25/media/plg_quickicon_extensionupdate/js/extensionupdatecheck.js#L31Or you can install any extension on J4.
Kunena 5.0.11 as an example. Latest version is 5.0.12 so you should see an update available.
I have tested this item
Thanks for Info @C-Lodder, used Kunena.
Easy | No | ⇒ | Yes |
I'm not sure this actually looks any better with a label? I know you're kinda fixing a bug here because it was originally clearly supposed to have one - but thoughts on just removing the label outright?
@wilsonge Without a badge, it's simply a number on it's on which isn't a very clear indicator. Unless you want to change the language string so that is reads:
2 updates available
If is reads like the above, then we could possibly get away without the need for a badge.
@brianteeman thoughts on this?
I like the badge like it is for the post-installation messages badge for a quick glance without having to read.
it makes more sense in english to make the string change when updates are available
@brianteeman so in favour of:
2 updates available!
as opposed to:
Updates are available! 2
Also, with or without the badge?
2 updates available!
If you put the number into the string you will have to make sure the correct plural form is used.
I guess JText:plural doesn't work here since it is Javascript.
See /libraries/src/Language/Text.php
* Examples:
* `<script>alert(Joomla.JText._('<?php echo Text::plural("COM_PLUGINS_N_ITEMS_UNPUBLISHED", 1, array("script"=>true)); ?>'));</script>`
* will generate an alert message containing '1 plugin successfully disabled'
* `<?php echo Text::plural('COM_PLUGINS_N_ITEMS_UNPUBLISHED', 1); ?>` will generate a '1 plugin successfully disabled' string
*
* @param string $string The format string.
* @param integer $n The number of items
*
* @return string The translated strings or the key if 'script' is true in the array of options
*
* @since 11.1
*/
public static function plural($string, $n)
Looks like there is a possibility of making plural js compatible.
I can simply pass the plural string via Joomla.options object. No biggy
Looks like there is a possibility of making plural js compatible.
If you know the item count before creating the string, then yes. But afaik in that plugin we generate all possible strings before and then decide which one to use in JS after the AJAX response.
I can simply pass the plural string via Joomla.options object. No biggy
I don't think you can. Because you don't know which plural string to use. Not all languages are like english were you only have one plural string. There are languages where you have eg a specific plural form for "12 items". That's what JText::plural takes care of, together with some language specific code in localise.php that tells it which form to use. You can't do that on client side because you don't have the information you need (at least not that I know).
It's probably also the reason we currently have that ugly text
I think you would have to generate the answer text as part of the AJAX response and echo that.
@Bakual - Correct me if I'm wrong, but JText::plural
will take care of strings that contain plurals. So if we use:
.ini
UPDATES_AVAILABLE = 2 updates available!
.php
$text = Text::plural('UPDATES_AVAILABLE');
Factory::getDocument()->addScriptOptions('foo', ['bar' => $text]);
.js
var text = Joomla.getOptions('foo');
The plural text is then generated PHP side and pass to the JS options object.
It will then be up to those who manage language packs to update the string.
Unless I'm missing something, I don't see the need for Ajax.
You have to pass a count to the plural()
method for it to work correctly. Depending on the active language, there may be different strings for different counts (unlike the en packs which are all _0
, _1
, and _MORE
). So you can't just seed the options with one generic string.
Fair enough. In which case lets just leave this PR as it is.
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-12-20 00:13:56 |
Closed_By | ⇒ | wilsonge |
which Extension to use to get "Updates are available"?
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19002.