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

Make all application strings be referenced from a Scribe-i18n XML file #44

Closed
2 tasks done
andrewtavis opened this issue Jul 27, 2024 · 16 comments
Closed
2 tasks done
Assignees
Labels
feature New feature or request help wanted Extra attention is needed

Comments

@andrewtavis
Copy link
Member

andrewtavis commented Jul 27, 2024

Terms

Description

Prior to release with multiple localizations, and to make it easier for people to use the exact strings that are needed for the application, it would be good to have them all be referenced from a common XML file. This file would be generated in the Scribe-i18n project whenever there's a PR from Weblate and then transferred over to Scribe-Android :)

Contribution

Would be happy to discuss and support this as well as review! 😊

@andrewtavis andrewtavis added feature New feature or request help wanted Extra attention is needed labels Jul 27, 2024
@andrewtavis
Copy link
Member Author

@angrezichatterbox, would this one make sense now? You could do a PR for some Python for scribe-org/Scribe-i18n#27 where you'd make the XML equivalent of the xcstrings to json scripts, and then from there we can start using the XML files and don't need to worry about putting them all in later on?

@angrezichatterbox
Copy link
Member

angrezichatterbox commented Aug 9, 2024

Yes, I would work on this issue. I would work on writing Python scripts for JSON to XML and XML to JSON as well and make a PR for that.

@angrezichatterbox
Copy link
Member

angrezichatterbox commented Aug 9, 2024

I don't have much idea about how localization is in iOS. But I haven't seen a single strings.xml file for all the languages in any Android project yet. So could I put each language into its own XML or should I look into having a single strings.xml file for all languages? Should I make the discussions over there in the issue ?

@andrewtavis
Copy link
Member Author

Will quote you over there, @angrezichatterbox :)

@andrewtavis
Copy link
Member Author

Ok, @angrezichatterbox, Scribe-i18n is now in the repo at main/app/src/main/res/i18n. Let me know if accessing the values there can work out, and we can also change up any of the naming of files if you think that would help :)

@angrezichatterbox
Copy link
Member

Ok, @angrezichatterbox, Scribe-i18n is now in the repo at main/app/src/main/res/i18n. Let me know if accessing the values there can work out, and we can also change up any of the naming of files if you think that would help :)

I will check accessing the files of i18n.

@andrewtavis
Copy link
Member Author

Thanks so much, @angrezichatterbox! :)

@angrezichatterbox
Copy link
Member

angrezichatterbox commented Aug 11, 2024

So this is how I have done it for now. When the gradle build starts there would be two tasks that have to occur before the gradle build it would the deletion of the README and LICENSE from the res since they are not in XML format and the folders string.xml would be transferred from i18n to their respective values-locale folder. The issue would be that the build takes a little longer than usual but the app complies. What do u think of doing it like this?. Also, there seem to be formatting errors in the XML which I would have to fix.

Some variables currently don't have a value in the strings.xml being referenced should I have a constant value in the XML layout or should I add those values to the string.xml? There seem to be a lot of them considering dialogue boxes and all.

@andrewtavis
Copy link
Member Author

Hey @angrezichatterbox 👋 @henrikth93 and I were looking at this just right now. He was getting an error where the README was not valid within the res folder, so I reset the subtree add just now and we moved Scribe-i18n into the app/src/main/assets/i18n directory. As I understand it, res has specific filetype restrictions, but the assets directory can serve a similar purpose and would allow us to not need to delete the files on build? Big thing is that the way things work, we cannot just delete those files as that would screw up the git log for the subtree.

Let me know how this sounds, and thanks for the efforts so far! 😊

@angrezichatterbox
Copy link
Member

Hey @angrezichatterbox 👋 @henrikth93 and I were looking at this just right now. He was getting an error where the README was not valid within the res folder, so I reset the subtree add just now and we moved Scribe-i18n into the app/src/main/assets/i18n directory. As I understand it, res has specific filetype restrictions, but the assets directory can serve a similar purpose and would allow us to not need to delete the files on build? Big thing is that the way things work, we cannot just delete those files as that would screw up the git log for the subtree.

Let me know how this sounds, and thanks for the efforts so far! 😊

Yes It would be much better. I was creating a temporary folder for regenerating it after the build but this would be much better.
Do u have any suggestions for generating the values of different locales during the build or should I look into other possible ways to do this?

@andrewtavis
Copy link
Member Author

Do u have any suggestions for generating the values of different locales during the build or should I look into other possible ways to do this?

What do you mean by this, @angrezichatterbox? Shouldn't we just have all the locales there and only offer those four that we currently have? I think the way that it works for iOS is that English-US is the default for all other locales. Would that solve the issue?

@angrezichatterbox
Copy link
Member

I considered using the Android build-in support for locales by shifting the assets folder languages to the values folder for various locales during build only. We could very well use the assets folder itself for the locales but it wouldn't be able to completely use Android build in features. I am comfortable doing whichever sounds good to you. :)

@andrewtavis
Copy link
Member Author

Would moving Scribe-i18n to the values directory make more sense? I'm happy to do that now if it would :) Aside from that, happy to have it setup for the build as you see fit!

@angrezichatterbox
Copy link
Member

angrezichatterbox commented Aug 11, 2024

Can the contents of the values folder be made to the res/ That would be helpful. In that case, I would have to rename the contents to values-. or else I would have to set up for pre-gradle build.

@angrezichatterbox
Copy link
Member

I have made a PR for this issue. I have broken it into 3 commits consisting of the addition of the script and pre-built values. And then further adding those values to activities and method.xml

@andrewtavis
Copy link
Member Author

Closed by #57 🚀 Will write you on element about next steps, @angrezichatterbox! Really amazing progress so far, and hopefully the sailing just got a lot smother now that we have colors and strings fully defined 😊

@github-project-automation github-project-automation bot moved this from In Progress to Done in Scribe Board Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request help wanted Extra attention is needed
Projects
Archived in project
Development

No branches or pull requests

2 participants