[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs i18n

From: Mattias Engdegård
Subject: Re: Emacs i18n
Date: Mon, 25 Mar 2019 23:05:03 +0100

25 mars 2019 kl. 22.11 skrev Juri Linkov <address@hidden>:
> Is it possible to generate a regexp from ngettext arguments?
> For example, given the same arguments and calling a hypothetical
> function ‘rx-ngettext’:
>  (rx-ngettext "finished with %d match found\n"
>               "finished with %d matches found\n")
> to generate a regexp like:
>  "finished with \\(?:\\(\\(?:[0-9]+ \\)?match\\(?:es\\)? found\\)"

Trivially so by generating an or-pattern: "singular text\\|plural text". 
Anything better is a matter of optimisation, basically a diff algorithm (or 
just prefix and suffix merging).

Is it practical, though? For %s, we would need to generate a match-anything 
subexpression, even though the argument is much more constrained in practice.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]