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

[BUG]: Multiple substitutions specified in non-positional format of string resource #5484

Closed
MohitGupta121 opened this issue Aug 13, 2024 · 10 comments · Fixed by #5560
Closed
Assignees
Labels
bug End user-perceivable behaviors which are not desirable. good first issue This item is good for new contributors to make their pull request. Impact: Low Low perceived user impact (e.g. edge cases). Work: Low Solution is clear and broken into good-first-issue-sized chunks.

Comments

@MohitGupta121
Copy link
Member

Describe the bug

> Task :app:mergeDebugResources
/opensource/oppia-android/app/src/main/res/values-ar/strings.xml:95:2: Multiple substitutions specified in non-positional format of string resource string/chapter_completed. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-ar/strings.xml:93:2: Multiple substitutions specified in non-positional format of string resource string/chapter_in_progress. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-ar/strings.xml:96:2: Multiple substitutions specified in non-positional format of string resource string/chapter_name. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-ar/strings.xml:97:2: Multiple substitutions specified in non-positional format of string resource string/chapter_prerequisite_title_label. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-ar/strings.xml:110:2: Multiple substitutions specified in non-positional format of string resource string/math_expression_error_number_after_var_term. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-ar/strings.xml:447:2: Multiple substitutions specified in non-positional format of string resource string/onboarding_slide_dots_content_description. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-ar/strings.xml:329:2: Multiple substitutions specified in non-positional format of string resource string/profile_last_visited. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-ar/strings.xml:152:2: Multiple substitutions specified in non-positional format of string resource string/question_training_session_progress. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:80:2: Multiple substitutions specified in non-positional format of string resource string/chapter_completed. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:78:2: Multiple substitutions specified in non-positional format of string resource string/chapter_in_progress. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:81:2: Multiple substitutions specified in non-positional format of string resource string/chapter_name. Did you mean to add the formatted="false" attribute?

/Users/mohitgupta/.gradle/caches/transforms-3/a3ac098c2f10fa536abc6ff8a77d1852/transformed/material-1.6.0-alpha01/res/values-sw/values-sw.xml:7:4: Multiple substitutions specified in non-positional format of string resource string/chapter_prerequisite_title_label. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:98:2: Multiple substitutions specified in non-positional format of string resource string/math_expression_error_consecutive_binary_operators. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:101:2: Multiple substitutions specified in non-positional format of string resource string/math_expression_error_missing_lhs_for_addition_operator. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:102:2: Multiple substitutions specified in non-positional format of string resource string/math_expression_error_missing_lhs_for_division_operator. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:103:2: Multiple substitutions specified in non-positional format of string resource string/math_expression_error_missing_lhs_for_multiplication_operator. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:110:2: Multiple substitutions specified in non-positional format of string resource string/math_expression_error_multiple_redundant_parentheses. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:94:2: Multiple substitutions specified in non-positional format of string resource string/math_expression_error_number_after_var_term. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:92:2: Multiple substitutions specified in non-positional format of string resource string/math_expression_error_redundant_parentheses_individual_term. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:378:2: Multiple substitutions specified in non-positional format of string resource string/onboarding_slide_dots_content_description. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:273:2: Multiple substitutions specified in non-positional format of string resource string/profile_last_visited. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-sw/strings.xml:136:2: Multiple substitutions specified in non-positional format of string resource string/question_training_session_progress. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pt-rBR/strings.xml:98:2: Multiple substitutions specified in non-positional format of string resource string/chapter_completed. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pt-rBR/strings.xml:100:2: Multiple substitutions specified in non-positional format of string resource string/chapter_in_progress. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pt-rBR/strings.xml:96:2: Multiple substitutions specified in non-positional format of string resource string/chapter_locked_prerequisite_title_label. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pt-rBR/strings.xml:99:2: Multiple substitutions specified in non-positional format of string resource string/chapter_name. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pt-rBR/strings.xml:101:2: Multiple substitutions specified in non-positional format of string resource string/chapter_prerequisite_title_label. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values/strings.xml:96:2: Multiple substitutions specified in non-positional format of string resource string/chapter_completed. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values/strings.xml:98:2: Multiple substitutions specified in non-positional format of string resource string/chapter_in_progress. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values/strings.xml:94:2: Multiple substitutions specified in non-positional format of string resource string/chapter_locked_prerequisite_title_label. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values/strings.xml:97:2: Multiple substitutions specified in non-positional format of string resource string/chapter_name. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pt-rBR/strings.xml:427:2: Multiple substitutions specified in non-positional format of string resource string/onboarding_slide_dots_content_description. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pt-rBR/strings.xml:309:2: Multiple substitutions specified in non-positional format of string resource string/profile_last_visited. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pt-rBR/strings.xml:156:2: Multiple substitutions specified in non-positional format of string resource string/question_training_session_progress. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values/strings.xml:99:2: Multiple substitutions specified in non-positional format of string resource string/chapter_prerequisite_title_label. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values/strings.xml:683:2: Multiple substitutions specified in non-positional format of string resource string/onboarding_slide_dots_content_description. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values/strings.xml:332:2: Multiple substitutions specified in non-positional format of string resource string/profile_last_visited. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values/strings.xml:157:2: Multiple substitutions specified in non-positional format of string resource string/question_training_session_progress. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values/strings.xml:425:2: Multiple substitutions specified in non-positional format of string resource string/welcome_profile_name. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pcm-rNG/strings.xml:98:2: Multiple substitutions specified in non-positional format of string resource string/chapter_completed. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pcm-rNG/strings.xml:100:2: Multiple substitutions specified in non-positional format of string resource string/chapter_in_progress. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pcm-rNG/strings.xml:96:2: Multiple substitutions specified in non-positional format of string resource string/chapter_locked_prerequisite_title_label. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pcm-rNG/strings.xml:99:2: Multiple substitutions specified in non-positional format of string resource string/chapter_name. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pcm-rNG/strings.xml:101:2: Multiple substitutions specified in non-positional format of string resource string/chapter_prerequisite_title_label. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pcm-rNG/strings.xml:443:2: Multiple substitutions specified in non-positional format of string resource string/onboarding_slide_dots_content_description. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pcm-rNG/strings.xml:311:2: Multiple substitutions specified in non-positional format of string resource string/profile_last_visited. Did you mean to add the formatted="false" attribute?

