bug-gettext
[Top][All Lists]
Advanced

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

[bug #60027] Supporting template interpolation and tags in JavaScript


From: Bruno Haible
Subject: [bug #60027] Supporting template interpolation and tags in JavaScript
Date: Thu, 26 Sep 2024 20:39:39 -0400 (EDT)

Follow-up Comment #3, bug #60027 (group gettext):

Note that if the function transforms the template literal

_`A dog named ${name}`

to a string (for the POT file)

A dog named {0}

it is a format string of unknown kind. If we don't declare it as a format
string, translators are not guaranteed to produce valid translations.

The known syntaxes that support {0}, {1}, etc. as placeholders are
java-format, csharp-format, python-brace-format. But all of these have extra
extensions. We would need something like 'javascript-brace-format'. Is there a
quasi-standard facility for such format strings in JavaScript?
https://formatjs.io/ seems to use identifiers instead of the numbers 0,1,2...
- so that it requires a JSON object as argument at runtime, not an array.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60027>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

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