alephium / desktop-wallet

The official Alephium wallet for desktop
https://alephium.org
GNU Lesser General Public License v3.0
79 stars 44 forks source link

Init i18n #192

Closed mvaivre closed 2 years ago

mvaivre commented 2 years ago

Translating the wallet would increase accessibility and broaden the potential audience of the app. It's a relatively low hanging fruit, easy to implement using for instance react-i18next.

It would also be a wonderful opportunity to involve our community to provide translations (cc/ @Sakrecoer )

Sakrecoer commented 2 years ago

Thanks for cc:ing me! I applause the initiative and agree with the benefits! It will be a pleasure to help make this happen!

nop33 commented 2 years ago

I suppose then that all English texts from the wallet would live inside a yaml or json file, right? Then, maybe we could find some tools that integrate with GitHub and allow the community to easily make PRs to add translations! win-win!

lf94 commented 2 years ago

It'd be better to use more official internationalization technology like gettext: https://en.wikipedia.org/wiki/Gettext It's fairly ubiquitous.

lf94 commented 2 years ago

/cc @mvaivre @nop33 what tech do you want to settle on?

nop33 commented 2 years ago

I don't know what tools are out there, I would need to do research. But first, we gotta define our requirements. I would propose the following requirements, please, feel free to extend:

  1. Good integration with React
  2. We can easily involve the community in adding translations (there are easy to use tools available for non-tech people)
lf94 commented 2 years ago

I'll conduct some quick research since it's assigned to me :slightly_smiling_face:

mvaivre commented 2 years ago

As said in the description, I had some good experiences with react-i18next! It's lightweight, straightforward, ships with a handy useTranslation hook (works on React and React Native, so same interface), and is based on simple json files. But I'm curious to see if new alternatives exist.

LeeAlephium commented 2 years ago

Well like I said, po files are accepted by a lot of translation services, whereas json which can be structured in any way may not be as common (non-standard)... Haven't gotten around to looking at anything but I wouldn't be surprised if react-i18next reads them too or has a tool for conversion :slightly_smiling_face:

mvaivre commented 2 years ago

After a quick research, it seems like most of the translation services now support JSON (this, that, this one, that one (by the creators of i18next)...), and there are ways to convert po <-> json if needed. So it seems like we should rather focus on comparing the Devx of the different solutions! 👓

LeeAlephium commented 2 years ago

i18next looks just fine then :)

https://www.i18next.com/principles/fallback#key-fallback makes me happy to see, but I'm surprised it's not recommended:

While this works and might reduce files to load it makes the management of translations a lot harder as you will need to update changes to fallback values in code and JSON files. Possible - but not recommended.

I find it's the opposite: people have preferred po over time because you don't lose the semantics of what you're translating, and if one is missing it will fallback to the "source of truth" translation (English). Regardless you will have to change key names if the semantics change, which happen all the time, and a short key name is usually not sufficient to capture semantics.

nop33 commented 2 years ago

When I was working for the open source software Indico, we were using Transefix as the service to upload our json files so that translators have a smooth experience in translating them. I remember it offers a free tier for open source projects. Might be interesting for us.

Here's a preview of the current localization status of Indico for example https://www.transifex.com/indico/indico/