Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Discussion] Support multiple languages #215

@Flavsditz

Description

@Flavsditz

Context
The idea here is to allow more people to use the application by translating to several languages and reach a wider audience who might not have a full grasp of the english language and thus feel more comfortable in their native language.

Solution idea

  • Add 1..N JSON files (alternative using YAML) with language codes
    • These will contain all strings that are used in the UI
  • Add an language menu that will get generated from the list of those JSON files (so it dynamically reacts to additions of languages)
  • A class would take care of receiving the word/phrases keys and return the corresponding values of the currently selected language
    • If the key is not available or empty on the requested language we should fallback to the default english case
  • I would go through the whole project and replace the sentences with calls to the aforementioned class with the corresponding key.

Notes/Questions:

  • Contributions for translations could be done by other people such as the user in issue Translation Of Open Rocket To Arabic Language #212
  • There are existing solutions but I would study them to see if it is not just simpler to DIY and keep the code as lean as possible.
    • python itself has (internationalisation options)[https://docs.python.org/3/library/i18n.html]
    • there are also other packages such as python-i18n
  • By going through the code I've noticed a lot of ENUMS being handled as strings. While this would work even with the solution above I would be willing to refactor that (could be in a separate MR) into a proper ENUM usage and just on the UI touching parts use the translations. These are used through the code for comparisons too
    • Example of this situation: When adding a grain there is an option dropdown with the values Neither/Top/Bottom/Both
  • I see a lot of comments about performance. Was there a code analysis done? If so which tool? I would love to take a look into this (just curious)

I'm glad to hear opinions and to have a nice discussion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions