mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Japanese language strings better as "values-ja", and other small translator tweaks
git-svn-id: https://zxing.googlecode.com/svn/trunk@1914 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
3a08978654
commit
a0f08df51e
|
@ -16,8 +16,8 @@
|
|||
|
||||
package com.google.zxing.client.android;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
@ -38,7 +38,12 @@ public final class LocaleManager {
|
|||
static {
|
||||
Locale locale = Locale.getDefault();
|
||||
COUNTRY = locale == null ? DEFAULT_COUNTRY : locale.getCountry();
|
||||
LANGUAGE = locale == null ? DEFAULT_LANGUAGE : locale.getLanguage();
|
||||
String language = locale == null ? DEFAULT_LANGUAGE : locale.getLanguage();
|
||||
// Special case Chinese
|
||||
if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(language)) {
|
||||
language += "-r" + COUNTRY;
|
||||
}
|
||||
LANGUAGE = language;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,11 +109,8 @@ 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 static final Collection<String> TRANSLATED_HELP_ASSET_LANGUAGES =
|
||||
Arrays.asList("en");
|
||||
|
||||
private LocaleManager() {}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ import java.util.regex.Pattern;
|
|||
*/
|
||||
public final class StringsResourceTranslator {
|
||||
|
||||
private static final long MIN_API_CALL_INTERVAL_MS = 5 * 1000L;
|
||||
private static final long MIN_API_CALL_INTERVAL_MS = 10 * 1000L;
|
||||
|
||||
private static final Charset UTF8 = Charset.forName("UTF-8");
|
||||
private static final Pattern ENTRY_PATTERN = Pattern.compile("<string name=\"([^\"]+)\".*>([^<]+)</string>");
|
||||
|
@ -76,9 +76,8 @@ public final class StringsResourceTranslator {
|
|||
" limitations under the License.\n" +
|
||||
" -->\n";
|
||||
|
||||
private static final Map<String,String> LANGUAGE_CODE_MASSAGINGS = new HashMap<String,String>(7);
|
||||
private static final Map<String,String> LANGUAGE_CODE_MASSAGINGS = new HashMap<String,String>(3);
|
||||
static {
|
||||
LANGUAGE_CODE_MASSAGINGS.put("ja-rJP", "ja");
|
||||
LANGUAGE_CODE_MASSAGINGS.put("zh-rCN", "zh-cn");
|
||||
LANGUAGE_CODE_MASSAGINGS.put("zh-rTW", "zh-tw");
|
||||
}
|
||||
|
@ -216,6 +215,7 @@ public final class StringsResourceTranslator {
|
|||
// This is a little crude; unescape some common escapes in the raw response
|
||||
translation = translation.replaceAll("\\\\u0026quot;", "\"");
|
||||
translation = translation.replaceAll("\\\\u0026#39;", "'");
|
||||
translation = translation.replaceAll("\\\\u200b", "");
|
||||
|
||||
return translation;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue