Skip to content

Commit d9adba7

Browse files
committed
Merge pull request commons-app#32 from brion/linkfix
Fix localizable formatted strings in About screen, part 1.
2 parents 0b00a9f + e24ce77 commit d9adba7

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

commons/res/values/strings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@
7575
<string name="preference_tracking_summary">Send usage reports to Wikimedia to help us improve the app</string>
7676
<string name="title_activity_settings">Settings</string>
7777
<string name="menu_about">About</string>
78-
<string name="about_license">Open Source software released under the <a href="https://github.com/wikimedia/android-commons/blob/master/COPYING">Apache License v2</a></string>
79-
<string name="about_improve">Source on <a href="https://github.com/wikimedia/android-commons">GitHub</a>. Bugs at <a href="https://bugzilla.wikimedia.org/enter_bug.cgi?product=Commons%20App">Bugzilla</a>.</string>
80-
<string name="about_privacy_policy"><a href="https://wikimediafoundation.org/wiki/Privacy_policy">Privacy policy</a></string>
78+
<string name="about_license">Open Source software released under the &lt;a href="https://github.com/wikimedia/android-commons/blob/master/COPYING">Apache License v2&lt;/a></string>
79+
<string name="about_improve">Source on &lt;a href="https://github.com/wikimedia/android-commons">GitHub&lt;/a>. Bugs at &lt;a href="https://bugzilla.wikimedia.org/enter_bug.cgi?product=Commons%20App">Bugzilla&lt;/a>.</string>
80+
<string name="about_privacy_policy">&lt;a href="https://wikimediafoundation.org/wiki/Privacy_policy">Privacy policy&lt;/a></string>
8181
<string name="title_activity_about">About</string>
8282
<string name="menu_feedback">Send Feedback (via Email)</string>
8383
<string name="provider_categories">Recently used categories</string>

commons/src/main/java/org/wikimedia/commons/AboutActivity.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.app.Activity;
44
import android.os.Bundle;
5+
import android.text.Html;
56
import android.text.method.LinkMovementMethod;
67
import android.widget.TextView;
78

@@ -23,8 +24,19 @@ public void onCreate(Bundle savedInstanceState) {
2324

2425
versionText.setText(CommonsApplication.APPLICATION_VERSION);
2526

27+
// We can't use formatted strings directly because it breaks with
28+
// our localization tools. Grab an HTML string and turn it into
29+
// a formatted string.
30+
fixFormatting(licenseText, R.string.about_license);
31+
fixFormatting(improveText, R.string.about_improve);
32+
fixFormatting(privacyPolicyText, R.string.about_privacy_policy);
33+
2634
licenseText.setMovementMethod(LinkMovementMethod.getInstance());
2735
improveText.setMovementMethod(LinkMovementMethod.getInstance());
2836
privacyPolicyText.setMovementMethod(LinkMovementMethod.getInstance());
2937
}
38+
39+
private void fixFormatting(TextView textView, int resource) {
40+
textView.setText(Html.fromHtml(getResources().getString(resource)));
41+
}
3042
}

0 commit comments

Comments
 (0)