Closed rosscado closed 4 months ago
So it's not the case that translations don't work on iOS. They just don't work as expected for some unusual combinations of system language and region.
In iOS, if you set your system language to Portuguese and your region to Ireland, and don't set any overrides for the Safari browser, you get a browser locale of pt-IE
. Safari's implementation of i18n.getMessage
is unable to map this to the pt_BR
locale bundle, so falls back to en
.
The same goes for zh-IE
. In effect, iOS users need to select a more typical language and region combination such as pt-BR
or zh-CN
for i18n.getMessage
to work as expected in Safari.
Simpler locale bundles like de
or fr
work without complications, so even de-IE
will resolve to de
, it's only compound locale bundles like pt_BR
or zh_CN
that Safari struggles with.
The i18n.ts module is not loading internationalised messages in Safari on iOS.
This is because the capability check forThere are other issues with thechrome.i18n
passes but the subsequent call tochrome.i18n.getMessage
fails, becausechrome.i18n
is an empty{}
stub.getMessage
function too, in particular that its fallback mechanism relies on asynchronous operations but the function itself is not asynchronous. Solve by loading the message bundles on module initialisation so thatgetMessage
can assume they've already been populated and proceed to read them synchronously.