Translations and snprintf on Windows

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Translations and snprintf on Windows

Michael Chirico
[a bit unsure on if this is maybe better for r-package-devel]

We recently added translations to messages at the R and C level to
data.table.

At the C level, we did _() wrapping for char arrays supplied to the
following functions: error, warning, Rprintf, Error, and snprintf.

This seemed OK but the use of snprintf specifically appears to have caused
a crash on Windows:

https://github.com/Rdatatable/data.table/issues/4402

Is there any guidance against using gettext with snprintf, or perhaps
guidance on which "outputters" *are* OK for translation?

Michael Chirico

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Translations and snprintf on Windows

Michael Chirico
Following up on this after Matt D truffled out the issue -- snprintf was a
*bit* of a red herring.

The root of the issue is the use of positional identifiers (like %1$d, see
https://stackoverflow.com/questions/19327441/gcc-dollar-sign-in-printf-format-string)
in the format string for translations.

These identifiers are quite useful for translations since grammar changes
by language mean the inputs should naturally change order when changing
languages -- however, they are a POSIX extension.

snprintf produced the issue since all other messages are ultimately R
functions, and base R handles the issue (AFAICT via trioremap.h).


On Thu, Apr 30, 2020 at 4:16 PM Michael Chirico <[hidden email]>
wrote:

> [a bit unsure on if this is maybe better for r-package-devel]
>
> We recently added translations to messages at the R and C level to
> data.table.
>
> At the C level, we did _() wrapping for char arrays supplied to the
> following functions: error, warning, Rprintf, Error, and snprintf.
>
> This seemed OK but the use of snprintf specifically appears to have caused
> a crash on Windows:
>
> https://github.com/Rdatatable/data.table/issues/4402
>
> Is there any guidance against using gettext with snprintf, or perhaps
> guidance on which "outputters" *are* OK for translation?
>
> Michael Chirico
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel