diff options
| author | srowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57> | 2011-09-12 21:30:21 +0400 |
|---|---|---|
| committer | srowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57> | 2011-09-12 21:30:21 +0400 |
| commit | 2d59877b50be6bcdfb35e72504de0b1db0b6032f (patch) | |
| tree | 54db7c19a9a9aaa5b54fd6fa7b2a8f5303c1fcdd | |
| parent | 47aa9c410c10f2f08cfcd8b11e2754672e24c233 (diff) | |
| download | zxing-android-embedded-2d59877b50be6bcdfb35e72504de0b1db0b6032f.tar.xz | |
Fix Issue 978, bad Brazil/Bulgaria mapping. Also add a new framework for auto-translating HTML assets.
git-svn-id: http://zxing.googlecode.com/svn/trunk/android@1905 59b500cc-1b3d-0410-9834-0bbf25fbcc57
| -rw-r--r-- | assets/html-en/about1d.html (renamed from assets/html/about1d.html) | 6 | ||||
| -rw-r--r-- | assets/html-en/about2d.html (renamed from assets/html/about2d.html) | 2 | ||||
| -rw-r--r-- | assets/html-en/index.html (renamed from assets/html/index.html) | 2 | ||||
| -rw-r--r-- | assets/html-en/scanning.html (renamed from assets/html/scanning.html) | 2 | ||||
| -rw-r--r-- | assets/html-en/sharing.html (renamed from assets/html/sharing.html) | 4 | ||||
| -rw-r--r-- | assets/html-en/whatsnew.html (renamed from assets/html/whatsnew.html) | 2 | ||||
| -rw-r--r-- | assets/style.css (renamed from assets/html/style.css) | 0 | ||||
| -rw-r--r-- | src/com/google/zxing/client/android/HelpActivity.java | 3 | ||||
| -rw-r--r-- | src/com/google/zxing/client/android/LocaleManager.java | 18 |
9 files changed, 28 insertions, 11 deletions
diff --git a/assets/html/about1d.html b/assets/html-en/about1d.html index a733fca4..349f4039 100644 --- a/assets/html/about1d.html +++ b/assets/html-en/about1d.html @@ -1,17 +1,17 @@ <html> <head> <title>About 1D barcodes</title> -<link rel="stylesheet" href="style.css" type="text/css"/> +<link rel="stylesheet" href="../style.css" type="text/css"/> </head> <body> <p>Traditional barcodes, such as those printed on product packaging, are also known as <em>one dimensional barcodes</em>. There are several types commonly used, including UPC and EAN. Most look similar to this:</p> -<p style="text-align:center"><img src="../images/big-1d.png"></p> +<p style="text-align:center"><img src="../images/big-1d.png" alt="1D"></p> <p>These 1D barcodes contain a unique code which typically describes a product, like a CD or a book. You can look this code up on the internet to find prices, reviews, and more.</p> <p>If you scan a book, you can also search the contents of the book for a word or phrase, and find all the pages where it appears:</p> -<center><p><img src="../images/search-book-contents.jpg"></p></center> +<p style="text-align:center"><img src="../images/search-book-contents.jpg" alt="Search book contents"></p> </body> </html>
\ No newline at end of file diff --git a/assets/html/about2d.html b/assets/html-en/about2d.html index 979cb8a2..645aee0c 100644 --- a/assets/html/about2d.html +++ b/assets/html-en/about2d.html @@ -1,7 +1,7 @@ <html> <head> <title>About 2D barcodes</title> -<link rel="stylesheet" href="style.css" type="text/css"/> +<link rel="stylesheet" href="../style.css" type="text/css"/> </head> <body> <p><b>Barcode Scanner</b> also understands how to read two dimensional barcodes, like <em>QR diff --git a/assets/html/index.html b/assets/html-en/index.html index 903aa63b..0e87d3a9 100644 --- a/assets/html/index.html +++ b/assets/html-en/index.html @@ -1,7 +1,7 @@ <html> <head> <title>Barcode Scanner Help</title> -<link rel="stylesheet" href="style.css" type="text/css"/> +<link rel="stylesheet" href="../style.css" type="text/css"/> </head> <body> <p><b>Barcode Scanner</b> uses the camera on your phone to read barcodes and look up product diff --git a/assets/html/scanning.html b/assets/html-en/scanning.html index 76d254a1..2d7fd2bd 100644 --- a/assets/html/scanning.html +++ b/assets/html-en/scanning.html @@ -1,7 +1,7 @@ <html> <head> <title>How to scan</title> -<link rel="stylesheet" href="style.css" type="text/css"/> +<link rel="stylesheet" href="../style.css" type="text/css"/> </head> <body> <p>Barcode Scanner continuously scans a square region shown on your screen — just line up the diff --git a/assets/html/sharing.html b/assets/html-en/sharing.html index fcbb6ba1..11c16635 100644 --- a/assets/html/sharing.html +++ b/assets/html-en/sharing.html @@ -1,13 +1,13 @@ <html> <head> <title>How to create QR Codes</title> -<link rel="stylesheet" href="style.css" type="text/css"/> +<link rel="stylesheet" href="../style.css" type="text/css"/> </head> <body> <p>In addition to <a href="about2d.html">scanning 2D barcodes</a>, <b>Barcode Scanner</b> can also generate a QR Code and display it on your screen. Then you can show it to a friend, and let them scan the barcode with their phone:</p> -<center><p><img src="../images/scan-from-phone.png" alt="Scan from phone"></p></center> +<p style="text-align:center"><img src="../images/scan-from-phone.png" alt="Scan from phone"></p> <p>To use this feature, press the Menu button from the main scanning screen, and tap Share. Then choose whether you want to share a contact, a bookmark, an application, or the contents of the clipboard. A QR Code will be generated automatically. When you're done, press Back or Home.</p> diff --git a/assets/html/whatsnew.html b/assets/html-en/whatsnew.html index c5c4264c..7e057918 100644 --- a/assets/html/whatsnew.html +++ b/assets/html-en/whatsnew.html @@ -1,7 +1,7 @@ <html> <head> <title>What's new in Barcode Scanner</title> -<link rel="stylesheet" href="style.css" type="text/css"/> +<link rel="stylesheet" href="../style.css" type="text/css"/> </head> <body> <p><b>New in version 3.61:</b></p> diff --git a/assets/html/style.css b/assets/style.css index 3143e4d8..3143e4d8 100644 --- a/assets/html/style.css +++ b/assets/style.css diff --git a/src/com/google/zxing/client/android/HelpActivity.java b/src/com/google/zxing/client/android/HelpActivity.java index 34d80ce3..0a5e691e 100644 --- a/src/com/google/zxing/client/android/HelpActivity.java +++ b/src/com/google/zxing/client/android/HelpActivity.java @@ -55,7 +55,8 @@ public final class HelpActivity extends Activity { public static final String DEFAULT_PAGE = "index.html"; public static final String WHATS_NEW_PAGE = "whatsnew.html"; - private static final String BASE_URL = "file:///android_asset/html/"; + private static final String BASE_URL = + "file:///android_asset/html-" + LocaleManager.getTranslatedAssetLanguage() + '/'; private static final String WEBVIEW_STATE_PRESENT = "webview_state_present"; private static boolean initialized = false; diff --git a/src/com/google/zxing/client/android/LocaleManager.java b/src/com/google/zxing/client/android/LocaleManager.java index 4784a8b0..b829ea10 100644 --- a/src/com/google/zxing/client/android/LocaleManager.java +++ b/src/com/google/zxing/client/android/LocaleManager.java @@ -16,6 +16,8 @@ package com.google.zxing.client.android; +import java.util.Collection; +import java.util.HashSet; import java.util.Locale; import java.util.Map; import java.util.HashMap; @@ -29,11 +31,14 @@ public final class LocaleManager { private static final String DEFAULT_TLD = "com"; private static final String DEFAULT_COUNTRY = "US"; + private static final String DEFAULT_LANGUAGE = "en"; private static final String COUNTRY; + private static final String LANGUAGE; static { Locale locale = Locale.getDefault(); COUNTRY = locale == null ? DEFAULT_COUNTRY : locale.getCountry(); + LANGUAGE = locale == null ? DEFAULT_LANGUAGE : locale.getLanguage(); } /** @@ -45,7 +50,8 @@ public final class LocaleManager { GOOGLE_COUNTRY_TLD = new HashMap<String,String>(); GOOGLE_COUNTRY_TLD.put("AR", "com.ar"); // ARGENTINA GOOGLE_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA - GOOGLE_COUNTRY_TLD.put("BG", "com.br"); // BULGARIA + GOOGLE_COUNTRY_TLD.put("BR", "com.br"); // BRAZIL + GOOGLE_COUNTRY_TLD.put("BG", "bg"); // BULGARIA GOOGLE_COUNTRY_TLD.put(Locale.CANADA.getCountry(), "ca"); GOOGLE_COUNTRY_TLD.put(Locale.CHINA.getCountry(), "cn"); GOOGLE_COUNTRY_TLD.put("CZ", "cz"); // CZECH REPUBLIC @@ -98,6 +104,12 @@ public final class LocaleManager { */ private static final Map<String,String> GOOGLE_BOOK_SEARCH_COUNTRY_TLD = GOOGLE_COUNTRY_TLD; + private static final Collection<String> TRANSLATED_HELP_ASSET_LANGUAGES; + static { + TRANSLATED_HELP_ASSET_LANGUAGES = new HashSet<String>(); + TRANSLATED_HELP_ASSET_LANGUAGES.add("en"); + } + private LocaleManager() {} /** @@ -134,6 +146,10 @@ public final class LocaleManager { return url.startsWith("http://google.com/books") || url.startsWith("http://books.google."); } + public static String getTranslatedAssetLanguage() { + return TRANSLATED_HELP_ASSET_LANGUAGES.contains(LANGUAGE) ? LANGUAGE : DEFAULT_LANGUAGE; + } + private static String doGetTLD(Map<String,String> map) { String tld = map.get(COUNTRY); return tld == null ? DEFAULT_TLD : tld; |
