Initial basic multi-language support.

This commit is contained in:
Lioncash 2013-09-27 00:58:05 -04:00
parent a04e2ff11a
commit a33863f0f2
8 changed files with 98 additions and 92 deletions

View File

@ -11,4 +11,41 @@
<string name="optimal_settings_device">Optimal device settings</string>
<string name="extracting_assets_please_wait_">Extracting assets, please wait …</string>
<!-- Core Selection Class -->
<string name="select_libretro_core">Select Libretro core</string>
<!-- Display Refresh Rate Test Class -->
<string name="refresh_rate_calibration">Refresh rate calibration</string>
<string name="touch_screen_with_fingers">Touch the screen with your fingers for more accurate measurements.</string>
<!-- History Selection Class -->
<string name="recently_played_games">Recently played games</string>
<string name="loading_gamepath">Loading [%1$s]…</string>
<!-- Key Bind Preference Class -->
<string name="current_binding">Current: %1$s</string>
<string name="press_key_to_use">Press key to use</string>
<!-- Main Menu Class -->
<string name="no_core">No core</string>
<string name="welcome_to_retroarch">Welcome to RetroArch</string>
<string name="welcome_to_retroarch_desc">This is your first time starting up RetroArch. RetroArch will now be preconfigured for the best possible gameplay experience.</string>
<string name="detect_device_msg_ouya">The ideal configuration options for your device will now be preconfigured.\n\nNOTE: For optimal performance, turn off Google Account sync, GPS and Wi-Fi in your Android settings menu.</string>
<string name="detect_device_msg_general">The ideal configuration options for your device will now be preconfigured.\n\nNOTE: For optimal performance, turn off Google Account sync, Google Play Store auto-updates, GPS and Wi-Fi in your Android settings menu.</string>
<string name="nvidia_shield_detected">NVidia Shield detected</string>
<string name="game_mid_detected">GameMID detected</string>
<string name="ouya_detected">OUYA detected</string>
<string name="xperia_play_detected">Xperia Play detected</string>
<string name="nexus_7_2013_detected">Nexus 7 2013 detected</string>
<string name="no_optimal_settings">Device either not detected in list or doesn\'t have any optimal settings in our database.</string>
<string name="load_a_core_first">Go to \'Load Core\' and select a core first.</string>
<string name="loading_data">Loading [%1$s]…</string>
<!-- Refresh Rate Set OS Class -->
<string name="using_os_reported_refresh_rate">Using OS-reported refresh rate of: %1$s Hz.</string>
<!-- Miscellaneous -->
<string name="ok">OK</string>
<string name="close">Close</string>
</resources>

View File

@ -41,7 +41,7 @@ public final class CoreSelection extends Activity implements
list.setAdapter(adapter);
list.setOnItemClickListener(this);
setTitle("Select Libretro core");
setTitle(R.string.select_libretro_core);
// Populate the list
final String modulePath = MainMenuActivity.getInstance()

View File

@ -3,6 +3,8 @@ package org.retroarch.browser;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import org.retroarch.R;
import android.app.Activity;
import android.content.SharedPreferences;
import android.opengl.GLES20;
@ -105,12 +107,12 @@ public final class DisplayRefreshRateTest extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toast.makeText(this, "Touch the screen with your fingers for more accurate measurements.", Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.touch_screen_with_fingers, Toast.LENGTH_LONG).show();
surfaceView = new GLSurfaceView(this);
surfaceView.setEGLContextClientVersion(2);
surfaceView.setRenderer(new Renderer(this));
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setTitle("Refresh rate calibration");
setTitle(R.string.refresh_rate_calibration);
setContentView(surfaceView);
}

View File

