Android: Clean up some hardcoded strings

These would lead to problems if we ever add translation support.
This commit is contained in:
JosJuice 2021-06-22 14:21:33 +02:00
parent 1b3f05628b
commit 5b8fe1e748
9 changed files with 31 additions and 17 deletions

View File

@ -74,7 +74,7 @@
android:exported="false"
android:configChanges="orientation|screenSize"
android:theme="@style/DolphinSettingsBase"
android:label="@string/preferences_settings"/>
android:label="@string/settings"/>
<activity
android:name=".activities.EmulationActivity"

View File

@ -90,7 +90,8 @@ public final class GameDetailsDialog extends DialogFragment
long blockSize = gameFile.getBlockSize();
String compression = gameFile.getCompressionMethod();
textFileFormat.setText(String.format("%1$s (%2$s)", gameFile.getFileFormatName(), fileSize));
textFileFormat.setText(getResources().getString(R.string.game_details_size_and_format,
gameFile.getFileFormatName(), fileSize));
if (compression.isEmpty())
{

View File

@ -96,7 +96,7 @@ public class GamePropertiesDialog extends DialogFragment
R.style.DolphinDialogBase);
itemsBuilder.applyToBuilder(builder);
builder.setTitle(requireContext()
.getString(R.string.preferences_game_properties) + ": " + gameId);
.getString(R.string.preferences_game_properties_with_game_id, gameId));
return builder.create();
}
@ -113,18 +113,20 @@ public class GamePropertiesDialog extends DialogFragment
{
if (gameSettingsFile.delete() || hadGameProfiles)
{
Toast.makeText(getContext(), "Cleared settings for " + gameId, Toast.LENGTH_SHORT)
.show();
Toast.makeText(getContext(),
getResources().getString(R.string.properties_clear_success, gameId),
Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(getContext(), "Unable to clear settings for " + gameId,
Toast.makeText(getContext(),
getResources().getString(R.string.properties_clear_failure, gameId),
Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(getContext(), "No game settings to delete", Toast.LENGTH_SHORT).show();
Toast.makeText(getContext(), R.string.properties_clear_missing, Toast.LENGTH_SHORT).show();
}
}

View File

@ -5,6 +5,7 @@ import android.text.TextUtils;
import android.widget.Toast;
import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivityView;
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
import org.dolphinemu.dolphinemu.services.GameFileCacheService;
@ -207,7 +208,7 @@ public class Settings implements Closeable
if (!isGameSpecific())
{
if (context != null)
Toast.makeText(context, "Saved settings to INI files", Toast.LENGTH_SHORT).show();
Toast.makeText(context, R.string.settings_saved, Toast.LENGTH_SHORT).show();
for (Map.Entry<String, IniFile> entry : mIniFiles.entrySet())
{
@ -238,7 +239,10 @@ public class Settings implements Closeable
// custom game settings
if (context != null)
Toast.makeText(context, "Saved settings for " + mGameId, Toast.LENGTH_SHORT).show();
{
Toast.makeText(context, context.getString(R.string.settings_saved_game_specific, mGameId),
Toast.LENGTH_SHORT).show();
}
SettingsFile.saveCustomGameSettings(mGameId, getGameSpecificFile());

View File

@ -170,7 +170,7 @@ public final class SettingsActivityPresenter
break;
case 2:
mView.showToastMessage("Please make sure Continuous Scanning is enabled in Core Settings.");
mView.showToastMessage(mContext.getString(R.string.make_sure_continuous_scan_enabled));
break;
}
}

View File

@ -35,7 +35,7 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
static
{
titles.put(MenuTag.SETTINGS, R.string.preferences_settings);
titles.put(MenuTag.SETTINGS, R.string.settings);
titles.put(MenuTag.CONFIG, R.string.config);
titles.put(MenuTag.CONFIG_GENERAL, R.string.general_submenu);
titles.put(MenuTag.CONFIG_INTERFACE, R.string.interface_submenu);

View File

@ -121,7 +121,7 @@ public final class SettingsFragmentPresenter
{
if (!TextUtils.isEmpty(mGameID))
{
mView.getActivity().setTitle("Game Settings: " + mGameID);
mView.getActivity().setTitle(mContext.getString(R.string.game_settings, mGameID));
}
ArrayList<SettingsItem> sl = new ArrayList<>();
@ -217,8 +217,7 @@ public final class SettingsFragmentPresenter
break;
default:
mView.showToastMessage("Unimplemented menu");
return;
throw new UnsupportedOperationException("Unimplemented menu");
}
mSettingsList = sl;

View File

@ -388,8 +388,7 @@ public final class TvMainActivity extends FragmentActivity
R.string.grid_menu_import_nand_backup));
// Create a header for this row.
HeaderItem header =
new HeaderItem(R.string.preferences_settings, getString(R.string.preferences_settings));
HeaderItem header = new HeaderItem(R.string.settings, getString(R.string.settings));
return new ListRow(header, rowItems);
}

View File

@ -122,10 +122,14 @@
<string name="turntable_crossfade">Crossfade</string>
<!-- Main Preference Fragment -->
<string name="settings">Settings</string>
<string name="game_settings">Game Settings: %1$s</string>
<string name="config">Config</string>
<string name="graphics_settings">Graphics Settings</string>
<string name="gcpad_settings">GameCube Input</string>
<string name="wiimote_settings">Wii Input</string>
<string name="settings_saved">Saved settings to INI files</string>
<string name="settings_saved_game_specific">Saved settings for %1$s</string>
<!-- General Preference Fragment -->
<string name="general_submenu">General</string>
@ -354,9 +358,12 @@
<string name="properties_set_default_iso">Set as Default ISO</string>
<string name="properties_edit_game_settings">Edit Game Settings</string>
<string name="properties_clear_game_settings">Clear Game Settings</string>
<string name="properties_clear_success">Cleared settings for %1$s</string>
<string name="properties_clear_failure">Unable to clear settings for %1$s</string>
<string name="properties_clear_missing">No game settings to delete</string>
<string name="preferences_save_exit">Save and Exit</string>
<string name="preferences_settings">Settings</string>
<string name="preferences_game_properties">Game Properties</string>
<string name="preferences_game_properties_with_game_id">Game Properties: %1$s</string>
<string name="preferences_extensions">Extension Bindings</string>
<string name="game_ini_junk_title">Junk Data Found</string>
<string name="game_ini_junk_question">The settings file for this game contains extraneous data added by an old version of Dolphin. This will likely prevent global settings from working as intended.\n\nWould you like to fix this by deleting the settings file for this game? All game-specific settings and cheats that you have added will be removed. This cannot be undone.</string>
@ -369,6 +376,7 @@
<string name="game_details_compression">Compression</string>
<string name="game_details_block_size">Block Size</string>
<string name="game_details_no_compression">No Compression</string>
<string name="game_details_size_and_format">%1$s (%2$s)</string>
<!-- Convert Screen -->
<string name="convert_format">Format</string>
@ -468,5 +476,6 @@ It can efficiently compress both junk data and encrypted Wii data.
<string name="disc_number">Disc %1$d</string>
<string name="disabled_gc_overlay_notice">GameCube Controller 1 is set to \"None\"</string>
<string name="ignore_warning_alert_messages">Ignore for this session</string>
<string name="make_sure_continuous_scan_enabled">Please make sure Continuous Scanning is enabled in Core Settings.</string>
</resources>