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

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

On 11/28/2023 6:09 PM, Peter Münster wrote:
> 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?
\mainlanguage[fr]

\setuplanguage[fr][date={day:++,\ ,month,\ ,year}]

\starttext
     Dates: \date[d=1], \date[d=2] (not OK)
\stoptext




-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

___________________________________________________________________________________
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

* [NTG-context] Re: usage of conversion in \date
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Münster @ 2023-11-29  9:40 UTC (permalink / raw)
  To: ConTeXt users

On Wed, Nov 29 2023, Hans Hagen wrote:

> \setuplanguage[fr][date={day:++,\ ,month,\ ,year}]

Unfortunately this does not work as I need. Only the "1" should be
converted to 1er, not the other numbers.

French is a bit special:
You say "le premier novembre" but not "le un novembre".
You say "le deux novembre" but not "le deuxième novembre".

According to https://wiki.contextgarden.net/Command/date:
"The name suffixes indicate number conversions. Any conversion, either
 built-in or defined by \defineconversion, can be used there."

But it does not seem to work...

-- 
           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

* [NTG-context] Re: usage of conversion in \date
  2023-11-29  9:40   ` Peter Münster
@ 2023-12-18 14:38     ` Peter Münster
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Münster @ 2023-12-18 14:38 UTC (permalink / raw)
  To: ConTeXt users

On Wed, Nov 29 2023, Peter Münster wrote:

> According to https://wiki.contextgarden.net/Command/date:
> "The name suffixes indicate number conversions. Any conversion, either
>  built-in or defined by \defineconversion, can be used there."
>
> But it does not seem to work...

Hi,

Should I add this to the bug-tracker?  If yes, where please?
It seems, that tracker.luatex.org is no more used.

TIA,
-- 
           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).