add isoCode to DictInfo, and load it

This commit is contained in:
Eric House 2022-06-04 14:02:28 -07:00
parent 0e665a990e
commit 4190926c0a
6 changed files with 12 additions and 0 deletions

View file

@ -528,6 +528,7 @@ public class DictLangCache {
Assert.assertTrueNR( null != info.fullSum );
DBUtils.dictsSetInfo( context, dal, info );
Log.d( TAG, "getInfo() => %s", info );
} else {
Log.i( TAG, "getInfo(): unable to open dict %s", dal.name );
}

View file

@ -30,6 +30,7 @@ public class DictInfo {
// set in jni code
public int langCode;
public int wordCount;
public String isoCode;
public String md5Sum; // internal (skipping header?)
@Override
@ -38,6 +39,7 @@ public class DictInfo {
if ( BuildConfig.NON_RELEASE ) {
return new StringBuilder("{")
.append("name: ").append(name)
.append(", isoCode: ").append(isoCode)
.append(", md5Sum: ").append(md5Sum)
.append(", fullSum: ").append(fullSum)
.append("}").toString();

View file

@ -1141,6 +1141,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1getInfo
setInt( env, jinfo, "langCode", code );
setInt( env, jinfo, "wordCount", dict_getWordCount( dict, env ) );
setString( env, jinfo, "md5Sum", dict_getMd5Sum( dict ) );
setString( env, jinfo, "isoCode", dict_getISOCode( dict ) );
}
return jinfo;

View file

@ -1002,6 +1002,12 @@ dict_getDesc( const DictionaryCtxt* dict )
return dict->desc;
}
const XP_UCHAR*
dict_getISOCode( const DictionaryCtxt* dict )
{
return dict->isoCode;
}
const XP_UCHAR*
dict_getMd5Sum( const DictionaryCtxt* dict )
{

View file

@ -209,6 +209,7 @@ XP_LangCode dict_getLangCode( const DictionaryCtxt* dict );
XP_U32 dict_getWordCount( const DictionaryCtxt* dict, XWEnv xwe );
const XP_UCHAR* dict_getDesc( const DictionaryCtxt* dict );
const XP_UCHAR* dict_getISOCode( const DictionaryCtxt* dict );
const XP_UCHAR* dict_getMd5Sum( const DictionaryCtxt* dict );
XP_Bool dict_hasDuplicates( const DictionaryCtxt* dict );

View file

@ -441,6 +441,7 @@ lcToLocale( XP_LangCode lc )
case 0x12: result = "el"; break;
case 0x13: result = "sk"; break;
case 0x14: result = "hu"; break;
case 0x15: result = "ro"; break;
case 0x19: result = "fi"; break;
}
XP_ASSERT( !!result );