@ -34,7 +34,7 @@ public final class HistorySelection extends Activity implements
list.setAdapter(adapter);
list.setOnItemClickListener(this);
setTitle("Recently played games");
setTitle(R.string.recently_played_games);
File history = new File(getApplicationInfo().dataDir, "retroarch-history.txt");
@ -71,8 +71,7 @@ public final class HistorySelection extends Activity implements
MainMenuActivity.getInstance().updateConfigFile();
Toast.makeText(this, "Loading: [" + gamePath + "] ...",
Toast.LENGTH_SHORT).show();
Toast.makeText(this, String.format(getString(R.string.loading_gamepath), gamePath), Toast.LENGTH_SHORT).show();
myIntent = new Intent(this, RetroActivity.class);
myIntent.putExtra("ROM", gamePath);
myIntent.putExtra("LIBRETRO", corePath);

View File

@ -45,9 +45,11 @@ final class KeyBindPreference extends DialogPreference implements View.OnKeyList
KeyBindEditText keyText;
private String[] key_labels;
private final int DEFAULT_KEYCODE = 0;
private final Context context;
public KeyBindPreference(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
key_labels = getContext().getResources().getStringArray(R.array.key_bind_values);
}
@ -57,7 +59,7 @@ final class KeyBindPreference extends DialogPreference implements View.OnKeyList
{
grabKeyCode = false;
key_bind_code = keyCode;
keyText.setText("Current: " + key_labels[key_bind_code]);
keyText.setText(String.format(context.getString(R.string.current_binding), key_labels[key_bind_code]));
}
}
@ -84,7 +86,7 @@ final class KeyBindPreference extends DialogPreference implements View.OnKeyList
((Button) view.findViewById(R.id.key_bind_detect)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
grabKeyCode = true;
keyText.setText("Press key to use");
keyText.setText(R.string.press_key_to_use);
keyText.requestFocus();
}
});

View File

