Dbrant has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/338152 )

Change subject: Factor out common URLs from string resources.
......................................................................

Factor out common URLs from string resources.

This makes URLs for Terms of Use and CC licenses into separate string
resources, so that they can be included in other string resources via
format specifiers. Updated strings-qq accordingly.

Bug: T158218
Change-Id: I1b1c378e5ec3d9bc6a25818fa20fa5da283a7d2f
---
M app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
M app/src/main/java/org/wikipedia/edit/EditSectionActivity.java
M app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
M app/src/main/res/values-qq/strings.xml
M app/src/main/res/values/strings.xml
5 files changed, 27 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/52/338152/1

diff --git 
a/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java 
b/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
index 672761c..173d72e 100644
--- a/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
+++ b/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
@@ -149,7 +149,10 @@
         inflate(getContext(), R.layout.view_description_edit, this);
         ButterKnife.bind(this);
 
-        
licenseText.setText(StringUtil.fromHtml(getContext().getString(R.string.description_edit_license_notice)));
+        licenseText.setText(StringUtil.fromHtml(String
+                
.format(getContext().getString(R.string.description_edit_license_notice),
+                        getContext().getString(R.string.terms_of_use_url),
+                        getContext().getString(R.string.cc_0_url))));
         licenseText.setMovementMethod(new LinkMovementMethod());
         FeedbackUtil.setToolbarButtonLongPressToast(saveButton, cancelButton, 
helpButton);
         setOrientation(VERTICAL);
