ivy-wallet icon indicating copy to clipboard operation
ivy-wallet copied to clipboard

[FEATURE] Add a language dropdown in Settings

Open ILIYANGERMANOV opened this issue 1 year ago • 7 comments

Please confirm the following:

  • [X] I've checked the current issues for duplicate issues.
  • [X] I've requested a single (only one) feature/change in this issue. It complies with the One Request Per GitHub Issue (ORPGI) rule.
  • [X] My issue is well-defined and describes how it should be implemented from UI/UX perspective.

What do you want to be added or improved?

As a user I want to be able to change Ivy Wallet's language to one of the supported ones.

Why do you need it?

  • Change Ivy Wallet's language without changing the language of the device.

How do you imagine it?

  • An "App Language" material3 drop-down that can change the app's language to one of the supported languages that can be hard-coded as enum

ILIYANGERMANOV avatar Apr 15 '24 20:04 ILIYANGERMANOV

Thank you @ILIYANGERMANOV for raising Issue #3138! 🚀 What's next? Read our Contribution Guidelines 📚.

Tagging @ILIYANGERMANOV for review & approval 👀

ivywallet avatar Apr 15 '24 20:04 ivywallet

I'm on it

SpyrosKoutsangelis avatar Apr 27 '24 00:04 SpyrosKoutsangelis

Thank you for your interest @SpyrosKoutsangelis! 🎉 Issue #3138 is assigned to you. You can work on it! ✅

If you don't want to work on it now, please un-assign yourself so other contributors can take it.

Also, make sure to read our Contribution Guidelines.

ivywallet avatar Apr 27 '24 00:04 ivywallet

@SpyrosKoutsangelis If you are not working on it, Can I take this issue?

Mouzzamsddq avatar May 10 '24 05:05 Mouzzamsddq

@Mouzzamsddq Sorry for the delay. I believe I'm close to finishing this

SpyrosKoutsangelis avatar May 10 '24 22:05 SpyrosKoutsangelis

I have been working on this and though I believe I'm close to finishing this (as per my last comment), stringRes() is giving me trouble.

Lots of strings are created and stored in memory (as parts of objects) when the app starts, so even after the language changes, those strings remain unchanged.

ie. ACTIVE_CARDS's items contain strings created in such a way. Neither ACTIVE_CARDS nor any of its items get their values changed at any time after their initialization. https://github.com/Ivy-Apps/ivy-wallet/blob/4e25b3f4020066154dfe1a55c1ada422d1d4afdc/screen/home/src/main/java/com/ivy/home/customerjourney/CustomerJourneyCardsProvider.kt#L56-L69

The result of this is having some screens appear with parts of them in the original language and other parts in the new language.

I have three proposals to resolve this:

  1. Make strings created by stringRes() NOT be stored in memory This way, stringRes() will be called again and again, which ensures that each call will produce a result based on the current language. However, this is very error-prone. If anyone stores the result of stringRes() as part of an object in the future, this will immediately introduce a bug.

  2. Remove stringRes() entirely stringRes() already has the @Deprecated("Legacy. Will be removed.") tag anyway, and I think completely removing it is do-able. My only concern is that it will probably need A LOT of changes and I'm afraid these changes are beyond the goal of the current feature.

  3. Prompt the user to manually restart the app As said above, the issue is caused by Strings that are generated and stored at the app's start. But this means that when the app is restarted, those strings are re-generated, this time based on the new language. This way the functionality of changing the language while the app is still open is lost, but at least it seems like a safe solution. Of course, showing a popup/dialog with a text like "Your changes will take effect the next time you open the app" would be needed.

Any thoughts on this? @ILIYANGERMANOV (Sorry if tagging you specifically is not appropriate, I'm not sure who else might be suitable to make a decision on this)

SpyrosKoutsangelis avatar May 14 '24 22:05 SpyrosKoutsangelis

Hey @SpyrosKoutsangelis nice work! 3. Prompt to manually restart the app is perfect. Most people will be happy if they can change the language at all

ILIYANGERMANOV avatar May 14 '24 22:05 ILIYANGERMANOV

Hey @SpyrosKoutsangelis If someone are not working on it, Can I take this issue?

TanishMoral11 avatar Jul 04 '24 18:07 TanishMoral11

Hey @TanishMoral11 feel free to take it, a few months have passed. Type the magic words

ILIYANGERMANOV avatar Jul 04 '24 20:07 ILIYANGERMANOV

I'm on it

suyash01 avatar Jul 12 '24 20:07 suyash01

Thank you for your interest @suyash01! 🎉 Issue #3138 is assigned to you. You can work on it! ✅

If you don't want to work on it now, please un-assign yourself so other contributors can take it.

Also, make sure to read our Contribution Guidelines.

ivywallet avatar Jul 12 '24 20:07 ivywallet