vector-im/element-ios/issues/4899 - Replaced (*almost*) all NSLocalizedString calls with newly generated ObjC methods.

This commit is contained in:
Stefan Ceriu
2021-09-28 08:40:01 +03:00
committed by Stefan Ceriu
parent f5802395f5
commit 8b80b3f4c7
77 changed files with 1099 additions and 1108 deletions

View File

@@ -153,7 +153,7 @@ TableViewSectionsDelegate>
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.navigationItem.title = NSLocalizedStringFromTable(@"security_settings_title", @"Vector", nil);
self.navigationItem.title = [VectorL10n securitySettingsTitle];
// Remove back bar button title when pushing a view controller
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
@@ -294,11 +294,9 @@ TableViewSectionsDelegate>
// Header title
if ([PinCodePreferences shared].isBiometricsAvailable)
{
NSString *pinCodeSectionHeaderTitleFormat = NSLocalizedStringFromTable(@"pin_protection_settings_section_header_with_biometrics", @"Vector", nil);
NSString *pinCodeSectionHeaderTitle = [NSString stringWithFormat:pinCodeSectionHeaderTitleFormat, [PinCodePreferences shared].localizedBiometricsName];
pinCodeSection.headerTitle = pinCodeSectionHeaderTitle;
pinCodeSection.headerTitle = [VectorL10n pinProtectionSettingsSectionHeaderWithBiometrics:[PinCodePreferences shared].localizedBiometricsName];
} else {
pinCodeSection.headerTitle = NSLocalizedStringFromTable(@"pin_protection_settings_section_header", @"Vector", nil);;
pinCodeSection.headerTitle = [VectorL10n pinProtectionSettingsSectionHeader];
}
// Rows
@@ -323,7 +321,7 @@ TableViewSectionsDelegate>
{
Section *sessionsSection = [Section sectionWithTag:SECTION_CRYPTO_SESSIONS];
sessionsSection.headerTitle = NSLocalizedStringFromTable(@"security_settings_crypto_sessions", @"Vector", nil);
sessionsSection.headerTitle = [VectorL10n securitySettingsCryptoSessions];
NSUInteger sessionsSectionRowsCount;
@@ -344,7 +342,7 @@ TableViewSectionsDelegate>
// Secure backup
Section *secureBackupSection = [Section sectionWithTag:SECTION_SECURE_BACKUP];
secureBackupSection.headerTitle = NSLocalizedStringFromTable(@"security_settings_secure_backup", @"Vector", nil);
secureBackupSection.headerTitle = [VectorL10n securitySettingsSecureBackup];
[secureBackupSection addRowsWithCount:self->secureBackupSection.numberOfRows];
@@ -353,7 +351,7 @@ TableViewSectionsDelegate>
// Cross-Signing
Section *crossSigningSection = [Section sectionWithTag:SECTION_CROSSSIGNING];
crossSigningSection.headerTitle = NSLocalizedStringFromTable(@"security_settings_crosssigning", @"Vector", nil);
crossSigningSection.headerTitle = [VectorL10n securitySettingsCrosssigning];
[crossSigningSection addRowsWithCount:[self numberOfRowsInCrossSigningSection]];
@@ -362,7 +360,7 @@ TableViewSectionsDelegate>
// Cryptograhpy
Section *cryptograhpySection = [Section sectionWithTag:SECTION_CRYPTOGRAPHY];
cryptograhpySection.headerTitle = NSLocalizedStringFromTable(@"security_settings_cryptography", @"Vector", nil);
cryptograhpySection.headerTitle = [VectorL10n securitySettingsCryptography];
if (RiotSettings.shared.settingsSecurityScreenShowCryptographyInfo)
{
@@ -384,7 +382,7 @@ TableViewSectionsDelegate>
// Keybackup
Section *keybackupSection = [Section sectionWithTag:SECTION_KEYBACKUP];
keybackupSection.headerTitle = NSLocalizedStringFromTable(@"security_settings_backup", @"Vector", nil);
keybackupSection.headerTitle = [VectorL10n securitySettingsBackup];
[keybackupSection addRowsWithCount:self->keyBackupSection.numberOfRows];
@@ -395,7 +393,7 @@ TableViewSectionsDelegate>
// Advanced
Section *advancedSection = [Section sectionWithTag:SECTION_ADVANCED];
advancedSection.headerTitle = NSLocalizedStringFromTable(@"security_settings_advanced", @"Vector", nil);
advancedSection.headerTitle = [VectorL10n securitySettingsAdvanced];
if (RiotSettings.shared.settingsSecurityScreenShowAdvancedUnverifiedDevices)
{
@@ -479,7 +477,7 @@ TableViewSectionsDelegate>
// Crypto information
NSMutableAttributedString *cryptoInformationString = [[NSMutableAttributedString alloc]
initWithString:NSLocalizedStringFromTable(@"settings_crypto_device_name", @"Vector", nil)
initWithString:[VectorL10n settingsCryptoDeviceName]
attributes:@{NSForegroundColorAttributeName : ThemeService.shared.theme.textPrimaryColor,
NSFontAttributeName: [UIFont systemFontOfSize:17]}];
[cryptoInformationString appendAttributedString:[[NSMutableAttributedString alloc]
@@ -488,7 +486,7 @@ TableViewSectionsDelegate>
NSFontAttributeName: [UIFont systemFontOfSize:17]}]];
[cryptoInformationString appendAttributedString:[[NSMutableAttributedString alloc]
initWithString:NSLocalizedStringFromTable(@"settings_crypto_device_id", @"Vector", nil)
initWithString:[VectorL10n settingsCryptoDeviceId]
attributes:@{NSForegroundColorAttributeName : ThemeService.shared.theme.textPrimaryColor,
NSFontAttributeName: [UIFont systemFontOfSize:17]}]];
[cryptoInformationString appendAttributedString:[[NSMutableAttributedString alloc]
@@ -497,7 +495,7 @@ TableViewSectionsDelegate>
NSFontAttributeName: [UIFont systemFontOfSize:17]}]];
[cryptoInformationString appendAttributedString:[[NSMutableAttributedString alloc]
initWithString:NSLocalizedStringFromTable(@"settings_crypto_device_key", @"Vector", nil)
initWithString:[VectorL10n settingsCryptoDeviceKey]
attributes:@{NSForegroundColorAttributeName : ThemeService.shared.theme.textPrimaryColor,
NSFontAttributeName: [UIFont systemFontOfSize:17]}]];
NSString *fingerprint = account.mxSession.crypto.deviceEd25519Key;
@@ -669,16 +667,16 @@ TableViewSectionsDelegate>
switch (crossSigning.state)
{
case MXCrossSigningStateNotBootstrapped:
crossSigningInformation = [NSBundle mxk_localizedStringForKey:@"security_settings_crosssigning_info_not_bootstrapped"];
crossSigningInformation = [VectorL10n securitySettingsCrosssigningInfoNotBootstrapped];
break;
case MXCrossSigningStateCrossSigningExists:
crossSigningInformation = [NSBundle mxk_localizedStringForKey:@"security_settings_crosssigning_info_exists"];
crossSigningInformation = [VectorL10n securitySettingsCrosssigningInfoExists];
break;
case MXCrossSigningStateTrustCrossSigning:
crossSigningInformation = [NSBundle mxk_localizedStringForKey:@"security_settings_crosssigning_info_trusted"];
crossSigningInformation = [VectorL10n securitySettingsCrosssigningInfoTrusted];
break;
case MXCrossSigningStateCanCrossSign:
crossSigningInformation = [NSBundle mxk_localizedStringForKey:@"security_settings_crosssigning_info_ok"];
crossSigningInformation = [VectorL10n securitySettingsCrosssigningInfoOk];
if (![self.mainSession.crypto.recoveryService hasSecretLocally:MXSecretId.crossSigningMaster])
{
@@ -749,7 +747,7 @@ TableViewSectionsDelegate>
- (void)setUpcrossSigningButtonCellForBootstrap:(MXKTableViewCellWithButton*)buttonCell
{
NSString *btnTitle = [NSBundle mxk_localizedStringForKey:@"security_settings_crosssigning_bootstrap"];
NSString *btnTitle = [VectorL10n securitySettingsCrosssigningBootstrap];
[buttonCell.mxkButton setTitle:btnTitle forState:UIControlStateNormal];
[buttonCell.mxkButton setTitle:btnTitle forState:UIControlStateHighlighted];
@@ -759,7 +757,7 @@ TableViewSectionsDelegate>
- (void)setupCrossSigning:(id)sender
{
[self setupCrossSigningWithTitle:@"Set up cross-signing" // TODO
message:NSLocalizedStringFromTable(@"security_settings_user_password_description", @"Vector", nil)
message:[VectorL10n securitySettingsUserPasswordDescription]
success:^{
} failure:^(NSError *error) {
}];
@@ -823,7 +821,7 @@ TableViewSectionsDelegate>
[self setupCrossSigning:nil];
}]];
[alertController addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"]
[alertController addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
style:UIAlertActionStyleCancel
handler:nil]];
@@ -833,7 +831,7 @@ TableViewSectionsDelegate>
- (void)setUpcrossSigningButtonCellForReset:(MXKTableViewCellWithButton*)buttonCell
{
NSString *btnTitle = [NSBundle mxk_localizedStringForKey:@"security_settings_crosssigning_reset"];
NSString *btnTitle = [VectorL10n securitySettingsCrosssigningReset];
[buttonCell.mxkButton setTitle:btnTitle forState:UIControlStateNormal];
[buttonCell.mxkButton setTitle:btnTitle forState:UIControlStateHighlighted];
@@ -844,7 +842,7 @@ TableViewSectionsDelegate>
- (void)setUpcrossSigningButtonCellForCompletingSecurity:(MXKTableViewCellWithButton*)buttonCell
{
NSString *btnTitle = [NSBundle mxk_localizedStringForKey:@"security_settings_crosssigning_complete_security"];
NSString *btnTitle = [VectorL10n securitySettingsCrosssigningCompleteSecurity];
[buttonCell.mxkButton setTitle:btnTitle forState:UIControlStateNormal];
[buttonCell.mxkButton setTitle:btnTitle forState:UIControlStateHighlighted];
@@ -984,8 +982,8 @@ TableViewSectionsDelegate>
else
{
// Set up cross-signing first
[self setupCrossSigningWithTitle:NSLocalizedStringFromTable(@"secure_key_backup_setup_intro_title", @"Vector", nil)
message:NSLocalizedStringFromTable(@"security_settings_user_password_description", @"Vector", nil)
[self setupCrossSigningWithTitle:[VectorL10n secureKeyBackupSetupIntroTitle]
message:[VectorL10n securitySettingsUserPasswordDescription]
success:^{
[self setupSecureBackup2];
} failure:^(NSError *error) {
@@ -1205,13 +1203,13 @@ TableViewSectionsDelegate>
if ([PinCodePreferences shared].forcePinProtection)
{
cell = [self getDefaultTableViewCell:tableView];
cell.textLabel.text = NSLocalizedStringFromTable(@"pin_protection_settings_enabled_forced", @"Vector", nil);
cell.textLabel.text = [VectorL10n pinProtectionSettingsEnabledForced];
}
else
{
MXKTableViewCellWithLabelAndSwitch *switchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
switchCell.mxkLabel.text = NSLocalizedStringFromTable(@"pin_protection_settings_enable_pin", @"Vector", nil);
switchCell.mxkLabel.text = [VectorL10n pinProtectionSettingsEnablePin];
switchCell.mxkSwitch.on = [PinCodePreferences shared].isPinSet;
[switchCell.mxkSwitch addTarget:self action:@selector(enablePinCodeSwitchValueChanged:) forControlEvents:UIControlEventValueChanged];
@@ -1225,7 +1223,7 @@ TableViewSectionsDelegate>
if ([PinCodePreferences shared].isPinSet)
{
cell = [self descriptionCellForTableView:tableView
withText:NSLocalizedStringFromTable(@"pin_protection_settings_section_footer", @"Vector", nil) ];
withText:[VectorL10n pinProtectionSettingsSectionFooter]];
}
else
{
@@ -1234,14 +1232,13 @@ TableViewSectionsDelegate>
}
else if (rowTag == PIN_CODE_CHANGE)
{
cell = [self buttonCellWithTitle:NSLocalizedStringFromTable(@"pin_protection_settings_change_pin", @"Vector", nil) action:@selector(changePinCode: ) forTableView:tableView atIndexPath:indexPath];
cell = [self buttonCellWithTitle:[VectorL10n pinProtectionSettingsChangePin] action:@selector(changePinCode:) forTableView:tableView atIndexPath:indexPath];
}
else if (rowTag == PIN_CODE_BIOMETRICS)
{
MXKTableViewCellWithLabelAndSwitch *switchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
NSString *format = NSLocalizedStringFromTable(@"biometrics_settings_enable_x", @"Vector", nil);
switchCell.mxkLabel.text = [NSString stringWithFormat:format, [PinCodePreferences shared].localizedBiometricsName];
switchCell.mxkLabel.text = [VectorL10n biometricsSettingsEnableX:[PinCodePreferences shared].localizedBiometricsName];
switchCell.mxkSwitch.on = [PinCodePreferences shared].isBiometricsSet;
switchCell.mxkSwitch.enabled = [PinCodePreferences shared].isBiometricsAvailable;
[switchCell.mxkSwitch addTarget:self action:@selector(enableBiometricsSwitchValueChanged:) forControlEvents:UIControlEventValueChanged];
@@ -1256,12 +1253,12 @@ TableViewSectionsDelegate>
if (rowTag == 0)
{
cell = [self descriptionCellForTableView:tableView
withText:NSLocalizedStringFromTable(@"security_settings_crypto_sessions_loading", @"Vector", nil) ];
withText:[VectorL10n securitySettingsCryptoSessionsLoading]];
}
else
{
cell = [self descriptionCellForTableView:tableView
withText:NSLocalizedStringFromTable(@"security_settings_crypto_sessions_description_2", @"Vector", nil) ];
withText:[VectorL10n securitySettingsCryptoSessionsDescription2]];
}
}
else
@@ -1273,7 +1270,7 @@ TableViewSectionsDelegate>
else if (rowTag == devicesArray.count)
{
cell = [self descriptionCellForTableView:tableView
withText:NSLocalizedStringFromTable(@"security_settings_crypto_sessions_description_2", @"Vector", nil) ];
withText:[VectorL10n securitySettingsCryptoSessionsDescription2]];
}
}
@@ -1320,7 +1317,7 @@ TableViewSectionsDelegate>
}
case CRYPTOGRAPHY_EXPORT:
{
MXKTableViewCellWithButton *exportKeysBtnCell = [self buttonCellWithTitle:NSLocalizedStringFromTable(@"security_settings_export_keys_manually", @"Vector", nil)
MXKTableViewCellWithButton *exportKeysBtnCell = [self buttonCellWithTitle:[VectorL10n securitySettingsExportKeysManually]
action:@selector(exportEncryptionKeys:)
forTableView:tableView
atIndexPath:indexPath];
@@ -1337,7 +1334,7 @@ TableViewSectionsDelegate>
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"security_settings_blacklist_unverified_devices", @"Vector", nil);
labelAndSwitchCell.mxkLabel.text = [VectorL10n securitySettingsBlacklistUnverifiedDevices];
labelAndSwitchCell.mxkSwitch.on = session.crypto.globalBlacklistUnverifiedDevices;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
labelAndSwitchCell.mxkSwitch.enabled = YES;
@@ -1349,7 +1346,7 @@ TableViewSectionsDelegate>
case ADVANCED_BLACKLIST_UNVERIFIED_DEVICES_DESCRIPTION:
{
cell = [self descriptionCellForTableView:tableView
withText:NSLocalizedStringFromTable(@"security_settings_blacklist_unverified_devices_description", @"Vector", nil) ];
withText:[VectorL10n securitySettingsBlacklistUnverifiedDevicesDescription]];
break;
}
@@ -1474,17 +1471,17 @@ TableViewSectionsDelegate>
{
[currentAlert dismissViewControllerAnimated:NO completion:nil];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedStringFromTable(@"security_settings_complete_security_alert_title", @"Vector", nil)
message:NSLocalizedStringFromTable(@"security_settings_complete_security_alert_message", @"Vector", nil)
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[VectorL10n securitySettingsCompleteSecurityAlertTitle]
message:[VectorL10n securitySettingsCompleteSecurityAlertMessage]
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"]
[alertController addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self presentCompleteSecurity];
}]];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"later", @"Vector", nil)
[alertController addAction:[UIAlertAction actionWithTitle:[VectorL10n later]
style:UIAlertActionStyleCancel
handler:nil]];
@@ -1684,18 +1681,18 @@ TableViewSectionsDelegate>
[currentAlert dismissViewControllerAnimated:NO completion:nil];
currentAlert =
[UIAlertController alertControllerWithTitle:NSLocalizedStringFromTable(@"settings_key_backup_delete_confirmation_prompt_title", @"Vector", nil)
message:NSLocalizedStringFromTable(@"settings_key_backup_delete_confirmation_prompt_msg", @"Vector", nil)
[UIAlertController alertControllerWithTitle:[VectorL10n settingsKeyBackupDeleteConfirmationPromptTitle]
message:[VectorL10n settingsKeyBackupDeleteConfirmationPromptMsg]
preferredStyle:UIAlertControllerStyleAlert];
[currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"]
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
self->currentAlert = nil;
}]];
[currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"settings_key_backup_button_delete", @"Vector", nil)
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n settingsKeyBackupButtonDelete]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
@@ -1813,18 +1810,18 @@ TableViewSectionsDelegate>
[currentAlert dismissViewControllerAnimated:NO completion:nil];
currentAlert =
[UIAlertController alertControllerWithTitle:NSLocalizedStringFromTable(@"settings_key_backup_delete_confirmation_prompt_title", @"Vector", nil)
message:NSLocalizedStringFromTable(@"settings_key_backup_delete_confirmation_prompt_msg", @"Vector", nil)
[UIAlertController alertControllerWithTitle:[VectorL10n settingsKeyBackupDeleteConfirmationPromptTitle]
message:[VectorL10n settingsKeyBackupDeleteConfirmationPromptMsg]
preferredStyle:UIAlertControllerStyleAlert];
[currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"]
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
self->currentAlert = nil;
}]];
[currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"settings_key_backup_button_delete", @"Vector", nil)
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n settingsKeyBackupButtonDelete]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);