Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: smd_article_stats: Article stats to count words 'n stuff
Champagne!
Destry wrote #314403:
Now, one last question: The word count is showing up with a comma, like
7,346. Where do you change the locale? (France is set in the Language and Region tab of my Mac’s settings.) I can live with that but I’d prefer7 346.Also, do visitors see it differently to their locale too, or am I defining how everyone sees it?
It’s a server thing, should match your txp site public language, not clients settings.
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
Ah, of course.
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
Ahem… the 4.7.1 implementation is slightly flawed, sorry. Will be fixed in 4.7.2.
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
etc wrote #314407:
Ahem… the 4.7.1 implementation is slightly flawed, sorry. Will be fixed in 4.7.2.
It seems relying on locale influences language in dates too. So while 10 684 looks good as a word count, IMO, 12 février 2018, doesn’t work as well in an English language article.
I’m not complaining, just observing aloud. I can easily go with 10,684 on the en pack (and will need to).
But it does return to the question of potentially being able to personalize word counts as a design consideration independent of local language settings.
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
Destry wrote #314417:
But it does return to the question of potentially being able to personalize word counts as a design consideration independent of local language settings.
Noted. Could do this as an attribute to the tag. Some sort of separator or something. But since we use that for other purposes in core tags, it’d need a better name and perhaps be applicable to any other things you might wish to customize about the counts (if there is anything?) Ideas welcome.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
Maybe sticking with language convention is the smart way. Certainly efficient. I wouldn’t worry about it.
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
I must have used en-GB before when seeing the comma, because when switching from fr to en just now I get this yellow warning:
No locale available for language English. Using default locale instead.
What would be the default in that case, British?
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
Destry wrote #314421:
when switching from fr to en just now I get [a] warning.
Yeah this is where our locale/language thing breaks down a bit. Or where the entire locale/language thing breaks down, I’m not sure which it is.
Basically we have a giant lookup table that maps a language designator to a locale. When we used full language designators (en-GB, en-US etc) it was easy because they usually have a direct locale analogue. Now we have “short” designators there’s not always a mapping. There’s no explicit locale for OED English en for example.
If you look in textpattern/vendors/Textpattern/L10n/Locale.php you’ll see the table near the top of the file. Notice that the entry for ‘en’ is missing? That’s probably why you get that warning. And this leads to your next point…
What would be the default in that case, British?
… if the system can’t find a locale it reverts to the system default which is usually ‘C’. For, uhhh, “Common” or “Can’t find it” … I’m not sure.
What do we do about this? I don’t know. Do we add an entry for our short langs and just pick a locale even though it might not be right? Do we leave it up to the system (as we do now) and issue the warning, which delivers correct information to you, but is potentially confusing? Or do we do something else?
I’m a little ignorant in this department so if anyone is more clued up then please open a topic for discussion somewhere.
P.S. if you want to see all locales your system supports, open a Terminal and issue:
locale -a
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
Bloke,
If I may offer… I’d suggest using the Modern Humanities Research Association,‘s recommendation for handling the generic en dates, numbers, currency, etc.
The MHRA is largely based on the Oxford Style Manual, and some of it’s board members are even Oxford researchers. So if you’re considering the en spelling as OED, then this is just another pea in the same pod.
(This is the style manual I use for all my sites too.)
Dates are of the format 6 October 2018.
For numbers, they define no separator up to 9999, then a comma beginning 10,000.
While this is not what I wanted to do from a design standpoint, I will be the first to say this is a solid way to address the missing en format for Txp, and especially as it’s based on the Oxford U way of things.
I would be happy to use smd_article_stats under the en language by the above format. I’m a sucker for convention.
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
New version 0.5.0 is out for Txp 4.7.x (finally):
- Registered public tag.
- Fixed erroneous template comment.
- Updated and fixed available stats panel locations for 4.7 UI (thanks, phiw13).
- Corrected and expanded French language Textpack (thanks, phiw13).
As always, report any issues and I’ll tend to them when I can. Enjoy!
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
Small issue (v 0.5.0): on the plugin panel, clicking on the “options” link leads to a restricted page instead of the expected prefs panel Going manually to the Prefs panel > smd_article_stats works fine.
The URL I get from the plugins panel: /textpattern/index.php?event=plugin_prefs.smd_article_stats
This is on my local testing install running 4.8.0 dev. But same result on a live server running TXP latest release.
The options link for some other (smd_) plugins work as expected.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
phiw13 wrote #319833:
on the plugin panel, clicking on the “options” link leads to a
restricted pageinstead of the expected prefs panel
Good catch, thank you. Fixed in v0.5.1.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#89 2020-03-09 12:59:27
- M_i
- Member
- Registered: 2006-03-05
- Posts: 122
Re: smd_article_stats: Article stats to count words 'n stuff
Hi,
I’m updating an ancient Textpattern site that I built back in 2006 because my host is shutting off PHP 5.4 soon. I started out with Textpattern 4.0.4 on PHP 5.4 and have managed to update to Textpattern 4.8, which I have running on PHP 7.2.
Now I’m trying to get all the plugins up and running again, and hit a little snag with this one. On the old TXP 4.0.4 site, using version 0.21 of this plugin, I had a <txp:smd_article_stats item=“body” /> tag on both the form for the article itself and on article list forms, and both worked. On the updated site, running version 0.5.1 of smd_article_stats, the word count only displays on the individual article, not on the article lists.
From the documentation, I’m not entirely sure if it’s even supposed to show a word count on article lists, or that it’s exclusively for individual articles, but as said, it used to work. Should it still work? And if not, is there another plugin I could try to display word count on article lists?
Any help would be much appreciated!
thanks,
iris
Offline
Re: smd_article_stats: Article stats to count words 'n stuff
M_i wrote #322104:
<txp:smd_article_stats item=“body” />tag on both the form for the article itself and on article list forms, and both worked. On the updated site, running version 0.5.1 of smd_article_stats, the word count only displays on the individual article, not on the article lists.
That’s strange. It should work the same. On article lists, Txp jumps to “individual article” context whenever each article is rendered via the list form, so it has access to all the article information like title, body text, and custom fields, etc.
I shall test it on my site when I’m back at my laptop and let you know if I find anything untoward. If not, we can have a go at debugging why you’re seeing this behaviour on your site.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline