[Android] Multi-language support (or at least the basic foundation of it).

Added an example translation (Japanese). So now the Android version can both display in English and Japanese, depending on what the Android device's system language is set to.

Also did a tiny clean-up of InputConfigItem.java so that the parameters are slightly more descriptive.

Now, to do a translation in [x] language, all you have to do is take the normal English strings.xml and translate the XML entries into said language, and simply make a folder in the /res/ sub-directory in the form of values-[region code]. IE) With the Japanese translation, it is in the folder /res/values-ja

No configuration other than that is needed. After doing the above, the language should load fine on any device when set to that specific system language.

By default, if a translation file does not exist for a given system language. The app will automatically fall back to using the English translation.

This *should* be bug-free since I did check everything multiple times. But if any issues occur, please report them so that I can fix them.
This commit is contained in:
Lioncash 2013-08-12 21:22:20 -04:00
parent 3b272d81b4
commit b823983199
11 changed files with 244 additions and 77 deletions

View File

@ -2,23 +2,23 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
> >
<PreferenceCategory <PreferenceCategory
android:summary="Settings" android:summary="@string/settings"
android:title="CPU Settings" android:title="@string/cpu_settings"
android:key="cpuprefcat"> android:key="cpuprefcat">
<CheckBoxPreference <CheckBoxPreference
android:key="dualcorepref" android:key="dualcorepref"
android:summary="On/Off" android:summary="@string/on_off"
android:title="Dual Core" /> android:title="@string/dual_core" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:summary="Settings" android:summary="@string/settings"
android:title="Video Settings" android:title="@string/video_settings"
android:key="videoprefcat"> android:key="videoprefcat">
<ListPreference <ListPreference
android:entries="@array/gpuOptions" android:entries="@array/gpuOptions"
android:entryValues="@array/gpuValues" android:entryValues="@array/gpuValues"
android:key="gpupref" android:key="gpupref"
android:summary="Video backend to use" android:summary="@string/video_backend_to_use"
android:title="Video Backend" /> android:title="@string/video_backend" />
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Title of the app -->
<string name="app_name">Dolphin Emulator</string>
<!-- Navigation-related Strings -->
<string name="drawer_open">ナビゲーションウィンドウを開く</string>
<string name="drawer_close">ナビゲーションウィンドウを閉じる</string>
<!-- About Fragment -->
<string name="build_revision">ビルドのバージョン:</string>
<string name="supports_gles3">サポートのOpenGL ES 3</string>
<!-- Folder Browser -->
<string name="current_dir">現在のディレクトリ: </string>
<string name="parent_directory">親ディレクトリ</string>
<string name="folder">フォルダ</string>
<string name="file_size">ファイルサイズ: </string>
<string name="cant_use_compressed_filetypes">圧縮ファイル形式はサポートされていません</string>
<!-- Game List Activity -->
<string name="game_list">ゲームリスト</string>
<string name="browse_folder">フォルダの参照</string>
<string name="settings">設定</string>
<string name="gamepad_config">ゲームパッド設定</string>
<string name="about">について</string>
<string name="loading_browser">ファイルブラウザのロード</string>
<string name="loading_settings">設定のロード</string>
<string name="loading_gamepad">ゲームパッド設定のロード</string>
<string name="loading_about">メニューについてのロード</string>
<!-- Game List Fragment -->
<string name="file_clicked">クリックされたファイル: </string>
<!-- Input Config Fragment -->
<string name="draw_onscreen_controls">画面上のコントロールを描画</string>
<string name="button_a">Aボタン</string>
<string name="button_b">Bボタン</string>
<string name="button_start">スタートボタン</string>
<string name="button_x">Xボタン</string>
<string name="button_y">Yボタン</string>
<string name="button_z">Zボタン</string>
<string name="dpad_up">D-Pad: ↑</string>
<string name="dpad_down">D-Pad: ↓</string>
<string name="dpad_left">D-Pad: ←</string>
<string name="dpad_right">D-Pad: →</string>
<string name="main_stick_up">コントロールスティック: ↑</string>
<string name="main_stick_down">コントロールスティック: ↓</string>
<string name="main_stick_left">コントロールスティック: ←</string>
<string name="main_stick_right">コントロールスティック: →</string>
<string name="c_stick_up">C-スティック: ↑</string>
<string name="c_stick_down">C-スティック: ↓</string>
<string name="c_stick_left">C-スティック: ←</string>
<string name="c_stick_right">C-スティック: →</string>
<string name="trigger_left">左のトリガー</string>
<string name="trigger_right">右のトリガー</string>
<string name="not_drawing_onscreen_controls">コントロールは画面上に描画されていない</string>
<string name="drawing_onscreen_controls">コントロールは画面上に描画されています</string>
<string name="press_button_to_config">%1$sを設定するにはボタンを押して</string>
<!-- Prefs Fragment -->
<string name="interpreter">Interpreter</string>
<string name="jit64_recompiler">JIT64 Recompiler</string>
<string name="jitil_recompiler">JITIL Recompiler</string>
<string name="jit_arm_recompiler">JIT ARM Recompiler</string>
<string name="cpu_core">CPUコア</string>
<string name="cpu_settings">CPU設定</string>
<string name="emu_core_to_use">使用するエミュレーションコア</string>
<string name="dual_core">デュアルコア</string>
<string name="on_off">有効/無効</string>
<string name="video_settings">ビデオ設定</string>
<string name="software_renderer">Software Renderer</string>
<string name="video_backend">ビデオレンダラ</string>
<string name="video_backend_to_use">使用するビデオレンダラー</string>
<!-- Miscellaneous -->
<string name="yes">はい</string>
<string name="no">いいえ</string>
</resources>

View File

@ -1,8 +1,83 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Title of the app -->
<string name="app_name">Dolphin Emulator</string> <string name="app_name">Dolphin Emulator</string>
<!-- Navigation-related Strings -->
<string name="drawer_open">Open navigation drawer</string> <string name="drawer_open">Open navigation drawer</string>
<string name="drawer_close">Close navigation drawer</string> <string name="drawer_close">Close navigation drawer</string>
<!-- About Fragment -->
<string name="build_revision">Build Revision:</string>
<string name="supports_gles3">Supports OpenGL ES 3:</string>
<!-- Folder Browser -->
<string name="current_dir">Current Dir: </string>
<string name="parent_directory">Parent Directory</string>
<string name="folder">Folder</string>
<string name="file_size">File Size: </string>
<string name="cant_use_compressed_filetypes">Can not use compressed file types</string>
<!-- Game List Activity -->
<string name="game_list">Game List</string>
<string name="browse_folder">Browse Folder</string>
<string name="settings">Settings</string>
<string name="gamepad_config">Gamepad Config</string>
<string name="about">About</string>
<string name="loading_browser">Loading up the browser</string>
<string name="loading_settings">Loading up settings</string>
<string name="loading_gamepad">Loading up gamepad config</string>
<string name="loading_about">Loading about menu</string>
<!-- Game List Fragment -->
<string name="file_clicked">File clicked: </string>
<!-- Input Config Fragment -->
<string name="draw_onscreen_controls">Draw on-screen controls</string>
<string name="button_a">Button A</string>
<string name="button_b">Button B</string>
<string name="button_start">Button Start</string>
<string name="button_x">Button X</string>
<string name="button_y">Button Y</string>
<string name="button_z">Button Z</string>
<string name="dpad_up">D-Pad Up</string>
<string name="dpad_down">D-Pad Down</string>
<string name="dpad_left">D-Pad Left</string>
<string name="dpad_right">D-Pad Right</string>
<string name="main_stick_up">Main Stick Up</string>
<string name="main_stick_down">Main Stick Down</string>
<string name="main_stick_left">Main Stick Left</string>
<string name="main_stick_right">Main Stick Right</string>
<string name="c_stick_up">C Stick Up</string>
<string name="c_stick_down">C Stick Down</string>
<string name="c_stick_left">C Stick Left</string>
<string name="c_stick_right">C Stick Right</string>
<string name="trigger_left">Trigger L</string>
<string name="trigger_right">Trigger R</string>
<string name="not_drawing_onscreen_controls">Not drawing on-screen controls</string>
<string name="drawing_onscreen_controls">Drawing on-screen controls</string>
<string name="press_button_to_config">Press button to configure %1$s</string>
<!-- Prefs Fragment -->
<string name="interpreter">Interpreter</string>
<string name="jit64_recompiler">JIT64 Recompiler</string>
<string name="jitil_recompiler">JITIL Recompiler</string>
<string name="jit_arm_recompiler">JIT ARM Recompiler</string>
<string name="cpu_core">CPU Core</string>
<string name="cpu_settings">CPU Settings</string>
<string name="emu_core_to_use">Emulation core to use</string>
<string name="dual_core">Dual Core</string>
<string name="on_off">On/Off</string>
<string name="video_settings">Video Settings</string>
<string name="software_renderer">Software Renderer</string>
<string name="video_backend">Video Backend</string>
<string name="video_backend_to_use">Video backend to use</string>
<!-- Miscellaneous -->
<string name="yes">Yes</string>
<string name="no">No</string>
</resources> </resources>