/opensource/oppia-android/app/src/main/res/values-pcm-rNG/strings.xml:156:2: Multiple substitutions specified in non-positional format of string resource string/question_training_session_progress. Did you mean to add the formatted="false" attribute?

Steps To Reproduce

Build app and see build logs

Expected Behavior

There should be no multiple strings

Screenshots/Videos

No response

What device/emulator are you using?

No response

Which Android version is your device/emulator running?

No response

Which version of the Oppia Android app are you using?

No response

Additional Context

No response

@MohitGupta121 MohitGupta121 added bug End user-perceivable behaviors which are not desirable. triage needed good first issue This item is good for new contributors to make their pull request. Impact: Low Low perceived user impact (e.g. edge cases). Work: Low Solution is clear and broken into good-first-issue-sized chunks. and removed triage needed labels Aug 13, 2024
@Raghav1783
Copy link

Hi, I’m interested in working on this issue. Could you please assign it to me?

@adhiamboperes
Copy link
Collaborator

@Raghav1783, Could you please make sure that you are able to reproduce this issue, and then give a brief description of what's causing it an the suggested fix?

@Raghav1783
Copy link

@adhiamboperes yes i am able to reproduce this error . String resource has multiple %s . To avoid this, we must identify each like this: %1$s

@Raghav1783
Copy link

@adhiamboperes should i create a pr?

@adhiamboperes
Copy link
Collaborator

@Raghav1783, to reproduce means to perform the steps that caused the error to occur. For this specific issue, it would be great to see proof of this issue occuring on either your computer, or our GitHub CI. This way we can evaluate the before and after build isues and verify that your fix worked. If this is possible on your end, please feel free to create a PR.

@jainv4156
Copy link
Contributor

jainv4156 commented Oct 22, 2024

Hi @adhiamboperes,

I would like to work on this issue. This error appears every time I clean and rebuild the project. This issue seems to be related to the custom function getStringInLocale used for retrieving strings

image

@jainv4156
Copy link
Contributor

I am currently researching this further, but I am having trouble locating the implementation of the sealed class OppiaLocale. Any guidance on where I might find it would be greatly appreciated.

@adhiamboperes
Copy link
Collaborator

@jainv4156 please double check the OppiaLocale class.

  1. Read the kdoc at the top of the class
  2. Each abstract class in the file has a corresponding 'Impl' in the same package as OppiaLocale.kt

@jainv4156
Copy link
Contributor

@adhiamboperes,

I’ve identified the main issue and found the solution. It is what @Raghav1783 suggested. Should I go ahead and create a PR now?

@adhiamboperes
Copy link
Collaborator

adhiamboperes commented Oct 24, 2024

@jainv4156, please go ahead and create the PR

subhajitxyz pushed a commit to subhajitxyz/oppia-android that referenced this issue Nov 19, 2024
…format of st… (oppia#5560)

## Explanation
Fixes : oppia#5484 

Some string resources have multiple %s . To fix the error, we must
identify each string position with a number : %1$s

## 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)).

---------

Co-authored-by: Adhiambo Peres <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug End user-perceivable behaviors which are not desirable. good first issue This item is good for new contributors to make their pull request. Impact: Low Low perceived user impact (e.g. edge cases). Work: Low Solution is clear and broken into good-first-issue-sized chunks.
4 participants