tahowallet / extension

Taho, the community owned and operated Web3 wallet.
https://taho.xyz
GNU General Public License v3.0
3.12k stars 393 forks source link

[Feature]: UI string localization #438

Open Umiiii opened 2 years ago

Umiiii commented 2 years ago

Discord Discussion Link

https://discord.com/channels/808358975287722045/875438141610270740/911210317302870067

What would you like to be able to do?

To allow people who doesn't speak English can also join the crypto world, we should localize all the string inside tally extension. For now, the alpha version of tally hardcoded all its string. I think it is the best time to do this thing in parallel, because if we do this in future, there will be more strings.

So I suggested there should be these steps (in general, draft):

Shadowfiend commented 2 years ago

This sounds great! As noted in Discord, would love to see a working group develop alongside this. We've def taken the quick path at the moment, but have had i18n in the back of our minds. A lot of the localizable pieces are localized where possible in the current code (e.g., currency stringification, decimalization).

gasolin commented 2 years ago

1195 introduced the basic structure of i18n on the extension side.

may need to think more about how to support string localization to the extension

there are 3 goals to meet

  1. to find a way to sync each messages.json file (ex, when en/messages.json changed, how to propagate to others)
  2. easiness to leverage the community's help, new translations requests will happen in each release cycle
  3. monitor the translation progress of each language

for example, to evolve from this PR, the translation flow could start from picking an online translate tooling such as https://translatewiki.net/ , https://crowdin.com/ or others

gasolin commented 2 years ago

https://discord.com/channels/808358975287722045/808360140008456203/975749765901983824

just setup one https://hosted.weblate.org/projects/tallycash/ if all settled, weblate supports webhook to get updated from tally repo en/message.json and support push PR to tally 🤩

current lack parts:

gasolin commented 2 years ago

PRO: weblate support embed translate status in README page

Translation status

also provide landing page for translators https://hosted.weblate.org/engage/tallycash/

gasolin commented 2 years ago

need tally project maintainer to grant the weblate integration in github https://docs.weblate.org/en/latest/admin/continuous.html#github-setup

gasolin commented 2 years ago

TODO: add language switch https://discord.com/channels/808358975287722045/808360140008456203/976113413438705754

jagodarybacka commented 2 years ago

@gasolin I'm checking weblate, can you add me to the project? I have the same username as on the github. Right now I think it is something we could use, one minor issue is that I think UX of their website is not so user friendly, I have a hard time navigating through the translations.

gasolin commented 2 years ago

@jagodarybacka added you in https://hosted.weblate.org/projects/tallycash/extension/

gasolin commented 2 years ago

Here's the translation flow with github

phase 1: dev add some EN strings in github, then maintainer can trigger the EN string sync on weblate (and the tool will auto propagate missing strings to other locales)

截圖 2022-05-18 下午11 16 55

phase 2: Translators express their talent in weblate

截圖 2022-05-18 下午11 21 54

phase 3:

Dev checkout locales from weblate and send PR to github (this can be done via weblate github bot)

截圖 2022-05-18 下午11 22 21
gasolin commented 2 years ago

the origin mermaid graph

graph LR
D(Dev) -.->|1. commit en string| G((Github))
G -.-> |2. sync en string| W((Weblate))
T(Translators) -.-> |A. add locale strings| W
T -.-> |B. verify strings| W 
W -.-> |C. download locales| D
D -.-> |D. Send locales PR| G
gasolin commented 2 years ago

related PR that added localization section in readme https://github.com/tallycash/extension/pull/1402

gasolin commented 2 years ago

related tasks #1543 #1544

gasolin commented 2 years ago

https://discord.com/channels/808358975287722045/977985099595395152/981580662907744288

Currently, we dont apply any restriction in weblate yet, but for a more formal flow it might looks like:

  1. any translator can suggest a local string for any string
  2. only the (assigned) locale language owner can approve the suggestion
  3. dev gather the locale strings and make a PR to github
gasolin commented 2 years ago

updated the weblate settings to

  1. need contact maintainer to add new locale
  2. only allow suggest string instead of modify string without notice
  3. when 2+ people approve the suggested string, it will be treat as translated
gasolin commented 2 years ago

To get locale files from weblate,

  1. git clone https://hosted.weblate.org/git/tallycash/extension/
  2. check ui/_locale/XX/messages.json which reflects all locale files
gasolin commented 2 years ago

weblate translations are now i18next compatible and host in https://hosted.weblate.org/projects/tallycash/wallet/ translate strings use GPLv3 license as well