Replies: 8 comments 11 replies
-
@romulocintra What do you think? |
Beta Was this translation helpful? Give feedback.
-
adding to the 23 January agenda |
Beta Was this translation helpful? Give feedback.
-
Eliminating braces around ($prefixed) variables may run into problems with languages that do not use inter-word spaces (Thai, Chinese, Japanese,...) or cases where word spaces are used by the (content of the) variables are supposed to become part of a word. |
Beta Was this translation helpful? Give feedback.
-
Yes, we should definitely add an FAQ. The questions your give as examples are a good start (thanks) and are bound to resurface in the future. It’s a good idea to explicitly document the rationale for these choices. I’m going to try to bootstrap some answers by giving a bit of context and linking a few references to past discussions in separate replies below, so that we can discuss each of them separately. |
Beta Was this translation helpful? Give feedback.
-
I recall a discussion about which mode to start in: text or code.
|
Beta Was this translation helpful? Give feedback.
-
#255 has a lengthy discussion about this. As a group, we felt that it was more important to maximally limit the number of special characters that need to be escaped inside translation text. By using braces to delimit both patterns and placeholders, translations only ever need to escape Using curly braces everywhere is perhaps a bit less readable, but it can also be considered consistent, and is unambiguous syntax-wise. We assume that most developers writing MessageFormat strings can learn to use braces for everything, and that most translators will use CAT tools which hide the syntax anyways. |
Beta Was this translation helpful? Give feedback.
-
The exact naming of things in MessageFormat is not final and is being discussed in #248. #289 considered a few more keywords but |
Beta Was this translation helpful? Give feedback.
-
Updated proposal: {let $hostName = $host:person(firstName=long)}
{let $guestName = $guest:person(firstName=long)}
{let $guestsOther = $guestCount:number(offset=1)}
{match $host:gender $guestOther:number}
{when female 0} {$hostName} does not give a party.
{when female 1} {$hostName} invites {$guestName} to her party.
{when female 2} {$hostName} invites {$guestName} and one other person to her party.
{when female *} {$hostName} invites {$guestName} and {$guestsOther} other people to her party.
{when male 0} {$hostName} does not give a party.
{when male 1} {$hostName} invites {$guestName} to his party.
{when male 2} {$hostName} invites {$guestName} and one other person to his party.
{when male *} {$hostName} invites {$guestName} and {$guestsOther} other people to his party.
{when * 0} {$hostName} does not give a party.
{when * 1} {$hostName} invites {$guestName} to their party.
{when * 2} {$hostName} invites {$guestName} and one other person to their party.
{when * *} {$hostName} invites {$guestName} and {$guestsOther} other people to their party. The two main differences from the current syntax:
Regarding future list syntax options: {[$foo $bar]:listFormat(separator=and)} |
Beta Was this translation helpful? Give feedback.
-
Examples:
let
and notvar
?var
may be more appropriate?Alternative with translatable content not wrapped in braces:
I do like the formatting syntax mentioned here:
($count is probably already formatted as a number because of the plural, but it's just an example)
I find it much easier to see:
Putting that together, you get:
The current example seems to go against the design goal of making it clear which parts of the message body are translatable content. I believe that the translatable content should be "plain text" without any wrapping or sigils, and the matching logic should be the part that is clearly marked and separated. There is too much noise with all the braces, it should be easier to parse for humans.
Edit: It can also support multiple formatters/functions:
$amount:number(style=currency):round
Beta Was this translation helpful? Give feedback.
All reactions