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

Mark a string as not for formatting #5776

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sivaraam
Copy link
Member

Description (required)

Fixes #5774

The wikipedia instruction step 6 has a link in it. When translated, the translators replace the english version of the link with the local version. The links sometimes includes percent encoded characters which is being interpreted as a format string.

To avoid the same, mark it as not formatted.

Tests performed (required)

I'm not sure what the reliable way to trigger the wikipedia step and hence could not yet verify the changes visually. But I suppose the warnings are now gone while building, though.

Let me know if there's a way to test the same visually.

Screenshots (for UI changes only)

N/A. See reason above

The wikipedia instruction step 6 has a link in it. When
translated, the translators replace the english version
of the link with the local version. The links sometimes
includes percent encoded characters which is being
interpreted as a format string.

To avoid the same, mark it as not formatted.
Copy link
Member

@misaochan misaochan left a comment

Choose a reason for hiding this comment

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

LGTM, ideally we should get translatewiki to comment on this though.

@sivaraam
Copy link
Member Author

@Nikerabbit Could you kindly take a look at the changes and let us know if this is a fine way to mark a string as non-formatted? Are these properties carried forward to the strings in other languages? 🤔

@Abijeet
Copy link

Abijeet commented Jul 26, 2024

@Nikerabbit Could you kindly take a look at the changes and let us know if this is a fine way to mark a string as non-formatted? Are these properties carried forward to the strings in other languages? 🤔

Hi, I am a project liaison on translatewiki.net.

Unfortunately, we do not support attributes/property retention. It something that we want to do (https://phabricator.wikimedia.org/T244494), but don't support currently.

The property will remain in the source language if present, but will be remove from strings in other language.

@sivaraam
Copy link
Member Author

sivaraam commented Aug 4, 2024

Thank you. Is there a specific way in which we could handle this situation where the translation string might contain some characters which Android misinterprets as a format string placeholder? Does translatewiki help us with this? 🤔

@Abijeet
Copy link

Abijeet commented Aug 6, 2024

Thank you. Is there a specific way in which we could handle this situation where the translation string might contain some characters which Android misinterprets as a format string placeholder? Does translatewiki help us with this? 🤔

Would it be possible to add a post merge script on your end that adds the formatted tag to strings?

Also thinking of some of the other Android projects supported on the platform and wondering how they handle this case. For example, I see % in some of the strings present in Wikipedia Android app: https://github.com/wikimedia/apps-android-wikipedia/blob/main/app/src/main/res/values-zh-rTW/strings.xml#L273C138-L273C140

The other option is to develop a temporary solution on our end to define un-formatted strings in configuration and add the formatted=false attribute before exporting or look at solving: https://phabricator.wikimedia.org/T244494.

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.

"Multiple substitutions specified in non-positional format of string resource" warnings
3 participants