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

Change to .xcstrings conversion #31

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

Jag-Marcel
Copy link
Member

Previously, the conversion from JSON files to Localizable.xcstrings resulted in the English translations always being the last in order. This would result in Xcode automatically reordering all languages to be in alphabetical order, which made comparing changes to the source code confusing.
With the changes here, the languages should be in the proper order. I also added the updated localization file for Xcode.

Converting the json files to Localizable.xcstrings now results in all languages being in alphabetical order instead of having English always at the end. The updated xcstrings file is also included.
Copy link

github-actions bot commented Aug 2, 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 Localization 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 self-requested a review August 2, 2024 21:48
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 for the attention to detail here, @Jag-Marcel! 😊

@andrewtavis andrewtavis merged commit 9370443 into scribe-org:main Aug 2, 2024
1 check passed
Comment on lines +40 to +46
data += (
f' "{lang}" : {{\n'
f' "stringUnit" : {{\n'
f' "state" : "",\n'
f' "value" : "{translation}"\n'
f" }}\n"
f" }},\n"
Copy link
Member

Choose a reason for hiding this comment

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

Just wondering something about a potential future evolution for the script..

If I've understood, Localizable.xcstrings is essentially structured in JSON-like format as well? (correct me if I'm mistaken though). If so, would we be able to more heavily lean into using the json Python module to help with its creation? I'm mostly thinking like as in using Python objects/dicts to help build the full JSON for Localizable.xcstrings and then using json.dumps() to get the content to populate the file at the end (as in ref). Just thinking it could be a way to use some clearer, simpler Python code as opposed to having to format the file by manually adjusting for spaces and newlines, escaping characters, etc.

Would this make sense?
If so, can absolutely be something for later - as the current version appears to be largely working. Just something that came to mind here.
CC @andrewtavis @Jag-Marcel

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.

3 participants