mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Pablo Correa Gomez <pabloyoyoista@postmarketos.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Selecting locale source format
Date: Wed, 1 Oct 2025 22:34:14 -0400	[thread overview]
Message-ID: <20251002023414.GG1827@brightrain.aerifal.cx> (raw)
In-Reply-To: <ea10842daa12b344be1f24232e3b62e41f673757.camel@postmarketos.org>

On Wed, Oct 01, 2025 at 03:55:59PM +0200, Pablo Correa Gomez wrote:
> We got now a few replies from translators, and the most remarkable
> thing that was brought up is how to deal with natural text whose
> translations might change depending on context. Both plural forms and
> declinations were brought up.
> 
> Discussing a bit with Rich, it seems that such thing will not be an
> issue for strings related to the libc API, which is what is the biggest
> concern of the work we are doing now. However, there are
> implementation-dependent strings in libc, like dynamic linker messages,
> which could potentially be added in the future. Still, since we are
> setting the file format, it would be important to make sure that
> whatever we come up now is flexible enough to not block future
> development. Any thoughts?

To summarize that discussion, most of the translatable strings in
musl/libc are fixed-form messages returned to the caller to use as it
sees fit. These inherently don't have any plural or other contextual
forms because no context is available to us.

What's left are strings that are not themselves part of any standard
interface surface but where we're reporting things directly to the
user (something we mostly choose very intentionally not to do, with
the main exception being dynamic linking failure conditions at
startup) or where the interface allows us to construct a more detailed
and contextualized message (presently this is just dlerror).

The reason the first try at supporting localized text omitted the
dynamic linker (startup and dlopen) strings from being translatable by
gettext was pretty much specifically this: that I did not want
safety/correctness to depend on having type-matched format strings in
the locale definition file. My intent then was that, if/when we make
them translatable, we adjust the messages to be less
"natural-language" in form and instead consist of
separately-translatable fields, something like:

	Relocation error: foo.so: symbol: [cause of failure]

I'm not entirely committed to this if other folks disagree, but I
think it both makes translation cleaner and makes it easier to
understand bug reports with messages in a language you might not read.

If we don't do it this way, I'd want to have an internal interface for
validating that format strings are type-matched before using them. In
that case, if there are variants needed, we'd have to enumerate them
and assign them each an integer key.

Rich

      parent reply	other threads:[~2025-10-02  2:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17  1:14 Rich Felker
2025-09-17  1:23 ` A. Wilcox
2025-09-17  1:36   ` Rich Felker
2025-09-19 14:06     ` Pablo Correa Gomez
2025-09-17 15:43 ` enh
2025-09-17 17:37   ` Rich Felker
2025-09-17 20:31 ` Rich Felker
2025-09-19 13:59 ` Pablo Correa Gomez
2025-10-01 13:55   ` Pablo Correa Gomez
2025-10-01 17:21     ` Markus Wichmann
2025-10-01 17:51     ` Demi Marie Obenour
2025-10-02  2:34     ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251002023414.GG1827@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=pabloyoyoista@postmarketos.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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