Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements i18n for text, dates, times and numbers + some css changes… #31

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

f-CJ
Copy link
Contributor

@f-CJ f-CJ commented Jan 13, 2020

… to adjust some templates to longer texts + some refactoring needed for the i18n (e.g. ElectronStore abstraction)

When the app is executed for the first time (new installation or update that comes with this feature), the app will try to guess the language and formatting (dates, times, numbers) by the locale of the OS.

User can change language and formatting the Preferences page.

… to adjust some templates to longer texts + some refactoring needed for the i18n (e.g. ElectronStore abstraction)
@f-CJ f-CJ closed this Jan 13, 2020
@f-CJ f-CJ reopened this Jan 13, 2020
@Cryptarchist
Copy link
Contributor

@f-CJ this looks good thanks!

I haven't tested yet, but had a couple of comments:

  • I think it would be good to add a English source file. This would make it easier for us to start integrating with a service like Transifex (which we use for the Core code translations). The service relies on a source lang file (e.g. en.json) and then translators go from there.
  • I don't believe Transifex supports .js, but does support .json file formats. Would it be easier enough to move to that?

Happy for your thoughts, especially if you have experience with translation services. I have only used Transifex with Core.

@f-CJ
Copy link
Contributor Author

f-CJ commented Jan 31, 2020

I don't have experience with translation services so I can't help with that.

  • An English source file could be generated with just a few lines of code in a simple npm script.
  • Sure, to move a javascript data object to json and vice versa is trivial. So yes, it is possible to move the .js files to json files.

The idea is to use the API of Transifex or translation files will be in the source code?

If it is fine for you, I will create the npm script to generate the english source file and move the .js files to json.

As you can see in the code, I decided to use the original english text as the key, that is why there is no english translation file because the english text is already in the source files. This has some benefits but also comes with some problems. The main benefit is that devs can read the full text in the source code and that gives a very good context about what is going on. The main problem is that any change in the original english text in the source files will affect all translation file keys (a script could be created to force consistency).

If you consider that is better to just use a code as the key, please let me know.

Is there anything else I can do to help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants