There is a problem with MessageFormat and languages with a country code like pl_PL and zh_CN

Continuing the discussion from Message Format support for localization:

I ran into issues testing my text with MessageFormat in different languages, because it didn’t work in Polish.

But after looking at an existing text, I think the error isn’t on my end, but rather that something isn’t working as expected.

The example I looked at is in the invite modal: js.user.invited.invite.link_validity_MF

In English, everything is fine:

It also works in German:

But it doesn’t work in Polish:

And it doesn’t work in Chinese:

Based on the documentation topic, I would expect all these translations to work, not only the German translation. So, I assume there is a bug somewhere that affects languages that have a different number of plurals than English.

5 Likes

Yes, the same problem, using zh-CN.

All the language string with MF end are broken and displayed in en-US format.

Thanks for reporting! Do you think this might’ve been caused by a recent change? Or has it always been like this? :thinking:

I don’t know. German works fine, so I usually don’t see that something is broken. I only noticed because I used messageFormat for the first time yesterday and chose Polish for testing. The rewind chat section is hidden if there are not enough messages, so to test more than the “other” part, I wanted a language with multiple plurals.

I just tried a dev install based on the stable branch, and it seems to work there:

1 Like

I think this should fix it:

Polish:

2 Likes

So I had really bad luck by choosing Polish as a language with a country code while I was testing, and if I had used Ukrainian everything would have worked without issues :cry: That would have saved me a lot of time.

1 Like