mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
translations come in with ids rather than English strings as keys
This commit is contained in:
parent
8612a5f624
commit
28c0862604
1 changed files with 17 additions and 13 deletions
|
@ -55,8 +55,6 @@ import org.eehouse.android.xw4.Utils;
|
||||||
import org.eehouse.android.xw4.XWPrefs;
|
import org.eehouse.android.xw4.XWPrefs;
|
||||||
|
|
||||||
public class LocUtils {
|
public class LocUtils {
|
||||||
// Keep this in sync with gen_loc_ids.py and what's used in the menu.xml
|
|
||||||
// files to mark me-localized strings.
|
|
||||||
private static final int FMT_LEN = 4;
|
private static final int FMT_LEN = 4;
|
||||||
private static final String k_LOCALE = "locale";
|
private static final String k_LOCALE = "locale";
|
||||||
private static final String k_XLATPROTO = "proto";
|
private static final String k_XLATPROTO = "proto";
|
||||||
|
@ -262,7 +260,9 @@ public class LocUtils {
|
||||||
Map<String,String> newXlations = new HashMap<String,String>( len );
|
Map<String,String> newXlations = new HashMap<String,String>( len );
|
||||||
for ( int ii = 0; ii < len; ++ii ) {
|
for ( int ii = 0; ii < len; ++ii ) {
|
||||||
JSONObject pair = pairs.getJSONObject( ii );
|
JSONObject pair = pairs.getJSONObject( ii );
|
||||||
String key = pair.getString( "en" );
|
int id = pair.getInt( "id" );
|
||||||
|
String key = context.getString( id );
|
||||||
|
Assert.assertNotNull( key );
|
||||||
String txt = pair.getString( "loc" );
|
String txt = pair.getString( "loc" );
|
||||||
newXlations.put( key, txt );
|
newXlations.put( key, txt );
|
||||||
}
|
}
|
||||||
|
@ -420,6 +420,8 @@ public class LocUtils {
|
||||||
// formatters.
|
// formatters.
|
||||||
private static String toUpperCase( String str )
|
private static String toUpperCase( String str )
|
||||||
{
|
{
|
||||||
|
String result = null;
|
||||||
|
if ( UPPER_CASE ) {
|
||||||
String[] parts = str.split( "%[\\d]\\$[ds]" );
|
String[] parts = str.split( "%[\\d]\\$[ds]" );
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
@ -431,7 +433,9 @@ public class LocUtils {
|
||||||
offset += FMT_LEN;
|
offset += FMT_LEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sb.toString();
|
result = sb.toString();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlertDialog.Builder makeAlertBuilder( Context context )
|
public static AlertDialog.Builder makeAlertBuilder( Context context )
|
||||||
|
|
Loading…
Add table
Reference in a new issue