add xlateLang() to delegate base class

This commit is contained in:
Eric House 2015-04-02 06:22:34 -07:00
parent 6d39a0fdca
commit 27dde57660
4 changed files with 10 additions and 5 deletions

View file

@ -209,6 +209,11 @@ public class DelegateBase implements DlgClickNotify,
return LocUtils.getString( m_activity, resID, params ); return LocUtils.getString( m_activity, resID, params );
} }
protected String xlateLang( String langCode )
{
return LocUtils.xlateLang( m_activity, langCode );
}
protected String getQuantityString( int resID, int quantity, protected String getQuantityString( int resID, int quantity,
Object... params ) Object... params )
{ {

View file

@ -187,8 +187,9 @@ public class DictsDelegate extends ListDelegateBase
int langCode = DictLangCache.getLangLangCode( m_context, int langCode = DictLangCache.getLangLangCode( m_context,
langName ); langName );
boolean expanded = ! m_closedLangs.contains( langName ); boolean expanded = ! m_closedLangs.contains( langName );
String locLangName = LocUtils.xlateLang( m_context, langName ); String locLangName = xlateLang( langName );
String name = getQuantityString( R.plurals.lang_name_fmt, info.m_numDicts, String name = getQuantityString( R.plurals.lang_name_fmt,
info.m_numDicts,
locLangName, info.m_numDicts ); locLangName, info.m_numDicts );
result = ListGroup.make( m_context, convertView, result = ListGroup.make( m_context, convertView,
DictsDelegate.this, groupPos, name, DictsDelegate.this, groupPos, name,

View file

@ -1920,8 +1920,7 @@ public class GamesListDelegate extends ListDelegateBase
public void gotDictInfo( boolean success, String lang, public void gotDictInfo( boolean success, String lang,
String name ) { String name ) {
if ( success ) { if ( success ) {
String locLang = String locLang = xlateLang( lang );
LocUtils.xlateLang( m_activity, lang );
String msg = String msg =
getString( R.string.confirm_get_locdict_fmt, getString( R.string.confirm_get_locdict_fmt,
locLang ); locLang );

View file

@ -251,7 +251,7 @@ public class PrefsDelegate extends DelegateBase
String[] langs = DictLangCache.listLangs( m_activity ); String[] langs = DictLangCache.listLangs( m_activity );
String[] langsLoc = new String[langs.length]; String[] langsLoc = new String[langs.length];
for ( int ii = 0; ii < langs.length; ++ii ) { for ( int ii = 0; ii < langs.length; ++ii ) {
langsLoc[ii] = LocUtils.xlateLang( m_activity, langs[ii] ); langsLoc[ii] = xlateLang( langs[ii] );
} }
lp.setEntries( langsLoc ); lp.setEntries( langsLoc );
lp.setDefaultValue( langsLoc[0] ); lp.setDefaultValue( langsLoc[0] );