@ -80,7 +80,7 @@ public final class MainMenuActivity extends PreferenceActivity {
SharedPreferences prefs = getPreferences();
libretro_path = prefs.getString("libretro_path", getApplicationInfo().nativeLibraryDir);
libretro_name = prefs.getString("libretro_name", "No core");
libretro_name = prefs.getString("libretro_name", getString(R.string.no_core));
refreshPreferenceScreen();
@ -94,9 +94,8 @@ public final class MainMenuActivity extends PreferenceActivity {
if (!detectDevice(false)) {
AlertDialog.Builder alert = new AlertDialog.Builder(this)
.setTitle("Welcome to RetroArch")
.setMessage(
"This is your first time starting up RetroArch. RetroArch will now be preconfigured for the best possible gameplay experience.")
.setTitle(R.string.welcome_to_retroarch)
.setMessage(R.string.welcome_to_retroarch_desc)
.setPositiveButton("OK", null);
alert.show();
}
@ -653,31 +652,23 @@ public final class MainMenuActivity extends PreferenceActivity {
boolean detectDevice(boolean show_dialog) {
boolean retval = false;
boolean mentionPlayStore = !android.os.Build.MODEL
.equals("OUYA Console");
final String message = "The ideal configuration options for your device will now be preconfigured.\n\nNOTE: For optimal performance, turn off Google Account sync, "
+ (mentionPlayStore ? "Google Play Store auto-updates, " : "")
+ "GPS and Wi-Fi in your Android settings menu.";
final boolean mentionPlayStore = !android.os.Build.MODEL.equals("OUYA Console");
final String message = (mentionPlayStore ? getString(R.string.detect_device_msg_general) : getString(R.string.detect_device_msg_ouya));
Log.i("Device MODEL", android.os.Build.MODEL);
if (android.os.Build.MODEL.equals("SHIELD")) {
AlertDialog.Builder alert = new AlertDialog.Builder(this)
.setTitle("NVidia Shield detected")
.setTitle(R.string.nvidia_shield_detected)
.setMessage(message)
.setPositiveButton("OK",
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
public void onClick(DialogInterface dialog, int which) {
SharedPreferences prefs = getPreferences();
SharedPreferences.Editor edit = prefs
.edit();
edit.putString("video_refresh_rate", Double
.valueOf(60.00d).toString());
edit.putBoolean("input_overlay_enable",
false);
edit.putBoolean("input_autodetect_enable",
true);
SharedPreferences.Editor edit = prefs.edit();
edit.putString("video_refresh_rate", Double.toString(60.00d));
edit.putBoolean("input_overlay_enable", false);
edit.putBoolean("input_autodetect_enable", true);
edit.putString("audio_latency", "64");
edit.putBoolean("audio_latency_auto", true);
edit.commit();
@ -687,20 +678,16 @@ public final class MainMenuActivity extends PreferenceActivity {
retval = true;
} else if (android.os.Build.MODEL.equals("GAMEMID_BT")) {
AlertDialog.Builder alert = new AlertDialog.Builder(this)
.setTitle("GameMID detected")
.setTitle(R.string.game_mid_detected)
.setMessage(message)
.setPositiveButton("OK",
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
public void onClick(DialogInterface dialog, int which) {
SharedPreferences prefs = getPreferences();
SharedPreferences.Editor edit = prefs
.edit();
edit.putBoolean("input_overlay_enable",
false);
edit.putBoolean("input_autodetect_enable",
true);
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean("input_overlay_enable", false);
edit.putBoolean("input_autodetect_enable", true);
edit.putString("audio_latency", "160");
edit.putBoolean("audio_latency_auto", false);
edit.commit();
@ -710,20 +697,16 @@ public final class MainMenuActivity extends PreferenceActivity {
retval = true;
} else if (android.os.Build.MODEL.equals("OUYA Console")) {
AlertDialog.Builder alert = new AlertDialog.Builder(this)
.setTitle("OUYA detected")
.setTitle(R.string.ouya_detected)
.setMessage(message)
.setPositiveButton("OK",
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
public void onClick(DialogInterface dialog, int which) {
SharedPreferences prefs = getPreferences();
SharedPreferences.Editor edit = prefs
.edit();
edit.putBoolean("input_overlay_enable",
false);
edit.putBoolean("input_autodetect_enable",
true);
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean("input_overlay_enable", false);
edit.putBoolean("input_autodetect_enable", true);
edit.putString("audio_latency", "64");
edit.putBoolean("audio_latency_auto", true);
edit.commit();
@ -733,23 +716,18 @@ public final class MainMenuActivity extends PreferenceActivity {
retval = true;
} else if (android.os.Build.MODEL.equals("R800x")) {
AlertDialog.Builder alert = new AlertDialog.Builder(this)
.setTitle("Xperia Play detected")
.setTitle(R.string.xperia_play_detected)
.setMessage(message)
.setPositiveButton("OK",
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
public void onClick(DialogInterface dialog, int which) {
SharedPreferences prefs = getPreferences();
SharedPreferences.Editor edit = prefs
.edit();
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean("video_threaded", false);
edit.putBoolean("input_overlay_enable",
false);
edit.putBoolean("input_autodetect_enable",
true);
edit.putString("video_refresh_rate", Double
.valueOf(59.19132938771038).toString());
edit.putBoolean("input_overlay_enable", false);
edit.putBoolean("input_autodetect_enable", true);
edit.putString("video_refresh_rate", Double.toString(59.19132938771038));
edit.putString("audio_latency", "128");
edit.putBoolean("audio_latency_auto", false);
edit.commit();
@ -759,18 +737,15 @@ public final class MainMenuActivity extends PreferenceActivity {
retval = true;
} else if (android.os.Build.ID.equals("JSS15J")) {
AlertDialog.Builder alert = new AlertDialog.Builder(this)
.setTitle("Nexus 7 2013 detected")
.setTitle(R.string.nexus_7_2013_detected)
.setMessage(message)
.setPositiveButton("OK",
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
public void onClick(DialogInterface dialog, int which) {
SharedPreferences prefs = getPreferences();
SharedPreferences.Editor edit = prefs
.edit();
edit.putString("video_refresh_rate", Double
.valueOf(59.65).toString());
SharedPreferences.Editor edit = prefs.edit();
edit.putString("video_refresh_rate", Double.toString(59.65));
edit.putString("audio_latency", "64");
edit.putBoolean("audio_latency_auto", false);
edit.commit();
@ -781,10 +756,7 @@ public final class MainMenuActivity extends PreferenceActivity {
}
if (show_dialog) {
Toast.makeText(
this,
"Device either not detected in list or doesn't have any optimal settings in our database.",
Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.no_optimal_settings, Toast.LENGTH_SHORT).show();
}
refreshPreferenceScreen();
@ -804,9 +776,7 @@ public final class MainMenuActivity extends PreferenceActivity {
if (!new File(libretro_path).isDirectory()) {
super.startActivityForResult(intent, ACTIVITY_LOAD_ROM);
} else {
Toast.makeText(this,
"Go to 'Load Core' and select a core first.",
Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.load_a_core_first, Toast.LENGTH_SHORT).show();
}
} else {
super.startActivity(intent);
@ -819,18 +789,12 @@ public final class MainMenuActivity extends PreferenceActivity {
case ACTIVITY_LOAD_ROM: {
if (data.getStringExtra("PATH") != null) {
updateConfigFile();
Intent myIntent;
String current_ime = Settings.Secure.getString(
getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD);
Toast.makeText(this,
"Loading: [" + data.getStringExtra("PATH") + "]...",
Toast.LENGTH_SHORT).show();
myIntent = new Intent(this, RetroActivity.class);
String current_ime = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
Toast.makeText(this,String.format(getString(R.string.loading_data), data.getStringExtra("PATH")), Toast.LENGTH_SHORT).show();
Intent myIntent = new Intent(this, RetroActivity.class);
myIntent.putExtra("ROM", data.getStringExtra("PATH"));
myIntent.putExtra("LIBRETRO", libretro_path);
myIntent.putExtra("CONFIGFILE",
getDefaultConfigPath());
myIntent.putExtra("CONFIGFILE", getDefaultConfigPath());
myIntent.putExtra("IME", current_ime);
startActivity(myIntent);
}
@ -848,10 +812,8 @@ public final class MainMenuActivity extends PreferenceActivity {
private void loadRomExternal(String rom, String core) {
updateConfigFile();
Intent myIntent = new Intent(this, RetroActivity.class);
String current_ime = Settings.Secure.getString(getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD);
Toast.makeText(this, "Loading: [" + rom + "]...", Toast.LENGTH_SHORT)
.show();
String current_ime = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
Toast.makeText(this, String.format(getString(R.string.loading_data), rom), Toast.LENGTH_SHORT).show();
myIntent.putExtra("ROM", rom);
myIntent.putExtra("LIBRETRO", core);
myIntent.putExtra("CONFIGFILE", getDefaultConfigPath());

View File

@ -1,5 +1,7 @@
package org.retroarch.browser;
import org.retroarch.R;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
@ -22,7 +24,7 @@ public final class RefreshRateSetOS extends Activity {
edit.putString("video_refresh_rate", Double.valueOf(rate).toString());
edit.commit();
Toast.makeText(this, "Using OS-reported refresh rate of: " + rate + " Hz.", Toast.LENGTH_LONG).show();
Toast.makeText(this, String.format(getString(R.string.using_os_reported_refresh_rate), rate), Toast.LENGTH_LONG).show();
finish();
}
}

View File

@ -1,5 +1,7 @@
package org.retroarch.browser;
import org.retroarch.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
@ -16,7 +18,7 @@ public final class ReportIME extends Activity {
final Activity ctx = this;
AlertDialog.Builder dialog = new AlertDialog.Builder(this)
.setMessage(current_ime)
.setNeutralButton("Close",
.setNeutralButton(R.string.close,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,