capitalize language names in stand-alone context, which I think French

wants. I hope other languages do too.
This commit is contained in:
Eric House 2015-05-22 22:18:34 -07:00
parent 3dc555d719
commit 52269e6675
5 changed files with 17 additions and 4 deletions

View file

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

View file

@ -243,7 +243,7 @@ public class GameListItem extends LinearLayout
value =
DictLangCache.getLangName( m_context,
m_summary.dictLang );
value = LocUtils.xlateLang( m_context, value );
value = LocUtils.xlateLang( m_context, value, true );
break;
case R.string.game_summary_field_opponents:
value = m_summary.playerNames();

View file

@ -38,7 +38,7 @@ public class LangListPreference extends XWListPreference {
@Override
public void setSummary( CharSequence summary )
{
super.setSummary( LocUtils.xlateLang( m_context, summary.toString() ) );
super.setSummary( LocUtils.xlateLang( m_context, summary.toString(), true ) );
}
}

View file

@ -255,7 +255,7 @@ public class PrefsDelegate extends DelegateBase
String lang = langs[ii];
haveDictForLang = haveDictForLang
|| lang.equals( curLang );
langsLoc[ii] = xlateLang( lang );
langsLoc[ii] = xlateLang( lang, true );
}
if ( !haveDictForLang ) {
@ -265,7 +265,7 @@ public class PrefsDelegate extends DelegateBase
forceDictsMatch( curLang );
lp.setEntries( langsLoc );
lp.setDefaultValue( xlateLang( curLang ) );
lp.setDefaultValue( xlateLang( curLang, true ) );
lp.setEntryValues( langs );
}

View file

@ -114,6 +114,11 @@ public class LocUtils {
}
public static String xlateLang( Context context, String lang )
{
return xlateLang( context, lang, false );
}
public static String xlateLang( Context context, String lang, boolean caps )
{
if ( null == s_langMap ) {
s_langMap = new HashMap<String, String>();
@ -140,6 +145,9 @@ public class LocUtils {
if ( null == xlated ) {
xlated = lang;
}
if ( caps ) {
xlated = Utils.capitalize( xlated );
}
return xlated;
}