parley-messaging / ios-library

Parley iOS app library
MIT License
2 stars 2 forks source link

Add support for new localizations. #95

Closed mat1th closed 4 months ago

mat1th commented 4 months ago

Describe the feature The SDK only supports 2 localizations for now the nl and en localization. We would like to support more languages in our app. For now this is only possible with manually adding translations because it is always searching in the SDK bundle.

Screenshot NA

Possible solution A possible solution would be to add the localization strings to the Appearance objects. There are only two kinds of places where this is not possible.

Is this a okay solution, or do you want separate objects for the translations?

alexkok commented 4 months ago

Hi @mat1th , thanks for reporting.

All keys are prefixed by parley_ already and we would allow overriding these when wanted (just like Android used to do). However, as you describe, it currently only searches in the module bundle, making it impossible to override.

While the suggested solution could work, we are thinking of a different approach:

How does this sound to you?

mat1th commented 4 months ago

We do also have the option in our app to overwrite the system locale. So for example a user does has his system language to en while the app will use nl while the app does also support en.

With you supposed solution this will not work for us.

alexkok commented 4 months ago

You are right on that one, in that case that won't work. Agreed, need to add handling texts in a different manner then.

As for the MessageImageViewController, maybe we could set these with a key like "general" or so (there's the parley_close for example which just should be Close in EN for example.

Although separate text classes (like we do with appearance) might be too verbose for the goal of localizing the texts. I think an enum and a protocol would be a nice way, similar to how offline messaging and the network is separated with protocols.

Where:

Just a first idea concept to think through, names/terms could change. How does this sound?

mat1th commented 4 months ago

Hi @alexkok,

I've made a implementation on and opened a pr https://github.com/parley-messaging/ios-library/pull/113.