ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] usage of conversion in \date
@ 2023-11-28 17:09 Peter Münster
  2023-11-29  8:50 ` [NTG-context] " Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Münster @ 2023-11-28 17:09 UTC (permalink / raw)
  To: ntg-context

Hi,

When printing a date in French, I would like to convert the "1" to
"1\ier", but it does not work as I expect:

--8<---------------cut here---------------start------------->8---
\startluacode
-- from https://wiki.contextgarden.net/Command/defineconversion:
interfaces.implement {
    name      = "FRdate",
    public    = true,
    arguments = "string",
    actions   =
        function(s)
            local n = tonumber(s)
            if n == 1 then
                context"1\\ier"
            else
                context(s)
            end
        end
}
\stopluacode
\def\ier{\highordinalstr{er}}
\mainlanguage[fr]
\defineconversion[frd][\FRdate]
\setuplanguage[fr][date={day:frd,\ ,month,\ ,year}]
\starttext
Conversion: \convertnumber{frd}{1}, \convertnumber{frd}{2} (OK)\\
Dates: \date[d=1], \date[d=2] (not OK)
\stoptext
--8<---------------cut here---------------end--------------->8---

How could I get "1\ier\ novembre 2023" please?

TIA for any help,
-- 
           Peter
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-18 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 17:09 [NTG-context] usage of conversion in \date Peter Münster
2023-11-29  8:50 ` [NTG-context] " Hans Hagen
2023-11-29  9:40   ` Peter Münster
2023-12-18 14:38     ` Peter Münster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).