diff --git a/app/src/main/java/org/wikipedia/edit/EditSectionActivity.java 
b/app/src/main/java/org/wikipedia/edit/EditSectionActivity.java
index 573c719..d1fa245 100644
--- a/app/src/main/java/org/wikipedia/edit/EditSectionActivity.java
+++ b/app/src/main/java/org/wikipedia/edit/EditSectionActivity.java
@@ -253,11 +253,11 @@
 
     private void updateEditLicenseText() {
         TextView editLicenseText = (TextView) 
findViewById(R.id.edit_section_license_text);
-        if (User.isLoggedIn()) {
-            
editLicenseText.setText(StringUtil.fromHtml(getString(R.string.edit_save_action_license_logged_in)));
-        } else {
-            
editLicenseText.setText(StringUtil.fromHtml(getString(R.string.edit_save_action_license_anon)));
-        }
+        
editLicenseText.setText(StringUtil.fromHtml(String.format(getString(User.isLoggedIn()
+                        ? R.string.edit_save_action_license_logged_in
+                        : R.string.edit_save_action_license_anon),
+                getString(R.string.terms_of_use_url),
+                getString(R.string.cc_by_sa_3_url))));
 
         editLicenseText.setMovementMethod(new LinkMovementMethodExt(new 
LinkMovementMethodExt.UrlHandler() {
             @Override
diff --git 
a/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java 
b/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
index 72e07b0..816239e 100644
--- 
a/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
+++ 
b/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
@@ -5,6 +5,7 @@
 import android.support.annotation.NonNull;
 import android.support.design.widget.CoordinatorLayout;
 import android.text.TextUtils;
+import android.text.method.LinkMovementMethod;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
@@ -269,8 +270,10 @@
 
     private void setupAttribution() {
         Page page = parentFragment.getPage();
-        
pageLicenseText.setText(StringUtil.fromHtml(parentFragment.getContext().getString(R.string.content_license_html)));
-        pageLicenseText.setMovementMethod(new 
LinkMovementMethodExt(linkHandler));
+        pageLicenseText.setText(StringUtil.fromHtml(String
+                
.format(parentFragment.getContext().getString(R.string.content_license_html),
+                        
parentFragment.getContext().getString(R.string.cc_by_sa_3_url))));
+        pageLicenseText.setMovementMethod(new LinkMovementMethod());
 
         // Don't display last updated message for main page or file pages, 
because it's always wrong
         if (page.isMainPage() || page.isFilePage()) {
diff --git a/app/src/main/res/values-qq/strings.xml 
b/app/src/main/res/values-qq/strings.xml
index 7f80088..661bf7f 100644
--- a/app/src/main/res/values-qq/strings.xml
+++ b/app/src/main/res/values-qq/strings.xml
@@ -60,9 +60,9 @@
   <string name="last_updated_text">Message in footer of article indicating 
when the article was last updated. \'%s\' is substituted with the appropriately 
formatted human-readable timestamp, such as \"seven days ago\".</string>
   <string name="talk_page_link_text">Link text for accessing Talk pages. Use 
the same word in your language as is done on the web site. Some use the term 
discussions.
 {{Identical|Talk}}</string>
-  <string name="content_license_html">HTML specifying license of the Wiki and 
link to appropriate CC page</string>
-  <string name="edit_save_action_license_logged_in">HTML specifying Terms of 
Use and CC license before saving edits</string>
-  <string name="edit_save_action_license_anon">HTML specifying Terms of Use 
and CC license and a log link before saving edits, only when the user has not 
logged in. Please do not change the href=\'https://#login\' part of the 
message.</string>
+  <string name="content_license_html">HTML specifying license of the Wiki and 
link to appropriate CC page. Please preserve the %1$s parameter, since this 
will be replaced with the actual URL.</string>
+  <string name="edit_save_action_license_logged_in">HTML specifying Terms of 
Use and CC license before saving edits. Please preserve the %1$s and $2$s 
parameters, since these will be replaced with the actual URLs.</string>
+  <string name="edit_save_action_license_anon">HTML specifying Terms of Use 
and CC license and a login link before saving edits, only when the user has not 
logged in. Please preserve the %1$s and $2$s parameters, since these will be 
replaced with the actual URLs. Also please do not change the 
href=\'https://#login\' part of the message.</string>
   <string name="preference_title_language">Title for preference in settings 
screen for setting which language Wikipedia to use.
 
 Shown in the preferences screen along with the following:
@@ -207,6 +207,8 @@
 Please test the URL to make sure it works.</string>
   <string name="terms_of_use_url">URL leading to the Wikimedia Foundation 
terms of use. If you can find the appropriate language specific URL of the 
mobile site please do so. If not feel free to keep the English one. Example for 
German (lang code \"de\"): 
https://m.wikimediafoundation.org/wiki/Terms_of_Use/de
 Please test the URL to make sure it works</string>
+  <string name="cc_by_sa_3_url">URL for details about the Creative Commons CC 
BY-SA 3.0 license. When possible, please use the appropriate language-specific 
URL, and the mobile version of the site.</string>
+  <string name="cc_0_url">URL for details about the Creative Commons CC0 
license. When possible, please use the appropriate language-specific URL, and 
the mobile version of the site.</string>
   <string name="about_libraries_heading">Heading for section that lists the 
libraries that have been used in the app</string>
   <string name="about_contributors_heading">Heading for section that lists the 
people who have contributed to the app.
 {{Identical|Contributor}}</string>
@@ -472,7 +474,7 @@
   <string name="wikidata_about_url">URL that points to an introduction page 
about Wikidata in this language.</string>
   <string name="wikidata_description_guide_url">URL that points to a page on 
Wikidata that contains guidelines for writing descriptions. Preferably the URL 
should link directly to the section that lists specific guidelines.</string>
   <string name="description_edit_anon_limit">Dialog message that informs the 
user that they must log in before making edits to additional 
descriptions.</string>
-  <string name="description_edit_license_notice">Disclaimer that specifies the 
Terms of Use and CC license that applies to editing descriptions. Where 
possible, please make URLs point to the correct language translation of the 
page.</string>
+  <string name="description_edit_license_notice">Disclaimer that specifies the 
Terms of Use and CC license that applies to editing descriptions. Please 
preserve the %1$s and $2$s parameters, since these will be replaced with 
URLs.</string>
   <string name="description_edit_success_saved">Message that the description 
the user just added was saved.</string>
   <string name="description_edit_success_encouragement">Message that the user 
made Wikipedia better for everyone</string>
   <string name="description_edit_success_done">Button text to dismiss the 
description editing success screen
diff --git a/app/src/main/res/values/strings.xml 
b/app/src/main/res/values/strings.xml
index 4178c5c..d566ca8 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -52,9 +52,9 @@
 
     <string name="last_updated_text">Last updated %s</string>
     <string name="talk_page_link_text">Talk</string>
-    <string name="content_license_html"><![CDATA[Content is available under <a 
href=\"//creativecommons.org/licenses/by-sa/3.0/\">CC BY-SA 3.0</a> unless 
otherwise noted]]></string>
-    <string name="edit_save_action_license_logged_in"><![CDATA[By saving, you 
agree to the <a href="https://wikimediafoundation.org/wiki/Terms_of_Use";>Terms 
of Use</a>, and to irrevocably release your contributions under the <a 
href="https://creativecommons.org/licenses/by-sa/3.0/";>CC BY-SA 3.0</a> 
license.]]></string>
-    <string name="edit_save_action_license_anon"><![CDATA[By saving, you agree 
to the <a href="https://wikimediafoundation.org/wiki/Terms_of_Use";>Terms of 
Use</a>, and to irrevocably release your contributions under the <a 
href="https://creativecommons.org/licenses/by-sa/3.0/";>CC BY-SA 3.0</a> 
license. Edits will be attributed to the IP address of your device. If you <a 
href="https://#login";>log in</a>, you will have more privacy.]]></string>
+    <string name="content_license_html"><![CDATA[Content is available under <a 
href=\"%1$s\">CC BY-SA 3.0</a> unless otherwise noted]]></string>
+    <string name="edit_save_action_license_logged_in"><![CDATA[By saving, you 
agree to the <a href="%1$s">Terms of Use</a>, and to irrevocably release your 
contributions under the <a href="%2$s">CC BY-SA 3.0</a> license.]]></string>
+    <string name="edit_save_action_license_anon"><![CDATA[By saving, you agree 
to the <a href="%1$s">Terms of Use</a>, and to irrevocably release your 
contributions under the <a href="%2$s/">CC BY-SA 3.0</a> license. Edits will be 
attributed to the IP address of your device. If you <a 
href="https://#login";>log in</a>, you will have more privacy.]]></string>
     <string name="preference_title_language">Wikipedia language</string>
     <string name="preference_languages_filter_hint">Search</string>
     <string name="langlinks_filter_hint">Search</string>
@@ -145,13 +145,15 @@
     <string name="terms_of_use_description">Terms of use</string>
     <string 
name="privacy_policy_url">https://m.wikimediafoundation.org/wiki/Privacy_policy</string>
     <string 
name="terms_of_use_url">https://m.wikimediafoundation.org/wiki/Terms_of_Use</string>
+    <string 
name="cc_by_sa_3_url">https://creativecommons.org/licenses/by-sa/3.0/</string>
+    <string 
name="cc_0_url">https://creativecommons.org/publicdomain/zero/1.0/</string>
     <string name="about_libraries_heading">Libraries used</string>
     <string name="about_contributors_heading">Contributors</string>
     <string name="about_translators_heading">Translators</string>
     <string name="about_translators_translatewiki"><![CDATA[This app was 
translated by the volunteer translators at <a 
href="https://translatewiki.net";>translatewiki.net</a>.]]></string>
     <string name="about_app_license_heading">License</string>
     <string name="about_app_license"><![CDATA[Source code available on <a 
href=\"https://gerrit.wikimedia.org/r/#/admin/projects/apps/android/wikipedia\";>Gerrit</a>
 and <a href=\"https://github.com/wikimedia/apps-android-wikipedia\";>GitHub</a> 
under the <a 
href=\"https://phabricator.wikimedia.org/diffusion/APAW/browse/master/COPYING?view=raw\";>Apache
 2.0 License</a>. Unless otherwise specified, content is available under a <a 
href=\"https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License\";>Creative
 Commons Attribution-ShareAlike License</a>.]]></string>
-    <string name="about_wmf"><![CDATA[A product of the <a 
href="http://wikimediafoundation.org/wiki/Home";>Wikimedia 
Foundation</a>]]></string>
+    <string name="about_wmf"><![CDATA[A product of the <a 
href="http://m.wikimediafoundation.org/wiki/Home";>Wikimedia 
Foundation</a>]]></string>
     <string name="about_activity_title">About</string>
     <string name="edit_abandon_confirm">The page has been modified. Are you 
sure you want to exit without saving your changes?</string>
     <string name="user_blocked_from_editing_title">Blocked</string>
@@ -359,7 +361,7 @@
     <string 
name="wikidata_about_url">https://www.wikidata.org/wiki/Wikidata:Introduction</string>
     <string 
name="wikidata_description_guide_url">https://www.wikidata.org/wiki/Help:Description#Guidelines_for_descriptions_in_English</string>
     <string name="description_edit_anon_limit">Thanks for your continued 
interest in editing descriptions! To make additional edits, please log in to 
your Wikipedia account.</string>
-    <string name="description_edit_license_notice"><![CDATA[By changing the 
title description, I agree to the <a 
href="https://wikimediafoundation.org/wiki/Terms_of_Use";>Terms of Use</a> and 
to irrevocably release my contributions under the <a 
href="https://creativecommons.org/publicdomain/zero/1.0/";>Creative Commons 
CC0</a> license.]]></string>
+    <string name="description_edit_license_notice"><![CDATA[By changing the 
title description, I agree to the <a href="%1$s">Terms of Use</a> and to 
irrevocably release my contributions under the <a href="%2$s">Creative Commons 
CC0</a> license.]]></string>
     <!-- /Description editing -->
 
     <!-- Description editing success -->

-- 
To view, visit https://gerrit.wikimedia.org/r/338152
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b1c378e5ec3d9bc6a25818fa20fa5da283a7d2f
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to