Closed chmst closed 5 years ago
Made some comments inline
Someone else will have to check that the pluralisation is correct in the code to allow for languages that have more complex pluralisation rules - maybe @infograf768 can check this
Would someone be kind enough to explain what we are supposed to get (screenshots) and what the plural forms are for and how/where they display?
I have installed the quickicon-improvements
branch here
Note: I have enabled all possible stuff in the Quickicon module
I get this when enabled
<div class="quickicon-sr-desc sr-only" data-sronly-zero="Article categories: No category is available" data-sronly-one="Article categories: One category is available" data-sronly-n="Article categories: 2 categories are available">Article categories: 5 categories are available</div>
I am lost as whatever that means it seems that any other plural form is not taken care of.
if (isset($displayData['srOnly']))
{
$srOnly_0 = Text::plural($displayData['srOnly'], 0);
$srOnly_1 = Text::plural($displayData['srOnly'], 1);
$srOnly_n = Text::plural($displayData['srOnly'], 2);
}
Example In en-GB we have
COM_BANNERS_BANNERS_N_ITEMS_CHECKED_IN_1="%d banner checked in."
COM_BANNERS_BANNERS_N_ITEMS_CHECKED_IN_MORE="%d banners checked in."
in Russian
COM_BANNERS_BANNERS_N_ITEMS_CHECKED_IN_0="Ни один баннер не был разблокирован"
COM_BANNERS_BANNERS_N_ITEMS_CHECKED_IN_1="%d баннер успешно разблокирован"
COM_BANNERS_BANNERS_N_ITEMS_CHECKED_IN_2="%d баннера успешно разблокировано"
COM_BANNERS_BANNERS_N_ITEMS_CHECKED_IN_MORE="%d баннеров успешно разблокировано"
In some other languages, we may have even more strings/plural forms. In Scottish (only available for 2.5) we have
public static function getPluralSuffixes($count) {
if ($count == 0 || $count > 19) {
$return = array('0');
}
elseif($count == 1 || $count == 11) {
$return = array('1');
}
elseif($count == 2 || $count == 12) {
$return = array('2');
}
elseif(($count > 2 && $count < 12) || ($count > 12 && $count < 19)) {
$return = array('FEW');
}
return $return;
}
That's exactly what I suspected
The Plural forms do this: 1) for sighted users
2) For blind users the Screen Reader says for example:
Users: One User is activated.
Articles: No article is available
Modules: Three modules are available
Global Checkin: No Items are locked.
Cache: The Cache is empty
We have adopted this from the joomla update plugins. In case of many different plural forms we could add more strings.
In case of many different plural forms we could add more strings.
That's the whole point - we can not. The current system used throughout joomla is that the TT add them if they need to
@infograf768 you're right, we have to take care for the pluralism form. Do you have an JS example where this happen in Joomla!?
Did not find any but this should help https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Language/Text.php#L171-L198
@chmst
Please use the normalized string constants for plural forms.
I mean adding the _N_
in the constant. For example:
COM_CATEGORIES_QUICKICON_N_SRONLY
Thank ou, @infograf768. I did the normalization but was not successful with the RTL. Will try again when I have some spare time.
RTL: will test a new install of your branch and see what I can do.
RTL: the problem with the Cache value display is the JsonResponse.
It does not accept htmlentities in general and even if it was, this specific one should not be decoded anyway as it is a pure unicode ‎
= \u200E
For example if I use
$result['amount'] = json_encode('‎' . $mb);
I get the correct LTR but with the htmlentity
@chmst
RTL: found a solution in quickicon.es6.js
Change
counter.textContent = response.data.amount;
to
counter.textContent = '\u200E' + response.data.amount;
Same for sronly
sronly.textContent = '\u200E' + response.data.sronly;
provided that RTL TT creates a string formatted such:
COM_CACHE_QUICKICON_SRONLY= "%s حجم کش است"
Pull Request for Issue #258 .
Summary of Changes
1) Fixed: Button MenuItems
2) Numbers on icons can be useful and important but sometimes are useless, asdescribe in the issues. We have expanded module parameters so the administrator can choose if she want to see the number or only the button.
3) If a number is displayed, both the number and component name have attribute "aria-hidden", but a sr-only text is added which gives information in a sentence.