View File

@ -35,10 +35,13 @@ public class AboutFragment extends Fragment {
Bundle savedInstanceState) { Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.gamelist_listview, container, false); View rootView = inflater.inflate(R.layout.gamelist_listview, container, false);
mMainList = (ListView) rootView.findViewById(R.id.gamelist); mMainList = (ListView) rootView.findViewById(R.id.gamelist);
String yes = getString(R.string.yes);
String no = getString(R.string.no);
List<GameListItem> Input = new ArrayList<GameListItem>(); List<GameListItem> Input = new ArrayList<GameListItem>();
Input.add(new GameListItem(m_activity, "Build Revision", NativeLibrary.GetVersionString(), "", true)); Input.add(new GameListItem(m_activity, getString(R.string.build_revision), NativeLibrary.GetVersionString(), "", true));
Input.add(new GameListItem(m_activity, "Supports OpenGL ES 3", PrefsFragment.SupportsGLES3() ? "Yes" : "No", "", true)); Input.add(new GameListItem(m_activity, getString(R.string.supports_gles3), PrefsFragment.SupportsGLES3() ? yes : no, "", true));
adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, Input); adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, Input);
mMainList.setAdapter(adapter); mMainList.setAdapter(adapter);

View File

@ -38,7 +38,7 @@ public class DolphinEmulator<MainActivity> extends Activity
out.close(); out.close();
out = null; out = null;
} catch(IOException e) { } catch(IOException e) {
Log.e("tag", "Failed to copy asset file: " + asset, e); Log.e("DolphinEmulator", "Failed to copy asset file: " + asset, e);
} }
} }

View File

@ -24,7 +24,7 @@ public class FolderBrowser extends Fragment {
// Populates the FolderView with the given currDir's contents. // Populates the FolderView with the given currDir's contents.
private void Fill(File currDir) private void Fill(File currDir)
{ {
m_activity.setTitle("Current Dir: " + currDir.getName()); m_activity.setTitle(getString(R.string.current_dir) + currDir.getName());
File[] dirs = currDir.listFiles(); File[] dirs = currDir.listFiles();
List<GameListItem>dir = new ArrayList<GameListItem>(); List<GameListItem>dir = new ArrayList<GameListItem>();
List<GameListItem>fls = new ArrayList<GameListItem>(); List<GameListItem>fls = new ArrayList<GameListItem>();
@ -44,17 +44,17 @@ public class FolderBrowser extends Fragment {
{ {
if(entry.isDirectory()) if(entry.isDirectory())
{ {
dir.add(new GameListItem(m_activity, entryName,"Folder",entry.getAbsolutePath(), true)); dir.add(new GameListItem(m_activity, entryName, getString(R.string.folder), entry.getAbsolutePath(), true));
} }
else else
{ {
if (validExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) if (validExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
{ {
fls.add(new GameListItem(m_activity, entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), true)); fls.add(new GameListItem(m_activity, entryName,getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), true));
} }
else if (archiveExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) else if (archiveExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
{ {
fls.add(new GameListItem(m_activity, entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), false)); fls.add(new GameListItem(m_activity, entryName,getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), false));
} }
} }
} }
@ -70,7 +70,7 @@ public class FolderBrowser extends Fragment {
// Check for a parent directory to the one we're currently in. // Check for a parent directory to the one we're currently in.
if (!currDir.getPath().equalsIgnoreCase("/")) if (!currDir.getPath().equalsIgnoreCase("/"))
dir.add(0, new GameListItem(m_activity, "..", "Parent Directory", currDir.getParent(), true)); dir.add(0, new GameListItem(m_activity, "..", getString(R.string.parent_directory), currDir.getParent(), true));
adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, dir); adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, dir);
mDrawerList = (ListView) rootView.findViewById(R.id.gamelist); mDrawerList = (ListView) rootView.findViewById(R.id.gamelist);
@ -95,16 +95,18 @@ public class FolderBrowser extends Fragment {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
GameListItem o = adapter.getItem(position); GameListItem o = adapter.getItem(position);
if(o.getData().equalsIgnoreCase("folder") || o.getData().equalsIgnoreCase("parent directory")) if(o.getData().equalsIgnoreCase(getString(R.string.folder)) || o.getData().equalsIgnoreCase(getString(R.string.parent_directory)))
{ {
currentDir = new File(o.getPath()); currentDir = new File(o.getPath());
Fill(currentDir); Fill(currentDir);
} }
else else
{
if (o.isValid()) if (o.isValid())
FolderSelected(); FolderSelected();
else else
Toast.makeText(m_activity, "Can not use compressed file types.", Toast.LENGTH_LONG).show(); Toast.makeText(m_activity, getString(R.string.cant_use_compressed_filetypes), Toast.LENGTH_LONG).show();
}
} }
}; };

