-
Notifications
You must be signed in to change notification settings - Fork 541
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
[Bug]: Fix "ImpliedQuantity" lint warning in pt-rBR strings. #5231
Comments
@deonwaju contrary to the suggestion in #5169 (comment):
An approach that might be worth testing based on my examination of the ptBr strings file, is fixing the formatting in the plurals by removing the newlines(\n). Please see #5164 for expected correct string formats for quantity and plurals. Might be worth checking other langauge string files for similar formatting errors. |
Hi @adhiamboperes, This issue seems to persist, i have tried the above methods and checked on comment #5164, also tried a few ways. The issue lies "The warning you're seeing is related to internationalization and localization (i18n/l10n) of your application, specifically dealing with pluralization in different languages.". The only solution that seemed to |
Hi @deonwaju, can you confirm that this plural is formatted in the same way in all translations? |
Based on https://googlesamples.github.io/android-custom-lint-rules/checks/ImpliedQuantity.md.html and the lint report, it seems that adding the string template as you are suggesting should be fine. But use My concern is, how will we pass the value "1" in the code where the plural is used, if the default English translation is not in the same format? (You can change the locale on your device and test this out). Are you going to change the string in english too? Additionally, are you going to modify the other plurals in the file too? Lastly, I would still prefer the plurals formatting fixed in general, per my earlier comment. |
@adhiamboperes Your concerns are valid, But I didnt make the changes in the other languages, I cant change my the locale on my phone for some reason, Also for concerns in passing the value "1" in the code where the plural is used. I dont know if the below function does that automatically. Finally, I am leaning towards leaving this issue and picking up another issue and leaving this issue till a proper solution with fewer unknowns arrives. |
Hello @adhiamboperes |
@deonwaju, feel free to work on something else |
Hi @deonwaju, I looked into this some more, and per https://developer.android.com/guide/topics/resources/string-resource#Plurals, we can fix this by changing the plural strings for one in pt-rBR to include a %d as discussed. No aditional change would be required where the string is called. It should be easy to verify this by changing your phone language to spanish and confirming that it displays correctly in the app. |
Hello @adhiamboperes, I understand the rest, but could you please explain this? Do you mean removing the \n right? |
Yes, that is correct. |
<!-- READ ME FIRST: Please fill in the explanation section below and check off every point from the Essential Checklist! --> ## Explanation <!-- - Explain what your PR does. If this PR fixes an existing bug, please include - "Fixes #bugnum:" in the explanation so that GitHub can auto-close the issue - when this PR is merged. --> Fix #5231 1. Replaced quantity "one" with %s at warnings of implied quantity in pt-rBR strings. 2. Removed new line formats. <img width="1085" alt="Screenshot 2023-12-04 at 21 22 46" src="https://github.com/oppia/oppia-android/assets/54560535/852c14eb-c523-4515-b152-32ea6adc9615"> Before ![Screenshot 2023-12-04 at 20 50 19](https://github.com/oppia/oppia-android/assets/54560535/a6118bc9-6592-49b8-a17a-e9d0995edda2) After ![Screenshot 2023-12-04 at 20 50 29](https://github.com/oppia/oppia-android/assets/54560535/aefeba2d-9b13-4db2-9a2a-8dd665f8e476) ## Essential Checklist <!-- Please tick the relevant boxes by putting an "x" in them. --> - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only <!-- Delete these section if this PR does not include UI-related changes. --> If your PR includes UI-related changes, then: - Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes - For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see [RTL guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines)) - Add a video showing the full UX flow with a screen reader enabled (see [accessibility guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide)) - For PRs introducing new UI elements or color changes, both light and dark mode screenshots must be included - Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing
Steps To Reproduce
Run the following command from a terminal in a checked-out Oppia Android repo:
./gradlew :app:lint
Expected Behavior
Running the command above should not show any ImpliedQuantity. warnings.
The text was updated successfully, but these errors were encountered: