Categories plugin: accessibility

Creating and modifying plugins.
Post Reply
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Categories plugin: accessibility

Post by yellowled »

The categories plugin can be configured to emit the number of entries in a given categories like this: "Category (123)". In terms of accessiblity, it would make sense to change this to something like "Category (123 entries)". It wouldn't need to be the default setting, but there should definitely be an option for this, at least through the optional custom .tpl file of said plugin.

However, the line responsible for emitting that part of the code

Code: Select all

<a href="{$plugin_category.categoryURL}" title="{$plugin_category.category_description|escape}" style="padding-left: {$plugin_category.paddingPx}px">{$plugin_category.category_name|escape}</a>
looks as if {$plugin_category.category_name|escape} already was the "combined" text of category name and number of entries in brackets. Are there variables available in the plugin which only hold the category name and the number of entries in that particular catgory?

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Categories plugin: accessibility

Post by garvinhicking »

Hi!

One reason for ommitting "entries" is due to singular/plural. You have to detected "1" as a special case and use the singular, and for all others (including 0) user the plural.

The variable for the entry count is available as {$plugin_category.article_count} and the category name as {$plugin_category.true_category_name}.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Categories plugin: accessibility

Post by yellowled »

garvinhicking wrote:One reason for ommitting "entries" is due to singular/plural. You have to detected "1" as a special case and use the singular, and for all others (including 0) user the plural.

The variable for the entry count is available as {$plugin_category.article_count} and the category name as {$plugin_category.true_category_name}.
What seems to be the problem with a construction like this?

Code: Select all

{if $plugin_category.article_count == 1} ... {else} ... {/if}
Is it that we don't have a lang constant for the singular? How could that happen? :)

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Categories plugin: accessibility

Post by garvinhicking »

Hi!
Is it that we don't have a lang constant for the singular? How could that happen? :)
Yip. Seems like "entry" was never required as an isolated word.

Of course we can't translate all possible words into s9y language files. :-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Categories plugin: accessibility

Post by yellowled »

garvinhicking wrote:Seems like "entry" was never required as an isolated word.
Well, the entries_archive.tpl could use it, too.

Code: Select all

<td class="archives_count">{$month.entry_count} {$CONST.ENTRIES}</td>
Or we could simply use {$CONST.ENTRIES} in the categories plugin and not care about the singular/plural stuff there, either :)

I do, of course, realize accessibility isn't one of our top priorities, which is perfectly fine since it's a pretty high goal in any blog/CMS anyway, but these little things can surely help making s9y better in that area.

YL
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Categories plugin: accessibility

Post by Don Chambers »

Many times, my sidebars are very narrow, and the addition of the word "entries", which for all I know is very long in other languages, would wrap or blow apart my sidebars. I also think the count shown as CatName (12) is fairly obvious... but perhaps it is not that obvious in whatever context you are now working on.

I can see the additional word/words being helpful from a functional perspective, but how does it increase accessibility? Is it because something like a screen reader would read it as "archives 12 entries" instead of "archives 12"?
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Categories plugin: accessibility

Post by yellowled »

Don Chambers wrote:Is it because something like a screen reader would read it as "archives 12 entries" instead of "archives 12"?
Basically: yes.

I'm not 100% sure, but I think screenreaders would even read something like "category leftbracket twelve rightbracket" - yes, people get the picture, but still "category twelve entries" is better.

YL
Post Reply