Add variable app name in res strings

Closes #3988
This commit is contained in:
mimi89999 2021-02-08 16:03:30 +01:00 committed by Daniel Gultsch
parent b6d62c13ef
commit d51b4380d7
13 changed files with 28 additions and 42 deletions

View File

@ -136,7 +136,7 @@ public class NotificationService {
final NotificationChannel foregroundServiceChannel = new NotificationChannel("foreground",
c.getString(R.string.foreground_service_channel_name),
NotificationManager.IMPORTANCE_MIN);
foregroundServiceChannel.setDescription(c.getString(R.string.foreground_service_channel_description));
foregroundServiceChannel.setDescription(c.getString(R.string.foreground_service_channel_description, c.getString(R.string.app_name)));
foregroundServiceChannel.setShowBadge(false);
foregroundServiceChannel.setGroup("status");
notificationManager.createNotificationChannel(foregroundServiceChannel);

View File

@ -1571,7 +1571,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} else {
res = R.string.no_storage_permission;
}
Toast.makeText(getActivity(), res, Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(), getString(res, getString(R.string.app_name)), Toast.LENGTH_SHORT).show();
}
}
if (writeGranted(grantResults, permissions)) {
@ -3043,4 +3043,4 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
activity.switchToAccount(message.getConversation().getAccount(), fingerprint);
}
}
}

View File

@ -224,7 +224,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
&& getPreferences().getBoolean(getBatteryOptimizationPreferenceKey(), true)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.battery_optimizations_enabled);
builder.setMessage(R.string.battery_optimizations_enabled_dialog);
builder.setMessage(getString(R.string.battery_optimizations_enabled_dialog, getString(R.string.app_name)));
builder.setPositiveButton(R.string.next, (dialog, which) -> {
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
Uri uri = Uri.parse("package:" + getPackageName());

View File

@ -1209,7 +1209,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.binding.osOptimization.setVisibility(showBatteryWarning || showDataSaverWarning ? View.VISIBLE : View.GONE);
if (showDataSaverWarning && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
this.binding.osOptimizationHeadline.setText(R.string.data_saver_enabled);
this.binding.osOptimizationBody.setText(R.string.data_saver_enabled_explained);
this.binding.osOptimizationBody.setText(getString(R.string.data_saver_enabled_explained, getString(R.string.app_name)));
this.binding.osOptimizationDisable.setText(R.string.allow);
this.binding.osOptimizationDisable.setOnClickListener(v -> {
Intent intent = new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS);
@ -1218,13 +1218,13 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
try {
startActivityForResult(intent, REQUEST_DATA_SAVER);
} catch (ActivityNotFoundException e) {
Toast.makeText(EditAccountActivity.this, R.string.device_does_not_support_data_saver, Toast.LENGTH_SHORT).show();
Toast.makeText(EditAccountActivity.this, getString(R.string.device_does_not_support_data_saver, getString(R.string.app_name)), Toast.LENGTH_SHORT).show();
}
});
} else if (showBatteryWarning && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
this.binding.osOptimizationDisable.setText(R.string.disable);
this.binding.osOptimizationHeadline.setText(R.string.battery_optimizations_enabled);
this.binding.osOptimizationBody.setText(R.string.battery_optimizations_enabled_explained);
this.binding.osOptimizationBody.setText(getString(R.string.battery_optimizations_enabled_explained, getString(R.string.app_name)));
this.binding.osOptimizationDisable.setOnClickListener(v -> {
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
Uri uri = Uri.parse("package:" + getPackageName());

View File

@ -421,7 +421,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
} else {
throw new IllegalStateException("Invalid permission result request");
}
Toast.makeText(this, res, Toast.LENGTH_SHORT).show();
Toast.makeText(this, getString(res, getString(R.string.app_name)), Toast.LENGTH_SHORT).show();
}
}

View File

@ -405,7 +405,7 @@ public class SettingsActivity extends XmppActivity implements
createBackup();
}
} else {
Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
Toast.makeText(this, getString(R.string.no_storage_permission, getString(R.string.app_name)), Toast.LENGTH_SHORT).show();
}
}

View File

@ -75,7 +75,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
}
}
} else {
Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
Toast.makeText(this, getString(R.string.no_storage_permission, getString(R.string.app_name)), Toast.LENGTH_SHORT).show();
}
}

