DroidFish: Moved strings to strings.xml so they can be translated.

This commit is contained in:
Peter Osterlund 2011-12-17 02:35:30 +00:00
parent 045cb8a700
commit 1695cf1624
3 changed files with 32 additions and 15 deletions

View File

@ -26,23 +26,23 @@
android:label="Preferences"> android:label="Preferences">
</activity> </activity>
<activity android:name=".activities.EditBoard" <activity android:name=".activities.EditBoard"
android:label="Edit Board" android:label="@string/edit_board"
android:configChanges="orientation"> android:configChanges="orientation">
</activity> </activity>
<activity android:name=".activities.EditPGNLoad" <activity android:name=".activities.EditPGNLoad"
android:label="Edit File / Load Game" android:label="@string/load_game_title"
android:configChanges="orientation"> android:configChanges="orientation">
</activity> </activity>
<activity android:name=".activities.EditPGNSave" <activity android:name=".activities.EditPGNSave"
android:label="Edit File / Save Game" android:label="@string/save_game_title"
android:configChanges="orientation"> android:configChanges="orientation">
</activity> </activity>
<activity android:name=".activities.LoadScid" <activity android:name=".activities.LoadScid"
android:label="Load Scid Game" android:label="@string/load_scid_game_title"
android:configChanges="orientation"> android:configChanges="orientation">
</activity> </activity>
<activity android:name=".activities.CPUWarning" <activity android:name=".activities.CPUWarning"
android:label="CPU Warning"> android:label="@string/cpu_warning_title">
</activity> </activity>
</application> </application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

View File

@ -351,4 +351,18 @@ you are not actively using the program.\
<string name="draw_agree">Game over, draw by agreement!</string> <string name="draw_agree">Game over, draw by agreement!</string>
<string name="resign_white">Game over, white resigns!</string> <string name="resign_white">Game over, white resigns!</string>
<string name="resign_black">Game over, black resigns!</string> <string name="resign_black">Game over, black resigns!</string>
<string name="book">Book:</string>
<string name="invalid_move">Invalid move</string>
<string name="load_game_title">Edit File / Load Game</string>
<string name="save_game_title">Edit File / Save Game</string>
<string name="load_scid_game_title">Load Scid Game</string>
<string name="cpu_warning_title">CPU Warning</string>
<string name="failed_to_read_pgn_data">Failed to read pgn data</string>
<string name="variation">Var:</string>
<string name="add_analysis">Add Analysis</string>
<string name="fewer_variations">Fewer Variations</string>
<string name="more_variations">More Variations</string>
<string name="heavy_cpu_usage">Heavy CPU usage</string>
<string name="background_processing">Background processing</string>
<string name="lot_cpu_power">DroidFish is using a lot of CPU power</string>
</resources> </resources>

View File

@ -236,7 +236,8 @@ public class DroidFish extends Activity implements GUIInterface {
pgn = sb.toString(); pgn = sb.toString();
} }
} catch (IOException e) { } catch (IOException e) {
Toast.makeText(getApplicationContext(), "Failed to read pgn data", Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), R.string.failed_to_read_pgn_data,
Toast.LENGTH_SHORT).show();
} }
return pgn; return pgn;
} }
@ -936,7 +937,7 @@ public class DroidFish extends Activity implements GUIInterface {
String s = ""; String s = "";
if (!thinkingEmpty) if (!thinkingEmpty)
s += "<br>"; s += "<br>";
s += "<b>Book:</b>" + bookInfoStr; s += "<b>" + getString(R.string.book) + "</b>" + bookInfoStr;
thinking.append(Html.fromHtml(s)); thinking.append(Html.fromHtml(s));
thinkingEmpty = false; thinkingEmpty = false;
} }
@ -944,7 +945,7 @@ public class DroidFish extends Activity implements GUIInterface {
String s = ""; String s = "";
if (!thinkingEmpty) if (!thinkingEmpty)
s += "<br>"; s += "<br>";
s += "<b>Var:</b> " + variantStr; s += "<b>" + getString(R.string.variation) + "</b> " + variantStr;
thinking.append(Html.fromHtml(s)); thinking.append(Html.fromHtml(s));
} }
@ -1498,15 +1499,15 @@ public class DroidFish extends Activity implements GUIInterface {
final int MULTIPV_INC = 2; final int MULTIPV_INC = 2;
List<CharSequence> lst = new ArrayList<CharSequence>(); List<CharSequence> lst = new ArrayList<CharSequence>();
List<Integer> actions = new ArrayList<Integer>(); List<Integer> actions = new ArrayList<Integer>();
lst.add("Add Analysis"); actions.add(ADD_ANALYSIS); lst.add(getString(R.string.add_analysis)); actions.add(ADD_ANALYSIS);
final int numPV = ctrl.getNumPV(); final int numPV = ctrl.getNumPV();
if (gameMode.analysisMode()) { if (gameMode.analysisMode()) {
int maxPV = ctrl.maxPV(); int maxPV = ctrl.maxPV();
if (numPV > 1) { if (numPV > 1) {
lst.add("Fewer Variations"); actions.add(MULTIPV_DEC); lst.add(getString(R.string.fewer_variations)); actions.add(MULTIPV_DEC);
} }
if (numPV < maxPV) { if (numPV < maxPV) {
lst.add("More Variations"); actions.add(MULTIPV_INC); lst.add(getString(R.string.more_variations)); actions.add(MULTIPV_INC);
} }
} }
final List<Integer> finalActions = actions; final List<Integer> finalActions = actions;
@ -1720,7 +1721,9 @@ public class DroidFish extends Activity implements GUIInterface {
@Override @Override
public void reportInvalidMove(Move m) { public void reportInvalidMove(Move m) {
String msg = String.format("Invalid move %s-%s", TextIO.squareToString(m.from), TextIO.squareToString(m.to)); String msg = String.format("%s %s-%s",
getString(R.string.invalid_move),
TextIO.squareToString(m.from), TextIO.squareToString(m.to));
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
} }
@ -1760,14 +1763,14 @@ public class DroidFish extends Activity implements GUIInterface {
NotificationManager mNotificationManager = (NotificationManager)getSystemService(ns); NotificationManager mNotificationManager = (NotificationManager)getSystemService(ns);
if (show) { if (show) {
int icon = R.drawable.icon; int icon = R.drawable.icon;
CharSequence tickerText = "Heavy CPU usage"; CharSequence tickerText = getString(R.string.heavy_cpu_usage);
long when = System.currentTimeMillis(); long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when); Notification notification = new Notification(icon, tickerText, when);
notification.flags |= Notification.FLAG_ONGOING_EVENT; notification.flags |= Notification.FLAG_ONGOING_EVENT;
Context context = getApplicationContext(); Context context = getApplicationContext();
CharSequence contentTitle = "Background processing"; CharSequence contentTitle = getString(R.string.background_processing);
CharSequence contentText = "DroidFish is using a lot of CPU power"; CharSequence contentText = getString(R.string.lot_cpu_power);
Intent notificationIntent = new Intent(this, CPUWarning.class); Intent notificationIntent = new Intent(this, CPUWarning.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);