unicode-org / message-format-wg

Developing a standard for localizable message strings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to express expression locale?

eemeli opened this issue · comments

Through our past discussions on bidirectional isolation (#28, #315) and formatting to non-string targets (#41, #272), I believe that we've established a consensus on wanting to support output that may mingle content from more than one locale and script. Going further, I think we've established that the resolved locale of an expression may be considered as a separate field of data from its formatted value.

We have not yet, however, established how the locale of an expression should be defined on the input side of things. Is it an option that some functions might have, or should we treat it as something a bit special like the existing ICU and JS Intl formatters do?

If we expect locale to be one option among many, then I think we should clearly establish what its name and value should be. Is it lc, locale, locales or something else? Can its value be something other than a BCP-47 tag? If providing fallback tags, how are they defined and delimited?

If we want to treat locale as somehow special, then we need to use some special syntax for it. Something like this?

{In French, "{|bonjour| @fr}" is a greeting}

If we only establish a common practice for locale as an option, then I think one of our base formatters should be one that allows for an expression such as the above:

{In French, "{|bonjour| :string locale=fr}" is a greeting}

@eemeli to create PR proposal (see: telecon of 2023-08-14)

Close this as done, given that we have both a PR and design doc.