From 52269e6675d41bfbfd50cfa030b88e13777f357f Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 22 May 2015 22:18:34 -0700 Subject: [PATCH] capitalize language names in stand-alone context, which I think French wants. I hope other languages do too. --- .../XWords4/src/org/eehouse/android/xw4/DelegateBase.java | 5 +++++ .../XWords4/src/org/eehouse/android/xw4/GameListItem.java | 2 +- .../src/org/eehouse/android/xw4/LangListPreference.java | 2 +- .../src/org/eehouse/android/xw4/PrefsDelegate.java | 4 ++-- .../XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java | 8 ++++++++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java index abc08c27e..5a5360cc8 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java @@ -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 ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java index 2d3c9d6b3..e631d4cf8 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java @@ -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(); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/LangListPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/LangListPreference.java index 92a9b6f86..dd1100c05 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/LangListPreference.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/LangListPreference.java @@ -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 ) ); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java index e65a8cab6..cdb54e983 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java @@ -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 ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java index 23a989208..f0adb09ef 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java @@ -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(); @@ -140,6 +145,9 @@ public class LocUtils { if ( null == xlated ) { xlated = lang; } + if ( caps ) { + xlated = Utils.capitalize( xlated ); + } return xlated; }