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

Support appending local libraries strings #13527

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

wzieba
Copy link
Contributor

@wzieba wzieba commented Feb 12, 2025

So strings.xml of local libraries will be part of main app translations.

Description

This PR fixes an issue, which excluded strings of login module (formerly known as WordPress-Login-Flow-Android) after it has been merged to this repository.

This solution is inspired (copy-pasted) from WordPress Android codebase.

Testing information

I'm not sure how to test this change, so I'm open for suggestions.

The tests that have been performed

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

So `strings.xml` of local libraries will be part of main app translations.
@wzieba wzieba added type: bug A confirmed bug. category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. labels Feb 12, 2025
@wzieba wzieba requested a review from AliSoftware February 12, 2025 10:39
@dangermattic
Copy link
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit400d341
Direct Downloadwoocommerce-wear-prototype-build-pr13527-400d341.apk

@wpmobilebot
Copy link
Collaborator

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit400d341
Direct Downloadwoocommerce-prototype-build-pr13527-400d341.apk

@@ -49,6 +49,12 @@ REMOTE_LIBRARIES_STRINGS_PATHS = [
exclusions: []
}
].freeze
LOCAL_LIBRARIES_STRINGS_PATHS = [
# NOTE: for those we don't set `add_ignore_attr` to true because we currently use `checkDependencies true` in `WordPress/build.gradle`
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment mentions WordPress/build.gradle and this line in it. You should probably update the comment for the case of WC (and check if you need to enable checkDependencies true in lint { } for WC's build.gradle config too if not already?

@@ -739,6 +745,9 @@ platform :android do
#
desc 'Merge libraries strings files into the main app one'
lane :localize_libs do
# Merge `strings.xml` files of libraries that are hosted locally in the repository (in `./libs` folder)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm guessing this is just a copy/paste of the comment from WP, but reading it now it felt a bit hard to parse/understand. What about:

Suggested change
# Merge `strings.xml` files of libraries that are hosted locally in the repository (in `./libs` folder)
# Merge `strings.xml` files of libraries hosted in this repo (in `./libs` folder) into the `strings.xml` of the main app
# (so that they can all be uploaded in a single GlotPress project)

@AliSoftware
Copy link
Contributor

I'm not sure how to test this change, so I'm open for suggestions.

I think the simplest way would be to:

  1. Cut a dummy branch from this PR's branch
  2. Modify random things in the ./libs/login/src/main/res/values/strings.xml file, e.g. remove some entries, add new ones, modify the string copy of some existing keys, …)
  3. Run bundle exec fastlane localize_libs
  4. Check that it created a commit containing changes to the app's main strings.xml file, and the changes in that file correspond to the dummy changes you made on step 2 in the lib's string file

I'd expect any string you added or modified in the lib's string file should be reflected in the main app's strings file after you ran the lane.

PS: I'm not 100% sure what's supposed to happen for strings you remove from the libs' string, i.e. if our an_localize_libs action is smart enough to detect their removal and remove them from the main's string… or if that would even be a good idea for that action to do that to begin with, to avoid the risk of breaking the app in case such a string's key were not only used by the lib's code… but also by the apps' code and would still need to be kept around in the main app's strings file, not removed… So I think for that case you'd expect the commit created by calling localze_libs lane to have added and modified strings, but not do anything for removed ones…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. type: bug A confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants