WordPress-Android
                                
                                
                                
                                    WordPress-Android copied to clipboard
                            
                            
                            
                        Fix percent sign should be localized
Fixes #16491
To test:
Backup download screen
1 - Set the device language to a language that shows the percent sign to the right (e.g. English). 2 - Open app and login 3 - Launch Activity Log screen, tap on "MENU" tab and then "Activity Log" button 4 - Find a backup item on the list 5 - Tap on the overflow menu and then on "Download Backup" 6 - Tap on the "Create downloadable file" button 7 - Observe the progress bar percentage: the percent sign should be shown to the right side of the number 8 - Set the device language to a language that shows the percent sign to the left (e.g. Turkish) 9 - Repeat steps 3 to 6 10 - Observe the progress bar percentage: the percent sign should be shown to the left side of the number
Restore backup screen
1 - Set the device language to a language that shows the percent sign to the right (e.g. English). 2 - Open app and login 3 - Launch Activity Log screen, tap on "MENU" tab and then "Activity Log" button 4 - Find a backup item on the list 5 - Tap on the overflow menu and then on "Restore to this point" 6 - Tap on the "Create downloadable file" button 7 - Observe the progress bar percentage: the percent sign should be shown to the right side of the number 8 - Set the device language to a language that shows the percent sign to the left (e.g. Turkish) 9 - Repeat steps 2 to 6 10 - Observe the progress bar percentage: the percent sign should be shown to the left side of the number
Scan screen
TODO
Stats screen
1 - Set the device language to a language that shows the percent sign to the right (e.g. English). 2 - Open app and login 3 - Launch Activity Log screen, tap on "MENU" tab and then "Stats" button 4 - Observe the percent signs on line charts and "INSIGHTS", "DAYS", "WEEKS", "MONTHS", "YEARS" tabs: they should be shown to the RIGHT side of the numbers 5 - Set the device language to a language that shows the percent sign to the left (e.g. Turkish) 6 - Repeat steps 2 to 4 7 - Observe the percent signs on line charts and "INSIGHTS", "DAYS", "WEEKS", "MONTHS", "YEARS" tabs: they should be shown to the LEFT side of the numbers
Regression Notes
- 
Potential unintended areas of impact
 - 
What I did to test those areas of impact (or what existing automated tests I relied on) Manual testing and unit tests
 - 
What automated tests I added (or what prevented me from doing so)
 
PR submission checklist:
- [x] I have completed the Regression Notes.
 - [x] I have considered adding accessibility improvements for my changes.
 - [x] I have considered if this change warrants user-facing release notes and have added them to 
RELEASE-NOTES.txtif necessary. 
You can test the WordPress changes on this Pull Request by downloading an installable build (wordpress-installable-build-pr16947-cfe9a4e.apk), or scanning this QR code:
You can test the Jetpack changes on this Pull Request by downloading an installable build (jetpack-installable-build-pr16947-cfe9a4e.apk), or scanning this QR code:
Hey π
I wanted to ask a couple of things regarding this PR:
1 - I have updated main/res/values/strings.xml to remove the extra percent signs, but didn't do the same for all the languages. Because of this, there are some problems to test this PR (e.g. selecting Turkish language and opening the Stats screen makes the app crash, since the string in main/res/values-tr/strings.xml expects a decimal number instead of a string). Any thoughts on what I should do to fix this? Should I go through all the languages strings.xml files to update them?
Also AFAIU one of the reasons CI is failing is because the format strings have different arguments on different languages:
Error: Inconsistent formatting types for argument #1 in format string stats_most_popular_percent_views ('%1$d'): Found both 'd' here and 's' in values/strings.xml [StringFormatMatches]
2 - I wasn't able to find the proper steps to test the Scan screen. Does anyone know how to reach this screen?
1 - I have updated
main/res/values/strings.xmlto remove the extra percent signs, but didn't do the same for all the languages. Because of this, there are some problems to test this PR (e.g. selecting Turkish language and opening the Stats screen makes the app crash, since the string inmain/res/values-tr/strings.xmlexpects a decimal number instead of a string). Any thoughts on what I should do to fix this? Should I go through all the languagesstrings.xmlfiles to update them? Also AFAIU one of the reasons CI is failing is because the format strings have different arguments on different languages:
@RenanLukas  The easiest way to solve this is to indeed go thru all the languages strings.xml files⦠and delete the translations for this key.
During the next code freeze, we will send the new original (without the %) to GlotPress to get that new copy translated, and at that point the polyglots will translate the new copy in each of their respective locale properly themselves, which we'll pull back from GlotPress before we'll do the subsequent betas/releases.
So deleting the current translations is not only the easiest way, it's also probably the right move, to let polyglots do the proper translation instead of you having to guess which one it is (or accidentally mess up translations for RTL languages where editing those when they contain a mix of RTL and LTR runs can sometimes be tricky π )
Thanks for handling this, @RenanLukas!
Any thoughts on what I should do to fix this? Should I go through all the languages strings.xml files to update them?
I had to do the same thing on https://github.com/wordpress-mobile/WordPress-Android/pull/17103. I preferred to remove string resources on all other languages. This caused a problem because I missed some strings. Actually, it was okay on my local project, but someway there were still some not deleted strings after merge.
If you choose my method, I suggest being extra careful not to leave any string which needs to be removed. Alternatively, you can add a new string and remove the old one from the default strings.xml.
| Warnings | |
|---|---|
| :warning: | PR is not assigned to a milestone. | 
| :warning: | PR has more than 300 lines of code changing. Consider splitting into smaller PRs if possible. | 
Generated by :no_entry_sign: dangerJS
Thanks for the suggestions @AliSoftware and @irfano π
I've removed the string resources from all the languages
Hey @irfano, thanks for taking the time to review and for catching that crash.
I couldn't test backup download progress. Can you suggest to me an easy way to see backup item on Activity log screen, @RenanLukas ?
AFAIU if you need the Jetpack plugin installed. With it installed, I have edited a blog post that I had and that triggered a new backup in the list:

Thanks @develric for helping me figure this out π
When I open Stats screen in Turkish language, it crashes with this log:
I couldn't reproduce this crash. I wonder if I'm missing something?
I've built the WP app, selected Turkish language and opened Stats screen. Here's an example of what I'm getting as result of line 76 (val highestDayPercent):
I believe it shows "of views", in English, because I've removed the string stats_most_popular_percent_views from every other string file (including values-tr/strings.xml).