johnny
johnny

Reputation: 169

How to configure localization of roles and traits for core RN views in iOS?

Currently, there is one Localizable.strings file per language in React Native, which, however, only contains a comment like this (the hash varies): // @generated SignedSource<<6c4053ad9f2da7cd9f9d1bc0789bd1e5>>

If my device language is different than English (e.g. German), then Voiceover still announces some traits in English (e.g. checked, unchecked), but with a voice synthesized for that language, which sounds really weird.

Are React Native apps required to include translations for roles and traits in their own Localizable.strings files so that these are announced correctly?

What confuses me is that RN additionally includes a fbt_language_pack.bin file, which has some translations in it (it is semi-binary so difficult to read), but apparently it does not work out of the box. Am I supposed to configure this somehow?

Upvotes: 0

Views: 42

Answers (1)

Samuel Yang
Samuel Yang

Reputation: 1

I use patch-package to modify the Localizable.strings files.

I looked in the fbt_language_pack.bin and found some translation. It's like it is a key-value pair. I tried to match the translation with the potential keys in the Localizable.strings file. For checked I tried the key fQm6AybK and unchecked the key pOmNq0xe.

My Localizable.strings file

Then I used patch-package to create the patch of react-native to add these translations and ran pod install to apply the modifications.

See also : https://github.com/facebook/react-native/issues/43266#issuecomment-2176151625

It worked for react version 0.73.8 but it did not work anymore since I use react 0.75.3.

Is someone has a solution?

Upvotes: 0

Related Questions