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

Improve convert_jsons_to_strings.py #64

Conversation

OmarAI2003
Copy link
Contributor

@OmarAI2003 OmarAI2003 commented Oct 8, 2024

Continuing the work discussed here to the localization of JSON files this PR includes the following changes :

  1. Pre-loaded JSON files:

    • All language JSON files are now pre-loaded into a dictionary before generating the strings.xml files.
    • This reduces redundant file I/O operations, improving the overall performance of the script.
  2. Improved Error Handling:

    • Added a check to ensure the jsons folder exists before processing, preventing potential runtime errors.

3 Generated missing 'hi' folder:

  • Added the hi language folder generated by this script to prevent directory not found errors when testing the reverse conversion from JSON to strings.

Related issue:
#57

…files

- Pre-loaded all language JSON files into a dictionary to minimize redundant I/O operations.
- Modified the XML file generation loop to use pre-loaded translations for each language.
- Improved code readability and performance by reducing file reads inside the loop.
…generated by the script to prevent 'directory not found' errors when testing the reverse conversion (JSON to strings).
Copy link

github-actions bot commented Oct 8, 2024

Thank you for the pull request!

The Scribe team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and i18n rooms once you're in. Also consider joining our bi-weekly Saturday dev syncs. It'd be great to have you!

Maintainer checklist

  • The commit messages for the remote branch should be checked to make sure the contributor's email is set up correctly so that they receive credit for their contribution
    • The contributor's name and icon in remote commits should be the same as what appears in the PR
    • If there's a mismatch, the contributor needs to make sure that the email they use for GitHub matches what they have for git config user.email in their local activist repo

@andrewtavis andrewtavis removed the request for review from angrezichatterbox October 8, 2024 21:26
Copy link
Member

@andrewtavis andrewtavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for this, @OmarAI2003! Feel free to jump into strings_to_json and we can then maybe move on to the MSA localization 😊

@andrewtavis andrewtavis merged commit 5e85b16 into scribe-org:main Oct 8, 2024
@OmarAI2003 OmarAI2003 deleted the improve-android-convert-jsons-to-strings branch October 8, 2024 22:59
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