View File

@ -737,7 +737,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
if (QuickConversationsService.isQuicksy()) {
builder.setMessage(Html.fromHtml(getString(R.string.sync_with_contacts_quicksy)));
} else {
builder.setMessage(R.string.sync_with_contacts_long);
builder.setMessage(getString(R.string.sync_with_contacts_long, getString(R.string.app_name)));
}
builder.setPositiveButton(R.string.next, (dialog, which) -> requestPermissions(new String[]{Manifest.permission.READ_CONTACTS}, REQUEST_SYNC_CONTACTS));
builder.setOnDismissListener(dialog -> requestPermissions(new String[]{Manifest.permission.READ_CONTACTS}, REQUEST_SYNC_CONTACTS));

View File

@ -237,7 +237,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
}
this.binding.keyErrorHintMutual.setVisibility(anyWithoutMutualPresenceSubscription ? View.VISIBLE : View.GONE);
Contact contact = mAccount.getRoster().getContact(contactJids.get(0));
binding.keyErrorGeneral.setText(getString(R.string.error_trustkey_general, contact.getDisplayName()));
binding.keyErrorGeneral.setText(getString(R.string.error_trustkey_general, getString(R.string.app_name), contact.getDisplayName()));
binding.ownKeysDetails.removeAllViews();
if (OmemoSetting.isAlways()) {
binding.disableButton.setVisibility(View.GONE);

View File

@ -248,7 +248,7 @@ public abstract class XmppActivity extends ActionBarActivity {
Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.openkeychain_required));
builder.setIconAttribute(android.R.attr.alertDialogIcon);
builder.setMessage(getText(R.string.openkeychain_required_long));
builder.setMessage(getString(R.string.openkeychain_required_long, getString(R.string.app_name)));
builder.setNegativeButton(getString(R.string.cancel), null);
builder.setNeutralButton(getString(R.string.restart),
(dialog, which) -> {

View File

@ -84,8 +84,8 @@ public class ExceptionHelper {
file.close();
activity.deleteFile(FILENAME);
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(activity.getString(R.string.crash_report_title));
builder.setMessage(activity.getText(R.string.crash_report_message));
builder.setTitle(activity.getString(R.string.crash_report_title, activity.getString(R.string.app_name)));
builder.setMessage(activity.getString(R.string.crash_report_message, activity.getString(R.string.app_name)));
builder.setPositiveButton(activity.getText(R.string.send_now), (dialog, which) -> {
Log.d(Config.LOGTAG, "using account=" + account.getJid().asBareJid() + " to send in stack trace");

View File

@ -69,8 +69,8 @@
<string name="unblock">Unblock</string>
<string name="save">Save</string>
<string name="ok">OK</string>
<string name="crash_report_title">Conversations has crashed</string>
<string name="crash_report_message">Using your XMPP account to send in stack traces helps the ongoing development of Conversations.</string>
<string name="crash_report_title">%1$s has crashed</string>
<string name="crash_report_message">Using your XMPP account to send in stack traces helps the ongoing development of %1$s.</string>
<string name="send_now">Send now</string>
<string name="send_never">Never ask again</string>
<string name="problem_connecting_to_account">Could not connect to account</string>
@ -100,7 +100,7 @@
<string name="send_unencrypted">Send unencrypted</string>
<string name="decryption_failed">Decryption failed. Maybe you dont have the proper private key.</string>
<string name="openkeychain_required">OpenKeychain</string>
<string name="openkeychain_required_long">Conversations uses <b>OpenKeychain</b> to encrypt and decrypt messages and manage your public keys.\n\nIt is licensed under GPLv3+ and available on F-Droid and Google Play.\n\n<small>(Please restart Conversations afterwards.)</small></string>
<string name="openkeychain_required_long">%1$s uses <b>OpenKeychain</b> to encrypt and decrypt messages and manage your public keys.\n\nIt is licensed under GPLv3+ and available on F-Droid and Google Play.\n\n<small>(Please restart %1$s afterwards.)</small></string>
<string name="restart">Restart</string>
<string name="install">Install</string>
<string name="openkeychain_not_installed">Please install OpenKeychain</string>
@ -504,10 +504,10 @@
<string name="shared_image_with_x">Image shared with %s</string>
<string name="shared_images_with_x">Images shared with %s</string>
<string name="shared_text_with_x">Text shared with %s</string>
<string name="no_storage_permission">Grant Conversations access to external storage</string>
<string name="no_camera_permission">Grant Conversations access to the camera</string>
<string name="no_storage_permission">Grant %1$s access to external storage</string>
<string name="no_camera_permission">Grant %1$s access to the camera</string>
<string name="sync_with_contacts">Synchronize with contacts</string>
<string name="sync_with_contacts_long">Conversations wants permission to access your contacts to match your XMPP contact list with your contacts to show their full names and avatars.\n\nIt will only read your contacts and match them locally without uploading them to your server.</string>
<string name="sync_with_contacts_long">%1$s wants permission to access your contacts to match your XMPP contact list with your contacts to show their full names and avatars.\n\nIt will only read your contacts and match them locally without uploading them to your server.</string>
<string name="sync_with_contacts_quicksy"><![CDATA[Quicksy needs access to your contacts phone numbers to make suggestions about possible contacts who are already on Quicksy.<br><br>We will not store a copy of those phone numbers.\n\nFor more information read our <a href="https://quicksy.im/#privacy">privacy policy</a>.<br><br>You will now be asked to grant permission to access your contacts.]]></string>
<string name="notify_on_all_messages">Notify on all messages</string>
<string name="notify_only_when_highlighted">Notify only when mentioned</string>
@ -518,8 +518,8 @@
<string name="always">Always</string>
<string name="large_images_only">Large images only</string>
<string name="battery_optimizations_enabled">Battery optimizations enabled</string>
<string name="battery_optimizations_enabled_explained">Your device is employing heavy battery optimizations for Conversations which may lead to delayed notifications or even message loss.\nIt is recommended to disable them.</string>
<string name="battery_optimizations_enabled_dialog">Your device is employing heavy battery optimizations for Conversations which may lead to delayed notifications or even message loss.\n\nYou will now be asked to disable them.</string>
<string name="battery_optimizations_enabled_explained">Your device is employing heavy battery optimizations for %1$s which may lead to delayed notifications or even message loss.\nIt is recommended to disable them.</string>
<string name="battery_optimizations_enabled_dialog">Your device is employing heavy battery optimizations for %1$s which may lead to delayed notifications or even message loss.\n\nYou will now be asked to disable them.</string>
<string name="disable">Disable</string>
<string name="selection_too_large">The selected area is too large</string>
<string name="no_accounts">(No activated accounts)</string>
@ -593,8 +593,8 @@
<string name="show_error_message">Show error message</string>
<string name="error_message">Error Message</string>
<string name="data_saver_enabled">Data saver enabled</string>
<string name="data_saver_enabled_explained">Your operating system is restricting Conversations from accessing the Internet when in background. To receive notifications of new messages you should allow Conversations unrestricted access when “Data saver” is on.\nConversations will still make an effort to save data when possible.</string>
<string name="device_does_not_support_data_saver">Your device does not support disabling Data saver for Conversations.</string>
<string name="data_saver_enabled_explained">Your operating system is restricting %1$s from accessing the Internet when in background. To receive notifications of new messages you should allow Conversations unrestricted access when “Data saver” is on.\nConversations will still make an effort to save data when possible.</string>
<string name="device_does_not_support_data_saver">Your device does not support disabling Data saver for %1$s.</string>
<string name="error_unable_to_create_temporary_file">Could not create temporary file</string>
<string name="this_device_has_been_verified">This device has been verified</string>
<string name="copy_fingerprint">Copy fingerprint</string>
@ -693,7 +693,7 @@
<string name="edit_status_message_title">Edit Status Message</string>
<string name="edit_status_message">Edit status message</string>
<string name="disable_encryption">Disable encryption</string>
<string name="error_trustkey_general">Conversations is unable to send encrypted messages to %1$s. This may be due to your contact using an outdated server or client that can not handle OMEMO.</string>
<string name="error_trustkey_general">%1$s is unable to send encrypted messages to %2$s. This may be due to your contact using an outdated server or client that can not handle OMEMO.</string>
<string name="error_trustkey_device_list">Could not fetch device list</string>
<string name="error_trustkey_bundle">Could not fetch encryption keys</string>
<string name="error_trustkey_hint_mutual">Hint: In some cases this can be fixed by adding each other your contact lists.</string>
@ -726,7 +726,7 @@
<string name="share">Share</string>
<string name="unable_to_start_recording">Could not start recording</string>
<string name="please_wait">Please wait…</string>
<string name="no_microphone_permission">Grant Conversations access to the microphone</string>
<string name="no_microphone_permission">Grant %1$s access to the microphone</string>
<string name="search_messages">Search messages</string>
<string name="gif">GIF</string>
<string name="view_conversation">View conversation</string>
@ -748,7 +748,7 @@
<string name="conference_destroyed">This group chat has been destroyed</string>
<string name="unable_to_save_recording">Could not save recording</string>
<string name="foreground_service_channel_name">Foreground service</string>
<string name="foreground_service_channel_description">This notification category is used to display a permanent notification indicating that Conversations is running.</string>
<string name="foreground_service_channel_description">This notification category is used to display a permanent notification indicating that %1$s is running.</string>
<string name="notification_group_status_information">Status Information</string>
<string name="error_channel_name">Connectivity Problems</string>
<string name="error_channel_description">This notification category is used to display a notification in case there is a problem connecting to an account.</string>

View File

@ -1,23 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="crash_report_title">Quicksy has crashed</string>
<string name="crash_report_message">By sending in stack traces you are helping the ongoing development of Quicksy\n<b>Warning:</b> This will use your XMPP account to send the stack trace to the developer.</string>
<string name="openkeychain_required_long">Quicksy utilizes a third party app called <b>OpenKeychain</b> to encrypt and decrypt messages and to manage your public keys.\n\nOpenKeychain is licensed under GPLv3 and available on F-Droid and Google Play.\n\n<small>(Please restart Quicksy afterwards.)</small></string>
<string name="contact_has_no_pgp_key">Quicksy is unable to encrypt your messages because your contact is not announcing his or hers public key.\n\n<small>Please ask your contact to setup OpenPGP.</small></string>
<string name="contacts_have_no_pgp_keys">Quicksy is unable to encrypt your messages because your contacts are not announcing their public key.\n\n<small>Please ask your contacts to setup OpenPGP.</small></string>
<string name="pref_notification_grace_period_summary">The length of time Quicksy keeps quiet after seeing activity on another device</string>
<string name="pref_never_send_crash_summary">By sending in stack traces you are helping the ongoing development of Quicksy</string>
<string name="no_storage_permission">Quicksy needs access to external storage</string>
<string name="no_camera_permission">Quicksy needs access to the camera</string>
<string name="battery_optimizations_enabled_explained">Your device is employing heavy battery optimizations for Quicksy which may lead to delayed notifications or even message loss.\nIt is recommended to disable them.</string>
<string name="battery_optimizations_enabled_dialog">Your device is employing heavy battery optimizations for Quicksy which may lead to delayed notifications or even message loss.\n\nYou will now be asked to disable them.</string>
<string name="pref_broadcast_last_activity_summary">Let all your contacts know when you use Quicksy</string>
<string name="data_saver_enabled_explained">Your operating system is restricting Quicksy from accessing the Internet when in background. To receive notifications of new messages you should allow Quicksy unrestricted access when Data saver is on.\nQuicksy will still make an effort to save data when possible.</string>
<string name="device_does_not_support_data_saver">Your device does not support disabling Data saver for Quicksy.</string>
<string name="huawei_protected_apps_summary">To keep receiving notifications, even when the screen is turned off, you need to add Quicksy to the list of protected apps.</string>
<string name="error_trustkey_general">Quicksy is unable to send encrypted messages to %1$s. This may be due to your contact using an outdated server or client that can not handle OMEMO.</string>
<string name="no_microphone_permission">Quicksy needs access to the microphone</string>
<string name="foreground_service_channel_description">This notification category is used to display a permanent notification indicating that Quicksy is running.</string>
<string name="set_profile_picture">Quicksy profile picture</string>
<string name="not_available_in_your_country">Quicksy is not available in your country.</string>
<string name="unable_to_verify_server_identity">Unable to verify server identity.</string>