View File

@ -52,11 +52,11 @@ public class GameListActivity extends Activity
mDrawerList = (ListView) findViewById(R.id.left_drawer); mDrawerList = (ListView) findViewById(R.id.left_drawer);
List<SideMenuItem> dir = new ArrayList<SideMenuItem>(); List<SideMenuItem> dir = new ArrayList<SideMenuItem>();
dir.add(new SideMenuItem("Game List", 0)); dir.add(new SideMenuItem(getString(R.string.game_list), 0));
dir.add(new SideMenuItem("Browse Folder", 1)); dir.add(new SideMenuItem(getString(R.string.browse_folder), 1));
dir.add(new SideMenuItem("Settings", 2)); dir.add(new SideMenuItem(getString(R.string.settings), 2));
dir.add(new SideMenuItem("Gamepad Config", 3)); dir.add(new SideMenuItem(getString(R.string.gamepad_config), 3));
dir.add(new SideMenuItem("About", 4)); dir.add(new SideMenuItem(getString(R.string.about), 4));
mDrawerAdapter = new SideMenuAdapter(this, R.layout.sidemenu, dir); mDrawerAdapter = new SideMenuAdapter(this, R.layout.sidemenu, dir);
mDrawerList.setAdapter(mDrawerAdapter); mDrawerList.setAdapter(mDrawerAdapter);
@ -179,7 +179,7 @@ public class GameListActivity extends Activity
break; break;
case 1: case 1:
{ {
Toast.makeText(mMe, "Loading up the browser", Toast.LENGTH_SHORT).show(); Toast.makeText(mMe, getString(R.string.loading_browser), Toast.LENGTH_SHORT).show();
mCurFragmentNum = 1; mCurFragmentNum = 1;
mCurFragment = new FolderBrowser(); mCurFragment = new FolderBrowser();
FragmentManager fragmentManager = getFragmentManager(); FragmentManager fragmentManager = getFragmentManager();
@ -188,7 +188,7 @@ public class GameListActivity extends Activity
break; break;
case 2: case 2:
{ {
Toast.makeText(mMe, "Loading up settings", Toast.LENGTH_SHORT).show(); Toast.makeText(mMe, getString(R.string.loading_settings), Toast.LENGTH_SHORT).show();
mCurFragmentNum = 2; mCurFragmentNum = 2;
mCurFragment = new PrefsFragment(); mCurFragment = new PrefsFragment();
FragmentManager fragmentManager = getFragmentManager(); FragmentManager fragmentManager = getFragmentManager();
@ -197,7 +197,7 @@ public class GameListActivity extends Activity
break; break;
case 3: case 3:
{ {
Toast.makeText(mMe, "Loading up gamepad config", Toast.LENGTH_SHORT).show(); Toast.makeText(mMe, getString(R.string.loading_gamepad), Toast.LENGTH_SHORT).show();
mCurFragmentNum = 3; mCurFragmentNum = 3;
mCurFragment = new InputConfigFragment(); mCurFragment = new InputConfigFragment();
FragmentManager fragmentManager = getFragmentManager(); FragmentManager fragmentManager = getFragmentManager();
@ -206,7 +206,7 @@ public class GameListActivity extends Activity
break; break;
case 4: case 4:
{ {
Toast.makeText(mMe, "Loading up About", Toast.LENGTH_SHORT).show(); Toast.makeText(mMe, getString(R.string.about), Toast.LENGTH_SHORT).show();
mCurFragmentNum = 4; mCurFragmentNum = 4;
mCurFragment = new AboutFragment(); mCurFragment = new AboutFragment();
FragmentManager fragmentManager = getFragmentManager(); FragmentManager fragmentManager = getFragmentManager();

View File

@ -63,7 +63,7 @@ public class GameListFragment extends Fragment
if(!entry.isDirectory()) if(!entry.isDirectory())
{ {
if (exts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) if (exts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
fls.add(new GameListItem(mMe.getApplicationContext(), entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), true)); fls.add(new GameListItem(mMe.getApplicationContext(), entryName, getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), true));
} }
} }
} }
@ -96,7 +96,7 @@ public class GameListFragment extends Fragment
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
GameListItem o = mGameAdapter.getItem(position); GameListItem o = mGameAdapter.getItem(position);
if(!(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory"))) if(!(o.getData().equalsIgnoreCase(getString(R.string.folder))||o.getData().equalsIgnoreCase(getString(R.string.parent_directory))))
{ {
onFileClick(o.getPath()); onFileClick(o.getPath());
} }
@ -104,7 +104,7 @@ public class GameListFragment extends Fragment
}; };
private void onFileClick(String o) private void onFileClick(String o)
{ {
Toast.makeText(mMe, "File Clicked: " + o, Toast.LENGTH_SHORT).show(); Toast.makeText(mMe, getString(R.string.file_clicked) + o, Toast.LENGTH_SHORT).show();
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra("Select", o); intent.putExtra("Select", o);

View File

@ -47,27 +47,27 @@ public class InputConfigFragment extends Fragment
Bundle savedInstanceState) Bundle savedInstanceState)
{ {
List<InputConfigItem> Input = new ArrayList<InputConfigItem>(); List<InputConfigItem> Input = new ArrayList<InputConfigItem>();
Input.add(new InputConfigItem("Draw on-screen controls", "Android-ScreenControls", "True")); Input.add(new InputConfigItem(getString(R.string.draw_onscreen_controls), "Android-ScreenControls", "True"));
Input.add(new InputConfigItem("Button A", "Android-InputA")); Input.add(new InputConfigItem(getString(R.string.button_a), "Android-InputA"));
Input.add(new InputConfigItem("Button B", "Android-InputB")); Input.add(new InputConfigItem(getString(R.string.button_b), "Android-InputB"));
Input.add(new InputConfigItem("Button Start", "Android-InputStart")); Input.add(new InputConfigItem(getString(R.string.button_start), "Android-InputStart"));
Input.add(new InputConfigItem("Button X", "Android-InputX")); Input.add(new InputConfigItem(getString(R.string.button_x), "Android-InputX"));
Input.add(new InputConfigItem("Button Y", "Android-InputY")); Input.add(new InputConfigItem(getString(R.string.button_y), "Android-InputY"));
Input.add(new InputConfigItem("Button Z", "Android-InputZ")); Input.add(new InputConfigItem(getString(R.string.button_z), "Android-InputZ"));
Input.add(new InputConfigItem("D-Pad Up", "Android-DPadUp")); Input.add(new InputConfigItem(getString(R.string.dpad_up), "Android-DPadUp"));
Input.add(new InputConfigItem("D-Pad Down", "Android-DPadDown")); Input.add(new InputConfigItem(getString(R.string.dpad_down), "Android-DPadDown"));
Input.add(new InputConfigItem("D-Pad Left", "Android-DPadLeft")); Input.add(new InputConfigItem(getString(R.string.dpad_left), "Android-DPadLeft"));
Input.add(new InputConfigItem("D-Pad Right", "Android-DPadRight")); Input.add(new InputConfigItem(getString(R.string.dpad_right), "Android-DPadRight"));
Input.add(new InputConfigItem("Main Stick Up", "Android-MainUp")); Input.add(new InputConfigItem(getString(R.string.main_stick_up), "Android-MainUp"));
Input.add(new InputConfigItem("Main Stick Down", "Android-MainDown")); Input.add(new InputConfigItem(getString(R.string.main_stick_down), "Android-MainDown"));
Input.add(new InputConfigItem("Main Stick Left", "Android-MainLeft")); Input.add(new InputConfigItem(getString(R.string.main_stick_left), "Android-MainLeft"));
Input.add(new InputConfigItem("Main Stick Right", "Android-MainRight")); Input.add(new InputConfigItem(getString(R.string.main_stick_right), "Android-MainRight"));
Input.add(new InputConfigItem("C Stick Up", "Android-CStickUp")); Input.add(new InputConfigItem(getString(R.string.c_stick_up), "Android-CStickUp"));
Input.add(new InputConfigItem("C Stick Down", "Android-CStickDown")); Input.add(new InputConfigItem(getString(R.string.c_stick_down), "Android-CStickDown"));
Input.add(new InputConfigItem("C Stick Left", "Android-CStickLeft")); Input.add(new InputConfigItem(getString(R.string.c_stick_left), "Android-CStickLeft"));
Input.add(new InputConfigItem("C Stick Right", "Android-CStickRight")); Input.add(new InputConfigItem(getString(R.string.c_stick_right), "Android-CStickRight"));
Input.add(new InputConfigItem("Trigger L", "Android-InputL")); Input.add(new InputConfigItem(getString(R.string.trigger_left), "Android-InputL"));
Input.add(new InputConfigItem("Trigger R", "Android-InputR")); Input.add(new InputConfigItem(getString(R.string.trigger_right), "Android-InputR"));
adapter = new InputConfigAdapter(m_activity, R.layout.folderbrowser, Input); adapter = new InputConfigAdapter(m_activity, R.layout.folderbrowser, Input);
View rootView = inflater.inflate(R.layout.gamelist_listview, container, false); View rootView = inflater.inflate(R.layout.gamelist_listview, container, false);
@ -88,12 +88,12 @@ public class InputConfigFragment extends Fragment
String newBind; String newBind;
if (o.getBind().equals("True")) if (o.getBind().equals("True"))
{ {
Toast.makeText(m_activity, "Not Drawing on screen controls", Toast.LENGTH_SHORT).show(); Toast.makeText(m_activity, getString(R.string.not_drawing_onscreen_controls), Toast.LENGTH_SHORT).show();
newBind = "False"; newBind = "False";
} }
else else
{ {
Toast.makeText(m_activity, "Drawing on screen controls", Toast.LENGTH_SHORT).show(); Toast.makeText(m_activity, getString(R.string.drawing_onscreen_controls), Toast.LENGTH_SHORT).show();
newBind = "True"; newBind = "True";
} }
adapter.remove(o); adapter.remove(o);
@ -101,7 +101,8 @@ public class InputConfigFragment extends Fragment
adapter.insert(o, position); adapter.insert(o, position);
break; break;
default: // gamepad controls default: // gamepad controls
Toast.makeText(m_activity, "Press button to configure " + o.getName(), Toast.LENGTH_SHORT).show();
Toast.makeText(m_activity, getString(R.string.press_button_to_config, o.getName()), Toast.LENGTH_SHORT).show();
configPosition = position; configPosition = position;
Configuring = true; Configuring = true;
firstEvent = true; firstEvent = true;
@ -136,9 +137,12 @@ public class InputConfigFragment extends Fragment
if (firstEvent) if (firstEvent)
{ {
m_values.clear(); m_values.clear();
for (InputDevice.MotionRange range : motions) {
for (InputDevice.MotionRange range : motions)
{
m_values.add(event.getAxisValue(range.getAxis())); m_values.add(event.getAxisValue(range.getAxis()));
} }
firstEvent = false; firstEvent = false;
} }
else else
@ -164,7 +168,7 @@ public class InputConfigFragment extends Fragment
} }
public boolean onKeyEvent(KeyEvent event) public boolean onKeyEvent(KeyEvent event)
{ {
Log.w("Dolphinemu", "Got Event " + event.getAction()); Log.w("InputConfigFragment", "Got Event " + event.getAction());
switch (event.getAction()) { switch (event.getAction()) {
case KeyEvent.ACTION_DOWN: case KeyEvent.ACTION_DOWN:
case KeyEvent.ACTION_UP: case KeyEvent.ACTION_UP:

View File

@ -10,24 +10,24 @@ public class InputConfigItem implements Comparable<InputConfigItem>{
private String m_Config; private String m_Config;
private String m_bind; private String m_bind;
private void Init(String n, String c, String d) private void Init(String name, String config, String defaultBind)
{ {
m_name = n; m_name = name;
m_Config = c; m_Config = config;
String ConfigValues[] = m_Config.split("-"); String ConfigValues[] = m_Config.split("-");
String Key = ConfigValues[0]; String Key = ConfigValues[0];
String Value = ConfigValues[1]; String Value = ConfigValues[1];
m_bind = NativeLibrary.GetConfig("Dolphin.ini", Key, Value, d); m_bind = NativeLibrary.GetConfig("Dolphin.ini", Key, Value, defaultBind);
} }
public InputConfigItem(String n, String c, String d) public InputConfigItem(String name, String config, String defaultBind)
{ {
Init(n, c, d); Init(name, config, defaultBind);
} }
public InputConfigItem(String n, String c) public InputConfigItem(String name, String config)
{ {
Init(n, c, "None"); Init(name, config, "None");
} }
public String getName() public String getName()
{ {
@ -41,9 +41,9 @@ public class InputConfigItem implements Comparable<InputConfigItem>{
{ {
return m_bind; return m_bind;
} }
public void setBind(String b) public void setBind(String bind)
{ {
m_bind = b; m_bind = bind;
} }
public int compareTo(InputConfigItem o) public int compareTo(InputConfigItem o)

View File

@ -144,18 +144,18 @@ public class PrefsFragment extends PreferenceFragment {
if (Build.CPU_ABI.contains("x86")) if (Build.CPU_ABI.contains("x86"))
{ {
entries.put("Interpreter", "0"); entries.put(getString(R.string.interpreter), "0");
entries.put("JIT64 Recompiler", "1"); entries.put(getString(R.string.jit64_recompiler), "1");
entries.put("JITIL Recompiler", "2"); entries.put(getString(R.string.jitil_recompiler), "2");
} }
else if (Build.CPU_ABI.contains("arm")) else if (Build.CPU_ABI.contains("arm"))
{ {
entries.put("Interpreter", "0"); entries.put(getString(R.string.interpreter), "0");
entries.put("JIT ARM Recompiler", "3"); entries.put(getString(R.string.jit_arm_recompiler), "3");
} }
else else
{ {
entries.put("Interpreter", "0"); entries.put(getString(R.string.interpreter), "0");
} }
// Convert the key/value sections to arrays respectively so the list can be set. // Convert the key/value sections to arrays respectively so the list can be set.
@ -163,8 +163,8 @@ public class PrefsFragment extends PreferenceFragment {
etp.setEntries(entries.keySet().toArray(new CharSequence[entries.size()])); etp.setEntries(entries.keySet().toArray(new CharSequence[entries.size()]));
etp.setEntryValues(entries.values().toArray(new CharSequence[entries.size()])); etp.setEntryValues(entries.values().toArray(new CharSequence[entries.size()]));
etp.setKey("cpupref"); etp.setKey("cpupref");
etp.setTitle("CPU Core"); etp.setTitle(getString(R.string.cpu_core));
etp.setSummary("Emulation core to use"); etp.setSummary(getString(R.string.emu_core_to_use));
PreferenceCategory mCategory = (PreferenceCategory) findPreference("cpuprefcat"); PreferenceCategory mCategory = (PreferenceCategory) findPreference("cpuprefcat");
mCategory.addPreference(etp); mCategory.addPreference(etp);
@ -181,11 +181,11 @@ public class PrefsFragment extends PreferenceFragment {
// Add available graphics renderers to the hashmap to add to the list. // Add available graphics renderers to the hashmap to add to the list.
entries.clear(); entries.clear();
entries.put("Software Renderer", "Software Renderer"); // TODO: I think this is a bug? The value shouldn't be the same as the key? entries.put(getString(R.string.software_renderer), "Software Renderer");
videobackend.setKey("gpupref"); videobackend.setKey("gpupref");
videobackend.setTitle("Video Backend"); videobackend.setTitle(getString(R.string.video_backend));
videobackend.setSummary("Video backend to use"); videobackend.setSummary(getString(R.string.video_backend_to_use));
videobackend.setEntries(entries.keySet().toArray(new CharSequence[entries.size()])); videobackend.setEntries(entries.keySet().toArray(new CharSequence[entries.size()]));
videobackend.setEntryValues(entries.values().toArray(new CharSequence[entries.size()])); videobackend.setEntryValues(entries.values().toArray(new CharSequence[entries.size()]));