[patch] Selection stats in statusbar
Kornel Benko
kornel at lyx.org
Wed Aug 17 09:41:34 UTC 2022
Am Wed, 17 Aug 2022 11:28:53 +0200
schrieb Daniel <xracoonx at gmx.de>:
> On 17/08/2022 11:13, Jürgen Spitzmüller wrote:
> > Am Mittwoch, dem 17.08.2022 um 11:00 +0200 schrieb Jürgen Spitzmüller:
> >> Attached the way I'd recommend to do it:
> >>
> >> * do not use abbreviations
> >> * allow to enable the stats measures individually
> >> * left click on stats in status bar opens stats dialog (as in LO and
> >> Word)
> >>
> >> The rationale besides the accessibility argument is that I'd figure
> >> that users seldom need all three stats values. The value they need
> >> might depend on the editorial instructions they get. These might rely
> >> on either of the three. So give the user the choice to see what they
> >> need.
> >
> > Updated patch which accounts for the proper number (1 Word, 2 Words).
>
> If the usage of QStringList is fine, it can also be written a bit more
> concise as. Also, chars_with_blanks should probably be inside the second
> "if statement":
>
> QStringList stats;
> if (word_count_enabled_) {
> int const words = buf->wordCount();
> if (words == 1)
> stats << toqstr(bformat(_("%1$d Word"), words));
> else
> stats << toqstr(bformat(_("%1$d Words"), words));
> }
> if (char_count_enabled_)
> int const chars_with_blanks = buf->charCount(true);
> if (chars_with_blanks == 1)
> stats << toqstr(bformat(_("%1$d Character"), chars_with_blanks));
> else
> stats << toqstr(bformat(_("%1$d Characters"), chars_with_blanks));
> if (char_nb_count_enabled_) {
> int const chars = buf->charCount(false);
> if (chars == 1)
> stats << toqstr(bformat(_("%1$d Character (no Blanks)"), chars));
> else
> stats << toqstr(bformat(_("%1$d Characters (no Blanks)"), chars));
> }
> stat_counts_->setText(stats.join(qt_(", [[stats separator]]")));
>
>
What about languages with different plurals.
In Slovak for example it would be
1 slovo
2..4 slová
5..\infty slov
Kornel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20220817/ed3b7666/attachment-0001.asc>
More information about the lyx-devel
mailing list