Skip to content
Snippets Groups Projects
Commit 95711bfc authored by Mohammadinamul Sheik's avatar Mohammadinamul Sheik
Browse files

Add Decoder specific dictionary suffix to resource lookup

Change-Id: Ia2c74acdc8ac6f7b605bb06a1078d23b32f388a1
parent cf84f8ce
No related branches found
No related tags found
No related merge requests found
...@@ -27,4 +27,7 @@ public class DecoderSpecificConstants { ...@@ -27,4 +27,7 @@ public class DecoderSpecificConstants {
// (MAX_PREV_WORD_COUNT_FOR_N_GRAM + 1)-gram is supported in Java side. Needs to modify // (MAX_PREV_WORD_COUNT_FOR_N_GRAM + 1)-gram is supported in Java side. Needs to modify
// MAX_PREV_WORD_COUNT_FOR_N_GRAM in native/jni/src/defines.h for suggestions. // MAX_PREV_WORD_COUNT_FOR_N_GRAM in native/jni/src/defines.h for suggestions.
public static final int MAX_PREV_WORD_COUNT_FOR_N_GRAM = 3; public static final int MAX_PREV_WORD_COUNT_FOR_N_GRAM = 3;
public static final String DECODER_DICT_SUFFIX = "";
} }
...@@ -51,6 +51,7 @@ public class DictionaryInfoUtils { ...@@ -51,6 +51,7 @@ public class DictionaryInfoUtils {
private static final String RESOURCE_PACKAGE_NAME = R.class.getPackage().getName(); private static final String RESOURCE_PACKAGE_NAME = R.class.getPackage().getName();
private static final String DEFAULT_MAIN_DICT = "main"; private static final String DEFAULT_MAIN_DICT = "main";
private static final String MAIN_DICT_PREFIX = "main_"; private static final String MAIN_DICT_PREFIX = "main_";
private static final String DECODER_DICT_SUFFIX = DecoderSpecificConstants.DECODER_DICT_SUFFIX;
// 6 digits - unicode is limited to 21 bits // 6 digits - unicode is limited to 21 bits
private static final int MAX_HEX_DIGITS_FOR_CODEPOINT = 6; private static final int MAX_HEX_DIGITS_FOR_CODEPOINT = 6;
...@@ -267,8 +268,8 @@ public class DictionaryInfoUtils { ...@@ -267,8 +268,8 @@ public class DictionaryInfoUtils {
int resId; int resId;
// Try to find main_language_country dictionary. // Try to find main_language_country dictionary.
if (!locale.getCountry().isEmpty()) { if (!locale.getCountry().isEmpty()) {
final String dictLanguageCountry = final String dictLanguageCountry = MAIN_DICT_PREFIX
MAIN_DICT_PREFIX + locale.toString().toLowerCase(Locale.ROOT); + locale.toString().toLowerCase(Locale.ROOT) + DECODER_DICT_SUFFIX;
if ((resId = res.getIdentifier( if ((resId = res.getIdentifier(
dictLanguageCountry, "raw", RESOURCE_PACKAGE_NAME)) != 0) { dictLanguageCountry, "raw", RESOURCE_PACKAGE_NAME)) != 0) {
return resId; return resId;
...@@ -276,7 +277,7 @@ public class DictionaryInfoUtils { ...@@ -276,7 +277,7 @@ public class DictionaryInfoUtils {
} }
// Try to find main_language dictionary. // Try to find main_language dictionary.
final String dictLanguage = MAIN_DICT_PREFIX + locale.getLanguage(); final String dictLanguage = MAIN_DICT_PREFIX + locale.getLanguage() + DECODER_DICT_SUFFIX;
if ((resId = res.getIdentifier(dictLanguage, "raw", RESOURCE_PACKAGE_NAME)) != 0) { if ((resId = res.getIdentifier(dictLanguage, "raw", RESOURCE_PACKAGE_NAME)) != 0) {
return resId; return resId;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment