diff options
author | 2015-03-26 03:44:23 +0000 | |
---|---|---|
committer | 2015-03-26 03:44:23 +0000 | |
commit | f24e19741f6a5ae177be9be3a7cd67f1e7804073 (patch) | |
tree | 42bd075b0727112200824c89a9c076bc931ef35b /java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java | |
parent | af295fcd7f9774a37d4d93cf94dbc8c5af0bf6e1 (diff) | |
parent | 8f526c9a55e0b30f81dcca07dc4f5f4fd341bdb1 (diff) | |
download | latinime-f24e19741f6a5ae177be9be3a7cd67f1e7804073.tar.gz latinime-f24e19741f6a5ae177be9be3a7cd67f1e7804073.tar.xz latinime-f24e19741f6a5ae177be9be3a7cd67f1e7804073.zip |
am 8f526c9a: Use the complete Locale in generating the dictionary id.
* commit '8f526c9a55e0b30f81dcca07dc4f5f4fd341bdb1':
Use the complete Locale in generating the dictionary id.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java b/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java index d8e332370..25fa723cc 100644 --- a/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java @@ -313,35 +313,12 @@ public class DictionaryInfoUtils { * unique ID to them. This ID is just the name of the language (locale-wise) they * are for, and this method returns this ID. */ - public static String getMainDictId(final Locale locale) { + public static String getMainDictId(@Nonnull final Locale locale) { // This works because we don't include by default different dictionaries for // different countries. This actually needs to return the id that we would // like to use for word lists included in resources, and the following is okay. return BinaryDictionaryGetter.MAIN_DICTIONARY_CATEGORY + - BinaryDictionaryGetter.ID_CATEGORY_SEPARATOR + locale.getLanguage().toString(); - } - - /** - * Returns whether a main dictionary is readily available for this locale. - * - * This does not query the content provider. - * - * @param context context to open files upon - * @param locale dictionary locale - * @return true if a dictionary is available right away, false otherwise - */ - public static boolean hasReadilyAvailableMainDictionaryForLocale(final Context context, - final Locale locale) { - final Resources res = context.getResources(); - if (0 != getMainDictionaryResourceIdIfAvailableForLocale(res, locale)) { - return true; - } - final String fileName = getCacheFileName(getMainDictId(locale), locale.toString(), context); - return new File(fileName).exists(); - } - - public static DictionaryHeader getDictionaryFileHeaderOrNull(final File file) { - return getDictionaryFileHeaderOrNull(file, 0, file.length()); + BinaryDictionaryGetter.ID_CATEGORY_SEPARATOR + locale.toString().toLowerCase(); } public static DictionaryHeader getDictionaryFileHeaderOrNull(final File file, |