1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Use resource strings instead of hardcoding things

This commit is contained in:
cketti 2011-10-14 03:42:04 +02:00
parent b146fcb2fd
commit 5b81dbc2ed
2 changed files with 15 additions and 14 deletions

View File

@ -1037,6 +1037,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="settings_import_dialog_title">Import</string> <string name="settings_import_dialog_title">Import</string>
<string name="settings_export_dialog_title">Export</string> <string name="settings_export_dialog_title">Export</string>
<string name="settings_import">Import settings</string> <string name="settings_import">Import settings</string>
<string name="settings_import_selection">Import selection</string>
<string name="settings_import_global_settings">Global settings</string>
<string name="settings_exporting">Exporting settings...</string> <string name="settings_exporting">Exporting settings...</string>
<string name="settings_importing">Importing settings...</string> <string name="settings_importing">Importing settings...</string>
<string name="settings_import_scanning_file">Scanning file...</string> <string name="settings_import_scanning_file">Scanning file...</string>
@ -1046,8 +1048,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<item quantity="one">1 account</item> <item quantity="one">1 account</item>
<item quantity="other"><xliff:g id="numAccounts">%s</xliff:g> accounts</item> <item quantity="other"><xliff:g id="numAccounts">%s</xliff:g> accounts</item>
</plurals> </plurals>
<string name="settings_export_failure">Failed to export settings: <xliff:g id="reason">%s</xliff:g></string> <string name="settings_export_failure">Failed to export settings</string>
<string name="settings_import_failure">Failed to import settings from <xliff:g id="filename">%s</xliff:g>: <xliff:g id="reason">%s</xliff:g></string> <string name="settings_import_failure">Failed to import any settings from <xliff:g id="filename">%s</xliff:g></string>
<string name="settings_export_success_header">Export succeeded</string> <string name="settings_export_success_header">Export succeeded</string>
<string name="settings_export_failed_header">Export failed</string> <string name="settings_export_failed_header">Export failed</string>
<string name="settings_import_success_header">Import succeeded</string> <string name="settings_import_success_header">Import succeeded</string>

View File

@ -1010,8 +1010,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
List<String> contents = new ArrayList<String>(); List<String> contents = new ArrayList<String>();
if (mImportContents.globalSettings) { if (mImportContents.globalSettings) {
//TODO: read from resources contents.add(activity.getString(R.string.settings_import_global_settings));
contents.add("Global settings");
} }
for (AccountDescription account : mImportContents.accounts) { for (AccountDescription account : mImportContents.accounts) {
@ -1043,8 +1042,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
//TODO: listview footer: "Overwrite existing accounts?" checkbox //TODO: listview footer: "Overwrite existing accounts?" checkbox
final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
//TODO: read from resources builder.setTitle(activity.getString(R.string.settings_import_selection));
builder.setTitle("Import selection");
builder.setView(importSelectionView); builder.setView(importSelectionView);
builder.setInverseBackgroundForced(true); builder.setInverseBackgroundForced(true);
builder.setPositiveButton(R.string.okay_action, builder.setPositiveButton(R.string.okay_action,
@ -1383,9 +1381,9 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
activity.showSimpleDialog(R.string.settings_export_success_header, activity.showSimpleDialog(R.string.settings_export_success_header,
R.string.settings_export_success, mFileName); R.string.settings_export_success, mFileName);
} else { } else {
//TODO: make the exporter return an error code; translate that error code to a localized string here //TODO: better error messages
activity.showSimpleDialog(R.string.settings_export_failed_header, activity.showSimpleDialog(R.string.settings_export_failed_header,
R.string.settings_export_failure, "Something went wrong"); R.string.settings_export_failure);
} }
} }
} }
@ -1450,19 +1448,19 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
removeProgressDialog(); removeProgressDialog();
String filename = mUri.getLastPathSegment();
if (success) { if (success) {
int imported = mImportResults.importedAccounts.size(); int imported = mImportResults.importedAccounts.size();
//TODO: display names of imported accounts (name from file *and* possibly new name) //TODO: display names of imported accounts (name from file *and* possibly new name)
activity.showSimpleDialog(R.string.settings_import_success_header, activity.showSimpleDialog(R.string.settings_import_success_header,
//FIXME: use correct file name R.string.settings_import_success, imported, filename);
R.string.settings_import_success, imported, "filename");
activity.refresh(); activity.refresh();
} else { } else {
//TODO: make the importer return an error code; translate that error code to a localized string here //TODO: better error messages
activity.showSimpleDialog(R.string.settings_import_failed_header, activity.showSimpleDialog(R.string.settings_import_failed_header,
R.string.settings_import_failure, "unknown", "Something went wrong"); R.string.settings_import_failure, filename);
} }
} }
} }
@ -1522,9 +1520,10 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
if (success) { if (success) {
activity.showImportSelectionDialog(mImportContents, mUri, mEncryptionKey); activity.showImportSelectionDialog(mImportContents, mUri, mEncryptionKey);
} else { } else {
//TODO: make the importer return an error code; translate that error code to a localized string here String filename = mUri.getLastPathSegment();
//TODO: better error messages
activity.showSimpleDialog(R.string.settings_import_failed_header, activity.showSimpleDialog(R.string.settings_import_failed_header,
R.string.settings_import_failure, "unknown", "Something went wrong"); R.string.settings_import_failure, filename);
} }
} }
} }