Skip to content

Add plural support for share_license_summary string (#2156) #2161

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

Merged
merged 1 commit into from
Dec 18, 2018

Conversation

zhao-gang
Copy link
Contributor

Description (required)

Fixes #2156

Make string resource share_license_summary support plural by defining it as a quantity string.(reference: https://developer.android.com/guide/topics/resources/string-resource#Plurals)

As a quantity string it could support plural formats for many languages, not limited to English language. Currently it only support plural for English language. More language support can be added by adding to their respective resource files.

Tests performed (required)

Tested on BetaDebug on Nexus 6p with API level 27. English language can correctly display singular or plural strings. Other languages display the original strings.

Screenshots showing what changed (optional - for UI changes)

screenshot_20181218-214758

@neslihanturan
Copy link
Collaborator

Hi @zhao-gang , we do not edit string.xml files under languages manually. They are automatized. You should only edit default strings.xml file, thats all:)

@codecov-io
Copy link

codecov-io commented Dec 18, 2018

Codecov Report

Merging #2161 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2161      +/-   ##
=========================================
- Coverage    5.69%   5.69%   -0.01%     
=========================================
  Files         233     233              
  Lines       11591   11593       +2     
  Branches     1076    1076              
=========================================
  Hits          660     660              
- Misses      10876   10878       +2     
  Partials       55      55
Impacted Files Coverage Δ
...ava/fr/free/nrw/commons/upload/UploadActivity.java 0% <0%> (ø) ⬆️
...va/fr/free/nrw/commons/upload/UploadPresenter.java 9.04% <0%> (ø) ⬆️
...r/free/nrw/commons/upload/DescriptionsAdapter.java 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 525eb9a...435993d. Read the comment docs.

@zhao-gang
Copy link
Contributor Author

Hi @zhao-gang , we do not edit string.xml files under languages manually. They are automatized. You should only edit default strings.xml file, thats all:)

I hope I know this before I started working on this issue :-(

Anyway, here is the updated PR. Could you please tell me how to generate the plural string for other languages?

@neslihanturan
Copy link
Collaborator

We don't need to know this, translators does this job. You should only add this for default file, in english.

@neslihanturan
Copy link
Collaborator

Sorry for editing all string files, it is always better to have communication with team members, someone would warn you. Of course we should include this to our contributor documentation too.

@zhao-gang
Copy link
Contributor Author

We don't need to know this, translators does this job. You should only add this for default file, in english.

If it works this way. Firstly in other language (i.e. Chinese), the upload page will show the default English plural string (Before this change it can show Chinese characters, although it doesn't support plural format). I am not sure if it's acceptable? Secondly, the original normal strings in other languages become obsolete and are not used, we still need to delete them (or let translators change them to plural strings? I am not sure about this).

@zhao-gang
Copy link
Contributor Author

We don't need to know this, translators does this job. You should only add this for default file, in english.

If it works this way. Firstly in other language (i.e. Chinese), the upload page will show the default English plural string (Before this change it can show Chinese characters, although it doesn't support plural format). I am not sure if it's acceptable? Secondly, the original normal strings in other languages become obsolete and are not used, we still need to delete them (or let translators change them to plural strings? I am not sure about this).

I mean I changed R.string.share_license_summary to R.plurals.share_license_summary in english file. And the code now calls R.plurals.share_license_summary. All the other languages have no R.plurals.share_license_summary, so all the other languages will show english language. It seems a big step back for me.

@zhao-gang
Copy link
Contributor Author

We don't need to know this, translators does this job. You should only add this for default file, in english.

If it works this way. Firstly in other language (i.e. Chinese), the upload page will show the default English plural string (Before this change it can show Chinese characters, although it doesn't support plural format). I am not sure if it's acceptable? Secondly, the original normal strings in other languages become obsolete and are not used, we still need to delete them (or let translators change them to plural strings? I am not sure about this).

I mean I changed R.string.share_license_summary to R.plurals.share_license_summary in english file. And the code now calls R.plurals.share_license_summary. All the other languages have no R.plurals.share_license_summary, so all the other languages will show english language. It seems a big step back for me.

If I change R.string.share_license_summary to R.plurals.share_license_summary in all the related languages, at least they can show their original languages (no plural support). I think this might be better than above mentioned solution?

@neslihanturan
Copy link
Collaborator

No, we can not edit anything in those files. We stop ourselves from doing it. Currently whenever translations added, local strings will be available, which is okay.

@domdomegg
Copy link
Member

domdomegg commented Dec 18, 2018

Any idea why Travis failed? Logs suggest Google's servers were unreachable, but it seems unlikely that they went down. Is there a way to retry it?

IOException: https://dl.google.com/android/repository/addons_list-3.xml
java.net.ConnectException: Connection refused (Connection refused)
Failed to fetch URL https://dl.google.com/android/repository/addon.xml, reason: Connect Connection refused (Connection refused)
Failed to fetch URL

Edit - Thanks whoever restarted the Travis build :)

@domdomegg domdomegg self-requested a review December 18, 2018 17:20
@domdomegg
Copy link
Member

Tested 2.9.0-debug-pr-2161~435993d7 on Galaxy Nexus (emulator) at API level 28.

Tested both single and multiple uploads:

Single Multiple
screenshot_1545153949 screenshot_1545153717

@domdomegg domdomegg merged commit db38174 into commons-app:master Dec 18, 2018
@zhao-gang zhao-gang deleted the fix-2156 branch December 19, 2018 01:10
@domdomegg domdomegg removed their request for review March 19, 2019 19:24
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.

4 participants