From d5df3dc8290d9ff691e5d33b3c4d2166d8620a3c Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Mon, 27 Sep 2021 08:38:18 +0300 Subject: [PATCH] vector-im/element-ios/issues/4899 - Replaced all `[NSBundle mxk_localizedStringForKey]` usages with newly generated `MatrixKitL10n` --- MatrixKit.xcodeproj/project.pbxproj | 16 +- .../en.lproj/MatrixKit.strings | 1 + .../MXKAccountDetailsViewController.m | 65 ++--- .../MXKAttachmentsViewController.m | 12 +- .../MXKAuthenticationViewController.m | 144 ++++----- MatrixKit/Controllers/MXKCallViewController.m | 76 ++--- .../MXKContactListViewController.m | 6 +- .../MXKNotificationSettingsViewController.m | 46 +-- .../MXKRoomMemberDetailsViewController.m | 50 ++-- .../MXKRoomMemberListViewController.m | 10 +- .../MXKRoomSettingsViewController.m | 4 +- MatrixKit/Controllers/MXKRoomViewController.m | 70 ++--- .../Controllers/MXKSearchViewController.m | 4 +- .../Controllers/MXKWebViewViewController.m | 4 +- MatrixKit/Generated/Strings.swift | 4 + MatrixKit/Models/Account/MXKAccount.m | 12 +- MatrixKit/Models/Contact/MXKContactManager.m | 12 +- .../Models/Group/MXKSessionGroupsDataSource.m | 6 +- .../MXKDirectoryServerCellData.m | 4 +- .../MXKErrorAlertPresentation.m | 4 +- .../MXKErrorPresentableBuilder.m | 10 +- .../Utils/EventFormatter/MXKEventFormatter.m | 276 +++++++++--------- .../MXKRoomNameStringLocalizations.m | 4 +- MatrixKit/Utils/MXKTools.m | 45 +-- .../MXKAuthInputsEmailCodeBasedView.m | 14 +- .../MXKAuthInputsPasswordBasedView.m | 16 +- .../Views/Authentication/MXKAuthInputsView.m | 6 +- MatrixKit/Views/DeviceView/MXKDeviceView.m | 55 ++-- .../MXKEncryptionInfoView.m | 84 +++--- .../MXKEncryptionKeysExportView.m | 26 +- .../MXKEncryptionKeysImportView.m | 14 +- MatrixKit/Views/Group/MXKGroupTableViewCell.m | 6 +- MatrixKit/Views/MXKEventDetailsView.m | 10 +- MatrixKit/Views/MXKRoomCreationView.m | 30 +- .../MXKPushRuleCreationTableViewCell.m | 8 +- .../Views/PushRule/MXKPushRuleTableViewCell.m | 12 +- .../MXKRoomOutgoingBubbleTableViewCell.m | 6 +- .../MXKRoomInputToolbarView.m | 66 ++--- .../RoomList/MXKPublicRoomTableViewCell.m | 6 +- .../MXKRoomMemberTableViewCell.m | 8 +- MatrixKit/Views/RoomTitle/MXKRoomTitleView.m | 8 +- .../RoomTitle/MXKRoomTitleViewWithTopic.m | 8 +- 42 files changed, 669 insertions(+), 599 deletions(-) diff --git a/MatrixKit.xcodeproj/project.pbxproj b/MatrixKit.xcodeproj/project.pbxproj index 5b47ae11a..82cd84d27 100644 --- a/MatrixKit.xcodeproj/project.pbxproj +++ b/MatrixKit.xcodeproj/project.pbxproj @@ -7,7 +7,11 @@ objects = { /* Begin PBXBuildFile section */ + 1873680326FE05860018959C /* MXKEventFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 32538D071D2EA100009FE744 /* MXKEventFormatterTests.m */; }; + 1873680426FE05890018959C /* MXKRoomDataSourceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82C7BAE25F0BA900059F7F1 /* MXKRoomDataSourceTests.swift */; }; + 1873680526FE058B0018959C /* MXKRoomDataSource+Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C4035A25F0C34D00B3F18B /* MXKRoomDataSource+Tests.m */; }; 18BA7B5126FDAC19001C25DF /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18BA7B4C26FDAC19001C25DF /* Strings.swift */; }; + 18BA7B5526FDFFBB001C25DF /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18BA7B4C26FDAC19001C25DF /* Strings.swift */; }; 3205ED791E96905A003D65FA /* MXKDirectoryServerCellData.m in Sources */ = {isa = PBXBuildFile; fileRef = 3205ED751E96905A003D65FA /* MXKDirectoryServerCellData.m */; }; 3205ED7A1E96905A003D65FA /* MXKDirectoryServersDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 3205ED781E96905A003D65FA /* MXKDirectoryServersDataSource.m */; }; 321313C91AEFC2D500A9B035 /* MXKRoomIOSOutgoingBubbleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 321313C71AEFC2D500A9B035 /* MXKRoomIOSOutgoingBubbleTableViewCell.m */; }; @@ -26,7 +30,6 @@ 3235CD821C33D3EA0084EA40 /* MXKSearchTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3235CD811C33D3EA0084EA40 /* MXKSearchTableViewCell.xib */; }; 323F9AF61F1E53730013AFDE /* NSBundle+MXKLanguage.m in Sources */ = {isa = PBXBuildFile; fileRef = 323F9AF51F1E53730013AFDE /* NSBundle+MXKLanguage.m */; }; 324978F4243F444C000D0384 /* UTI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 324978F3243F444C000D0384 /* UTI.swift */; }; - 32538D081D2EA100009FE744 /* MXKEventFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 32538D071D2EA100009FE744 /* MXKEventFormatterTests.m */; }; 327DCDC71AC1774000397E5E /* MXKRecentTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 327DCDC61AC1774000397E5E /* MXKRecentTableViewCell.xib */; }; 328AC4861AA75E000044A6FB /* MXKRoomBubbleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 328AC4851AA75E000044A6FB /* MXKRoomBubbleTableViewCell.m */; }; 328AC4891AA75EDD0044A6FB /* MXKRoomIncomingBubbleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 328AC4881AA75EDD0044A6FB /* MXKRoomIncomingBubbleTableViewCell.m */; }; @@ -61,8 +64,6 @@ 9135FFD926DE8EFD000E6D84 /* NSString+MatrixKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9135FFD826DE8EFD000E6D84 /* NSString+MatrixKit.swift */; }; 918DAB9F26E622BF00CE20A9 /* NSAttributedString+MatrixKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 918DAB9E26E622BF00CE20A9 /* NSAttributedString+MatrixKit.swift */; }; 92663A6C1EF6E5B3005FB712 /* MXKSoundPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 92663A6B1EF6E5B3005FB712 /* MXKSoundPlayer.m */; }; - A82C7BAF25F0BA900059F7F1 /* MXKRoomDataSourceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82C7BAE25F0BA900059F7F1 /* MXKRoomDataSourceTests.swift */; }; - A8C4035B25F0C34D00B3F18B /* MXKRoomDataSource+Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C4035A25F0C34D00B3F18B /* MXKRoomDataSource+Tests.m */; }; B11D3C7E20C032BD00938BCB /* MXKBarButtonItem.m in Sources */ = {isa = PBXBuildFile; fileRef = B11D3C7D20C032BD00938BCB /* MXKBarButtonItem.m */; }; B125D0FD22D5D2C200570CA4 /* MXKUTI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B125D0FC22D5D2C200570CA4 /* MXKUTI.swift */; }; B125D10522D62A4900570CA4 /* MXKUTITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B125D10322D62A4800570CA4 /* MXKUTITests.swift */; }; @@ -154,7 +155,6 @@ F07267D91BB2AA3D00ADC622 /* MXKRoomMemberListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F07267D81BB2AA3D00ADC622 /* MXKRoomMemberListViewController.xib */; }; F079333E1F38A6A600F04D4C /* MXKView.m in Sources */ = {isa = PBXBuildFile; fileRef = F079333D1F38A6A600F04D4C /* MXKView.m */; }; F07B9C2B1D3587D3000CB20E /* MXKAppSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = F0EA4CB31ADD6E98007197D2 /* MXKAppSettings.m */; }; - F07B9C2C1D3587E5000CB20E /* MXKTools.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F148C51AB31240005F5D4A /* MXKTools.m */; }; F07D74AC1AC5A29800D83B98 /* MXKEventDetailsView.m in Sources */ = {isa = PBXBuildFile; fileRef = F07D74AB1AC5A29800D83B98 /* MXKEventDetailsView.m */; }; F07D74AE1AC5A36B00D83B98 /* MXKEventDetailsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F07D74AD1AC5A36B00D83B98 /* MXKEventDetailsView.xib */; }; F07E180D1ABC2EDA00DE3766 /* MXKQueuedEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = F07E18051ABC2EDA00DE3766 /* MXKQueuedEvent.m */; }; @@ -1891,13 +1891,13 @@ buildActionMask = 2147483647; files = ( F07B9C2B1D3587D3000CB20E /* MXKAppSettings.m in Sources */, + 18BA7B5526FDFFBB001C25DF /* Strings.swift in Sources */, + 1873680526FE058B0018959C /* MXKRoomDataSource+Tests.m in Sources */, + 1873680426FE05890018959C /* MXKRoomDataSourceTests.swift in Sources */, + 1873680326FE05860018959C /* MXKEventFormatterTests.m in Sources */, 550A36BD1DE484DB005C1647 /* EncryptedAttachmentsTest.m in Sources */, - A82C7BAF25F0BA900059F7F1 /* MXKRoomDataSourceTests.swift in Sources */, 328E410424CB135100DC4490 /* MatrixKitVersion.m in Sources */, B125D10522D62A4900570CA4 /* MXKUTITests.swift in Sources */, - F07B9C2C1D3587E5000CB20E /* MXKTools.m in Sources */, - A8C4035B25F0C34D00B3F18B /* MXKRoomDataSource+Tests.m in Sources */, - 32538D081D2EA100009FE744 /* MXKEventFormatterTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MatrixKit/Assets/MatrixKitAssets.bundle/en.lproj/MatrixKit.strings b/MatrixKit/Assets/MatrixKitAssets.bundle/en.lproj/MatrixKit.strings index 0f1b8e0db..876f6a3d4 100644 --- a/MatrixKit/Assets/MatrixKitAssets.bundle/en.lproj/MatrixKit.strings +++ b/MatrixKit/Assets/MatrixKitAssets.bundle/en.lproj/MatrixKit.strings @@ -462,6 +462,7 @@ "share" = "Share"; "delete" = "Delete"; "view" = "View"; +"rename" = "Rename"; // actions "action_logout" = "Logout"; diff --git a/MatrixKit/Controllers/MXKAccountDetailsViewController.m b/MatrixKit/Controllers/MXKAccountDetailsViewController.m index 2a54362d4..95732b072 100644 --- a/MatrixKit/Controllers/MXKAccountDetailsViewController.m +++ b/MatrixKit/Controllers/MXKAccountDetailsViewController.m @@ -33,6 +33,8 @@ #import "MXKConstants.h" +#import "MXKSwiftHeader.h" + NSString* const kMXKAccountDetailsLinkedEmailCellId = @"kMXKAccountDetailsLinkedEmailCellId"; @interface MXKAccountDetailsViewController () @@ -113,8 +115,8 @@ - (void)viewDidLoad [userPictureButton.layer setCornerRadius:userPictureButton.frame.size.width / 2]; userPictureButton.clipsToBounds = YES; - [saveUserInfoButton setTitle:[NSBundle mxk_localizedStringForKey:@"account_save_changes"] forState:UIControlStateNormal]; - [saveUserInfoButton setTitle:[NSBundle mxk_localizedStringForKey:@"account_save_changes"] forState:UIControlStateHighlighted]; + [saveUserInfoButton setTitle:[MatrixKitL10n accountSaveChanges] forState:UIControlStateNormal]; + [saveUserInfoButton setTitle:[MatrixKitL10n accountSaveChanges] forState:UIControlStateHighlighted]; // Force refresh self.mxAccount = _mxAccount; @@ -248,10 +250,10 @@ - (BOOL)shouldLeave:(blockMXKAccountDetailsViewController_onReadyToLeave)handler { dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:[NSBundle mxk_localizedStringForKey:@"message_unsaved_changes"] preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:[MatrixKitL10n messageUnsavedChanges] preferredStyle:UIAlertControllerStyleAlert]; [self->alertsArray addObject:alert]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"discard"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n discard] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -269,7 +271,7 @@ - (BOOL)shouldLeave:(blockMXKAccountDetailsViewController_onReadyToLeave)handler }]]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"save"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n save] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -441,7 +443,7 @@ - (void)saveUserInfo NSString *title = [error.userInfo valueForKey:NSLocalizedFailureReasonErrorKey]; if (!title) { - title = [NSBundle mxk_localizedStringForKey:@"account_error_display_name_change_failed"]; + title = [MatrixKitL10n accountErrorDisplayNameChangeFailed]; } NSString *msg = [error.userInfo valueForKey:NSLocalizedDescriptionKey]; @@ -449,7 +451,7 @@ - (void)saveUserInfo [self->alertsArray addObject:alert]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"abort"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n abort] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -462,7 +464,7 @@ - (void)saveUserInfo }]]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"retry"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n retry] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -550,14 +552,14 @@ - (void)handleErrorDuringPictureSaving:(NSError*)error NSString *title = [error.userInfo valueForKey:NSLocalizedFailureReasonErrorKey]; if (!title) { - title = [NSBundle mxk_localizedStringForKey:@"account_error_picture_change_failed"]; + title = [MatrixKitL10n accountErrorPictureChangeFailed]; } NSString *msg = [error.userInfo valueForKey:NSLocalizedDescriptionKey]; UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert]; [alertsArray addObject:alert]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"abort"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n abort] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -571,7 +573,7 @@ - (void)handleErrorDuringPictureSaving:(NSError*)error }]]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"retry"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n retry] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -729,10 +731,10 @@ - (void)dismissMediaPicker - (void)showValidationEmailDialogWithMessage:(NSString*)message { - UIAlertController *alert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"account_email_validation_title"] message:message preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *alert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n accountEmailValidationTitle] message:message preferredStyle:UIAlertControllerStyleAlert]; [alertsArray addObject:alert]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"abort"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n abort] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -742,7 +744,7 @@ - (void)showValidationEmailDialogWithMessage:(NSString*)message }]]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"continue"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n continue] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -777,7 +779,7 @@ - (void)showValidationEmailDialogWithMessage:(NSString*)message MXError *mxError = [[MXError alloc] initWithNSError:error]; if (mxError && [mxError.errcode isEqualToString:kMXErrCodeStringThreePIDAuthFailed]) { - [self showValidationEmailDialogWithMessage:[NSBundle mxk_localizedStringForKey:@"account_email_validation_error"]]; + [self showValidationEmailDialogWithMessage:[MatrixKitL10n accountEmailValidationError]]; } else { @@ -839,10 +841,10 @@ - (IBAction)onButtonPressed:(id)sender // Email check if (![MXTools isEmailAddress:emailTextField.text]) { - UIAlertController *alert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"account_error_email_wrong_title"] message:[NSBundle mxk_localizedStringForKey:@"account_error_email_wrong_description"] preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *alert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n accountErrorEmailWrongTitle] message:[MatrixKitL10n accountErrorEmailWrongDescription] preferredStyle:UIAlertControllerStyleAlert]; [alertsArray addObject:alert]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -868,7 +870,7 @@ - (IBAction)onButtonPressed:(id)sender if (weakSelf) { typeof(self) self = weakSelf; - [self showValidationEmailDialogWithMessage:[NSBundle mxk_localizedStringForKey:@"account_email_validation_message"]]; + [self showValidationEmailDialogWithMessage:[MatrixKitL10n accountEmailValidationMessage]]; } } failure:^(NSError *error) { @@ -983,10 +985,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa { UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, MAXFLOAT)]; textView.font = [UIFont systemFontOfSize:14]; - - NSString *configFormat = [NSString stringWithFormat:@"%@\n%@\n%@", [NSBundle mxk_localizedStringForKey:@"settings_config_home_server"], [NSBundle mxk_localizedStringForKey:@"settings_config_identity_server"], [NSBundle mxk_localizedStringForKey:@"settings_config_user_id"]]; - - textView.text = [NSString stringWithFormat:configFormat, _mxAccount.mxCredentials.homeServer, _mxAccount.identityServerURL, _mxAccount.mxCredentials.userId]; + textView.text = [NSString stringWithFormat:@"%@\n%@\n%@", [MatrixKitL10n settingsConfigHomeServer:_mxAccount.mxCredentials.homeServer], [MatrixKitL10n settingsConfigIdentityServer:_mxAccount.identityServerURL], [MatrixKitL10n settingsConfigUserId:_mxAccount.mxCredentials.userId]]; CGSize contentSize = [textView sizeThatFits:textView.frame.size]; return contentSize.height + 1; @@ -1031,8 +1030,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N submittedEmailCell.mxkTextField.text = currentEmail; submittedEmailCell.mxkTextField.keyboardType = UIKeyboardTypeEmailAddress; submittedEmailCell.mxkButton.enabled = (currentEmail.length != 0); - [submittedEmailCell.mxkButton setTitle:[NSBundle mxk_localizedStringForKey:@"account_link_email"] forState:UIControlStateNormal]; - [submittedEmailCell.mxkButton setTitle:[NSBundle mxk_localizedStringForKey:@"account_link_email"] forState:UIControlStateHighlighted]; + [submittedEmailCell.mxkButton setTitle:[MatrixKitL10n accountLinkEmail] forState:UIControlStateNormal]; + [submittedEmailCell.mxkButton setTitle:[MatrixKitL10n accountLinkEmail] forState:UIControlStateHighlighted]; [submittedEmailCell.mxkButton addTarget:self action:@selector(onButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; emailSubmitButton = submittedEmailCell.mxkButton; @@ -1058,13 +1057,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (indexPath.row == enableInAppNotifRowIndex) { - notificationsCell.mxkLabel.text = [NSBundle mxk_localizedStringForKey:@"settings_enable_inapp_notifications"]; + notificationsCell.mxkLabel.text = [MatrixKitL10n settingsEnableInappNotifications]; notificationsCell.mxkSwitch.on = _mxAccount.enableInAppNotifications; inAppNotificationsSwitch = notificationsCell.mxkSwitch; } else /* enablePushNotifRowIndex */ { - notificationsCell.mxkLabel.text = [NSBundle mxk_localizedStringForKey:@"settings_enable_push_notifications"]; + notificationsCell.mxkLabel.text = [MatrixKitL10n settingsEnablePushNotifications]; notificationsCell.mxkSwitch.on = _mxAccount.pushNotificationServiceIsActive; notificationsCell.mxkSwitch.enabled = YES; apnsNotificationsSwitch = notificationsCell.mxkSwitch; @@ -1082,9 +1081,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N configCell = [[MXKTableViewCellWithTextView alloc] init]; } - NSString *configFormat = [NSString stringWithFormat:@"%@\n%@\n%@", [NSBundle mxk_localizedStringForKey:@"settings_config_home_server"], [NSBundle mxk_localizedStringForKey:@"settings_config_identity_server"], [NSBundle mxk_localizedStringForKey:@"settings_config_user_id"]]; - - configCell.mxkTextView.text = [NSString stringWithFormat:configFormat, _mxAccount.mxCredentials.homeServer, _mxAccount.identityServerURL, _mxAccount.mxCredentials.userId]; + configCell.mxkTextView.text = [NSString stringWithFormat:@"%@\n%@\n%@", [MatrixKitL10n settingsConfigHomeServer:_mxAccount.mxCredentials.homeServer], [MatrixKitL10n settingsConfigIdentityServer:_mxAccount.identityServerURL], [MatrixKitL10n settingsConfigUserId:_mxAccount.mxCredentials.userId]]; cell = configCell; } @@ -1095,8 +1092,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N { logoutBtnCell = [[MXKTableViewCellWithButton alloc] init]; } - [logoutBtnCell.mxkButton setTitle:[NSBundle mxk_localizedStringForKey:@"action_logout"] forState:UIControlStateNormal]; - [logoutBtnCell.mxkButton setTitle:[NSBundle mxk_localizedStringForKey:@"action_logout"] forState:UIControlStateHighlighted]; + [logoutBtnCell.mxkButton setTitle:[MatrixKitL10n actionLogout] forState:UIControlStateNormal]; + [logoutBtnCell.mxkButton setTitle:[MatrixKitL10n actionLogout] forState:UIControlStateHighlighted]; [logoutBtnCell.mxkButton addTarget:self action:@selector(onButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; logoutButton = logoutBtnCell.mxkButton; @@ -1136,15 +1133,15 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger if (section == linkedEmailsSection) { - sectionLabel.text = [NSBundle mxk_localizedStringForKey:@"account_linked_emails"]; + sectionLabel.text = [MatrixKitL10n accountLinkedEmails]; } else if (section == notificationsSection) { - sectionLabel.text = [NSBundle mxk_localizedStringForKey:@"settings_title_notifications"]; + sectionLabel.text = [MatrixKitL10n settingsTitleNotifications]; } else if (section == configurationSection) { - sectionLabel.text = [NSBundle mxk_localizedStringForKey:@"settings_title_config"]; + sectionLabel.text = [MatrixKitL10n settingsTitleConfig]; } return sectionHeader; diff --git a/MatrixKit/Controllers/MXKAttachmentsViewController.m b/MatrixKit/Controllers/MXKAttachmentsViewController.m index ddf5f766f..2013b8438 100644 --- a/MatrixKit/Controllers/MXKAttachmentsViewController.m +++ b/MatrixKit/Controllers/MXKAttachmentsViewController.m @@ -36,6 +36,8 @@ #import "MXKAttachmentInteractionController.h" +#import "MXKSwiftHeader.h" + @interface MXKAttachmentsViewController () { /** @@ -1192,7 +1194,7 @@ - (void)onCollectionViewCellLongPress:(UIGestureRecognizer*)gestureRecognizer if ([MXKAppSettings standardAppSettings].messageDetailsAllowSaving) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"save"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n save] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1221,7 +1223,7 @@ - (void)onCollectionViewCellLongPress:(UIGestureRecognizer*)gestureRecognizer if ([MXKAppSettings standardAppSettings].messageDetailsAllowCopyingMedia) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"copy"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n copyButtonName] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1250,7 +1252,7 @@ - (void)onCollectionViewCellLongPress:(UIGestureRecognizer*)gestureRecognizer if ([MXKAppSettings standardAppSettings].messageDetailsAllowSharing) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"share"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n share] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1293,7 +1295,7 @@ - (void)onCollectionViewCellLongPress:(UIGestureRecognizer*)gestureRecognizer if ([MXMediaManager existingDownloaderWithIdentifier:attachment.downloadId]) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel_download"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancelDownload] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1312,7 +1314,7 @@ - (void)onCollectionViewCellLongPress:(UIGestureRecognizer*)gestureRecognizer if (currentAlert.actions.count) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { diff --git a/MatrixKit/Controllers/MXKAuthenticationViewController.m b/MatrixKit/Controllers/MXKAuthenticationViewController.m index c6a76e327..0579f0a10 100644 --- a/MatrixKit/Controllers/MXKAuthenticationViewController.m +++ b/MatrixKit/Controllers/MXKAuthenticationViewController.m @@ -28,6 +28,8 @@ #import #import "MXKAppSettings.h" +#import "MXKSwiftHeader.h" + @interface MXKAuthenticationViewController () { /** @@ -164,14 +166,14 @@ - (void)viewDidLoad [self updateRESTClient]; // Localize labels - _homeServerLabel.text = [NSBundle mxk_localizedStringForKey:@"login_home_server_title"]; - _homeServerTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"login_server_url_placeholder"]; - _homeServerInfoLabel.text = [NSBundle mxk_localizedStringForKey:@"login_home_server_info"]; - _identityServerLabel.text = [NSBundle mxk_localizedStringForKey:@"login_identity_server_title"]; - _identityServerTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"login_server_url_placeholder"]; - _identityServerInfoLabel.text = [NSBundle mxk_localizedStringForKey:@"login_identity_server_info"]; - [_cancelAuthFallbackButton setTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] forState:UIControlStateNormal]; - [_cancelAuthFallbackButton setTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] forState:UIControlStateHighlighted]; + _homeServerLabel.text = [MatrixKitL10n loginHomeServerTitle]; + _homeServerTextField.placeholder = [MatrixKitL10n loginServerUrlPlaceholder]; + _homeServerInfoLabel.text = [MatrixKitL10n loginHomeServerInfo]; + _identityServerLabel.text = [MatrixKitL10n loginIdentityServerTitle]; + _identityServerTextField.placeholder = [MatrixKitL10n loginServerUrlPlaceholder]; + _identityServerInfoLabel.text = [MatrixKitL10n loginIdentityServerInfo]; + [_cancelAuthFallbackButton setTitle:[MatrixKitL10n cancel] forState:UIControlStateNormal]; + [_cancelAuthFallbackButton setTitle:[MatrixKitL10n cancel] forState:UIControlStateHighlighted]; } - (void)didReceiveMemoryWarning @@ -300,10 +302,10 @@ - (void)setAuthType:(MXKAuthenticationType)authType if (authType == MXKAuthenticationTypeLogin) { _subTitleLabel.hidden = YES; - [_submitButton setTitle:[NSBundle mxk_localizedStringForKey:@"login"] forState:UIControlStateNormal]; - [_submitButton setTitle:[NSBundle mxk_localizedStringForKey:@"login"] forState:UIControlStateHighlighted]; - [_authSwitchButton setTitle:[NSBundle mxk_localizedStringForKey:@"create_account"] forState:UIControlStateNormal]; - [_authSwitchButton setTitle:[NSBundle mxk_localizedStringForKey:@"create_account"] forState:UIControlStateHighlighted]; + [_submitButton setTitle:[MatrixKitL10n login] forState:UIControlStateNormal]; + [_submitButton setTitle:[MatrixKitL10n login] forState:UIControlStateHighlighted]; + [_authSwitchButton setTitle:[MatrixKitL10n createAccount] forState:UIControlStateNormal]; + [_authSwitchButton setTitle:[MatrixKitL10n createAccount] forState:UIControlStateHighlighted]; // Update supported authentication flow and associated information (defined in authentication session) [self refreshAuthenticationSession]; @@ -311,11 +313,11 @@ - (void)setAuthType:(MXKAuthenticationType)authType else if (authType == MXKAuthenticationTypeRegister) { _subTitleLabel.hidden = NO; - _subTitleLabel.text = [NSBundle mxk_localizedStringForKey:@"login_create_account"]; - [_submitButton setTitle:[NSBundle mxk_localizedStringForKey:@"sign_up"] forState:UIControlStateNormal]; - [_submitButton setTitle:[NSBundle mxk_localizedStringForKey:@"sign_up"] forState:UIControlStateHighlighted]; - [_authSwitchButton setTitle:[NSBundle mxk_localizedStringForKey:@"back"] forState:UIControlStateNormal]; - [_authSwitchButton setTitle:[NSBundle mxk_localizedStringForKey:@"back"] forState:UIControlStateHighlighted]; + _subTitleLabel.text = [MatrixKitL10n loginCreateAccount]; + [_submitButton setTitle:[MatrixKitL10n signUp] forState:UIControlStateNormal]; + [_submitButton setTitle:[MatrixKitL10n signUp] forState:UIControlStateHighlighted]; + [_authSwitchButton setTitle:[MatrixKitL10n back] forState:UIControlStateNormal]; + [_authSwitchButton setTitle:[MatrixKitL10n back] forState:UIControlStateHighlighted]; // Update supported authentication flow and associated information (defined in authentication session) [self refreshAuthenticationSession]; @@ -326,19 +328,19 @@ - (void)setAuthType:(MXKAuthenticationType)authType if (isPasswordReseted) { - [_submitButton setTitle:[NSBundle mxk_localizedStringForKey:@"back"] forState:UIControlStateNormal]; - [_submitButton setTitle:[NSBundle mxk_localizedStringForKey:@"back"] forState:UIControlStateHighlighted]; + [_submitButton setTitle:[MatrixKitL10n back] forState:UIControlStateNormal]; + [_submitButton setTitle:[MatrixKitL10n back] forState:UIControlStateHighlighted]; } else { - [_submitButton setTitle:[NSBundle mxk_localizedStringForKey:@"submit"] forState:UIControlStateNormal]; - [_submitButton setTitle:[NSBundle mxk_localizedStringForKey:@"submit"] forState:UIControlStateHighlighted]; + [_submitButton setTitle:[MatrixKitL10n submit] forState:UIControlStateNormal]; + [_submitButton setTitle:[MatrixKitL10n submit] forState:UIControlStateHighlighted]; [self refreshForgotPasswordSession]; } - [_authSwitchButton setTitle:[NSBundle mxk_localizedStringForKey:@"back"] forState:UIControlStateNormal]; - [_authSwitchButton setTitle:[NSBundle mxk_localizedStringForKey:@"back"] forState:UIControlStateHighlighted]; + [_authSwitchButton setTitle:[MatrixKitL10n back] forState:UIControlStateNormal]; + [_authSwitchButton setTitle:[MatrixKitL10n back] forState:UIControlStateHighlighted]; } [self checkIdentityServer]; @@ -756,7 +758,7 @@ - (void)handleAuthenticationSession:(MXAuthenticationSession *)authSession } else { - [self onFailureDuringAuthRequest:[NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[NSBundle mxk_localizedStringForKey:@"not_supported_yet"]}]]; + [self onFailureDuringAuthRequest:[NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[MatrixKitL10n notSupportedYet]}]]; _externalRegistrationParameters = nil; @@ -781,23 +783,23 @@ - (void)handleAuthenticationSession:(MXAuthenticationSession *)authSession // Notify user that no flow is supported if (_authType == MXKAuthenticationTypeLogin) { - _noFlowLabel.text = [NSBundle mxk_localizedStringForKey:@"login_error_do_not_support_login_flows"]; + _noFlowLabel.text = [MatrixKitL10n loginErrorDoNotSupportLoginFlows]; } else { - _noFlowLabel.text = [NSBundle mxk_localizedStringForKey:@"login_error_registration_is_not_supported"]; + _noFlowLabel.text = [MatrixKitL10n loginErrorRegistrationIsNotSupported]; } MXLogDebug(@"[MXKAuthenticationVC] Warning: %@", _noFlowLabel.text); if (authenticationFallback.length) { - [_retryButton setTitle:[NSBundle mxk_localizedStringForKey:@"login_use_fallback"] forState:UIControlStateNormal]; - [_retryButton setTitle:[NSBundle mxk_localizedStringForKey:@"login_use_fallback"] forState:UIControlStateNormal]; + [_retryButton setTitle:[MatrixKitL10n loginUseFallback] forState:UIControlStateNormal]; + [_retryButton setTitle:[MatrixKitL10n loginUseFallback] forState:UIControlStateNormal]; } else { - [_retryButton setTitle:[NSBundle mxk_localizedStringForKey:@"retry"] forState:UIControlStateNormal]; - [_retryButton setTitle:[NSBundle mxk_localizedStringForKey:@"retry"] forState:UIControlStateNormal]; + [_retryButton setTitle:[MatrixKitL10n retry] forState:UIControlStateNormal]; + [_retryButton setTitle:[MatrixKitL10n retry] forState:UIControlStateNormal]; } _noFlowLabel.hidden = NO; @@ -984,7 +986,7 @@ - (IBAction)onButtonPressed:(id)sender // Sanity check if (!credentials.userId || !credentials.accessToken) { - [self onFailureDuringAuthRequest:[NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[NSBundle mxk_localizedStringForKey:@"not_supported_yet"]}]]; + [self onFailureDuringAuthRequest:[NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[MatrixKitL10n notSupportedYet]}]]; } else { @@ -1207,15 +1209,15 @@ - (void)onFailureDuringAuthRequest:(NSError *)error { if (self.authType == MXKAuthenticationTypeLogin) { - title = [NSBundle mxk_localizedStringForKey:@"login_error_title"]; + title = [MatrixKitL10n loginErrorTitle]; } else if (self.authType == MXKAuthenticationTypeRegister) { - title = [NSBundle mxk_localizedStringForKey:@"register_error_title"]; + title = [MatrixKitL10n registerErrorTitle]; } else { - title = [NSBundle mxk_localizedStringForKey:@"error"]; + title = [MatrixKitL10n error]; } } NSString* message = error.localizedDescription; @@ -1236,31 +1238,31 @@ - (void)onFailureDuringAuthRequest:(NSError *)error { if ([errCode isEqualToString:kMXErrCodeStringForbidden]) { - message = [NSBundle mxk_localizedStringForKey:@"login_error_forbidden"]; + message = [MatrixKitL10n loginErrorForbidden]; } else if ([errCode isEqualToString:kMXErrCodeStringUnknownToken]) { - message = [NSBundle mxk_localizedStringForKey:@"login_error_unknown_token"]; + message = [MatrixKitL10n loginErrorUnknownToken]; } else if ([errCode isEqualToString:kMXErrCodeStringBadJSON]) { - message = [NSBundle mxk_localizedStringForKey:@"login_error_bad_json"]; + message = [MatrixKitL10n loginErrorBadJson]; } else if ([errCode isEqualToString:kMXErrCodeStringNotJSON]) { - message = [NSBundle mxk_localizedStringForKey:@"login_error_not_json"]; + message = [MatrixKitL10n loginErrorNotJson]; } else if ([errCode isEqualToString:kMXErrCodeStringLimitExceeded]) { - message = [NSBundle mxk_localizedStringForKey:@"login_error_limit_exceeded"]; + message = [MatrixKitL10n loginErrorLimitExceeded]; } else if ([errCode isEqualToString:kMXErrCodeStringUserInUse]) { - message = [NSBundle mxk_localizedStringForKey:@"login_error_user_in_use"]; + message = [MatrixKitL10n loginErrorUserInUse]; } else if ([errCode isEqualToString:kMXErrCodeStringLoginEmailURLNotYet]) { - message = [NSBundle mxk_localizedStringForKey:@"login_error_login_email_not_yet"]; + message = [MatrixKitL10n loginErrorLoginEmailNotYet]; } else if ([errCode isEqualToString:kMXErrCodeStringResourceLimitExceeded]) { @@ -1282,7 +1284,7 @@ - (void)onFailureDuringAuthRequest:(NSError *)error alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1325,20 +1327,20 @@ - (void)showResourceLimitExceededError:(NSDictionary *)errorDict onAdminContactT adminContact = [NSURL URLWithString:adminContactString]; } - NSString *title = [NSBundle mxk_localizedStringForKey:@"login_error_resource_limit_exceeded_title"]; + NSString *title = [MatrixKitL10n loginErrorResourceLimitExceededTitle]; // Build the message content NSMutableString *message = [NSMutableString new]; if ([limitType isEqualToString:kMXErrorResourceLimitExceededLimitTypeMonthlyActiveUserValue]) { - [message appendString:[NSBundle mxk_localizedStringForKey:@"login_error_resource_limit_exceeded_message_monthly_active_user"]]; + [message appendString:[MatrixKitL10n loginErrorResourceLimitExceededMessageMonthlyActiveUser]]; } else { - [message appendString:[NSBundle mxk_localizedStringForKey:@"login_error_resource_limit_exceeded_message_default"]]; + [message appendString:[MatrixKitL10n loginErrorResourceLimitExceededMessageDefault]]; } - [message appendString:[NSBundle mxk_localizedStringForKey:@"login_error_resource_limit_exceeded_message_contact"]]; + [message appendString:[MatrixKitL10n loginErrorResourceLimitExceededMessageContact]]; // Build the alert alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; @@ -1346,7 +1348,7 @@ - (void)showResourceLimitExceededError:(NSDictionary *)errorDict onAdminContactT MXWeakify(self); if (adminContact && onAdminContactTapped) { - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"login_error_resource_limit_exceeded_contact_button"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n loginErrorResourceLimitExceededContactButton] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1359,7 +1361,7 @@ - (void)showResourceLimitExceededError:(NSDictionary *)errorDict onAdminContactT }]]; } - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1401,9 +1403,9 @@ - (void)onSuccessfulLogin:(MXCredentials*)credentials [alert dismissViewControllerAnimated:NO completion:nil]; } - alert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"login_error_already_logged_in"] message:nil preferredStyle:UIAlertControllerStyleAlert]; + alert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n loginErrorAlreadyLoggedIn] message:nil preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1520,9 +1522,9 @@ - (NSString *)deviceDisplayName } #if TARGET_OS_IPHONE - NSString *deviceName = [[UIDevice currentDevice].model isEqualToString:@"iPad"] ? [NSBundle mxk_localizedStringForKey:@"login_tablet_device"] : [NSBundle mxk_localizedStringForKey:@"login_mobile_device"]; + NSString *deviceName = [[UIDevice currentDevice].model isEqualToString:@"iPad"] ? [MatrixKitL10n loginTabletDevice] : [MatrixKitL10n loginMobileDevice]; #elif TARGET_OS_OSX - NSString *deviceName = [NSBundle mxk_localizedStringForKey:@"login_desktop_device"]; + NSString *deviceName = [MatrixKitL10n loginDesktopDevice]; #endif return deviceName; @@ -1567,7 +1569,7 @@ - (void)refreshForgotPasswordSession // Remove the potential auth inputs view self.authInputsView = nil; - _noFlowLabel.text = [NSBundle mxk_localizedStringForKey:@"login_error_forgot_password_is_not_supported"]; + _noFlowLabel.text = [MatrixKitL10n loginErrorForgotPasswordIsNotSupported]; MXLogDebug(@"[MXKAuthenticationVC] Warning: %@", _noFlowLabel.text); @@ -1596,12 +1598,12 @@ - (void)updateRESTClient __block BOOL isTrusted; dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); - NSString *title = [NSBundle mxk_localizedStringForKey:@"ssl_could_not_verify"]; - NSString *homeserverURLStr = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"ssl_homeserver_url"], homeserverURL]; - NSString *fingerprint = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"ssl_fingerprint_hash"], @"SHA256"]; + NSString *title = [MatrixKitL10n sslCouldNotVerify]; + NSString *homeserverURLStr = [MatrixKitL10n sslHomeserverUrl:homeserverURL]; + NSString *fingerprint = [MatrixKitL10n sslFingerprintHash:@"SHA256"]; NSString *certFingerprint = [certificate mx_SHA256AsHexString]; - NSString *msg = [NSString stringWithFormat:@"%@\n\n%@\n\n%@\n\n%@\n\n%@\n\n%@", [NSBundle mxk_localizedStringForKey:@"ssl_cert_not_trust"], [NSBundle mxk_localizedStringForKey:@"ssl_cert_new_account_expl"], homeserverURLStr, fingerprint, certFingerprint, [NSBundle mxk_localizedStringForKey:@"ssl_only_accept"]]; + NSString *msg = [NSString stringWithFormat:@"%@\n\n%@\n\n%@\n\n%@\n\n%@\n\n%@", [MatrixKitL10n sslCertNotTrust], [MatrixKitL10n sslCertNewAccountExpl], homeserverURLStr, fingerprint, certFingerprint, [MatrixKitL10n sslOnlyAccept]]; if (self->alert) { @@ -1610,7 +1612,7 @@ - (void)updateRESTClient self->alert = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert]; - [self->alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [self->alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1620,7 +1622,7 @@ - (void)updateRESTClient }]]; - [self->alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ssl_trust"] + [self->alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n sslTrust] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1679,7 +1681,7 @@ - (void)loginWithParameters:(NSDictionary*)parameters // Sanity check if (!credentials.userId || !credentials.accessToken) { - [self onFailureDuringAuthRequest:[NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[NSBundle mxk_localizedStringForKey:@"not_supported_yet"]}]]; + [self onFailureDuringAuthRequest:[NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[MatrixKitL10n notSupportedYet]}]]; } else { @@ -1721,7 +1723,7 @@ - (void)registerWithParameters:(NSDictionary*)parameters // Sanity check if (!credentials.userId || !credentials.accessToken) { - [self onFailureDuringAuthRequest:[NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[NSBundle mxk_localizedStringForKey:@"not_supported_yet"]}]]; + [self onFailureDuringAuthRequest:[NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[MatrixKitL10n notSupportedYet]}]]; } else { @@ -1787,7 +1789,7 @@ - (void)registerWithParameters:(NSDictionary*)parameters return; } - [self onFailureDuringAuthRequest:[NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[NSBundle mxk_localizedStringForKey:@"not_supported_yet"]}]]; + [self onFailureDuringAuthRequest:[NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[MatrixKitL10n notSupportedYet]}]]; } else { @@ -1838,9 +1840,9 @@ - (void)resetPasswordWithParameters:(NSDictionary*)parameters [self->alert dismissViewControllerAnimated:NO completion:nil]; } - self->alert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"error"] message:[NSBundle mxk_localizedStringForKey:@"auth_reset_password_error_unauthorized"] preferredStyle:UIAlertControllerStyleAlert]; + self->alert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n error] message:[NSBundle mxk_localizedStringForKey:@"auth_reset_password_error_unauthorized"] preferredStyle:UIAlertControllerStyleAlert]; - [self->alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [self->alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1898,7 +1900,7 @@ - (void)onFailureDuringMXOperation:(NSError*)error NSString *title = [error.userInfo valueForKey:NSLocalizedFailureReasonErrorKey]; if (!title) { - title = [NSBundle mxk_localizedStringForKey:@"error"]; + title = [MatrixKitL10n error]; } NSString *msg = [error.userInfo valueForKey:NSLocalizedDescriptionKey]; @@ -1909,7 +1911,7 @@ - (void)onFailureDuringMXOperation:(NSError*)error alert = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"dismiss"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n dismiss] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1955,10 +1957,10 @@ - (void)onFailureDuringMXOperation:(NSError*)error _noFlowLabel.text = [error.userInfo valueForKey:NSLocalizedDescriptionKey]; if (!_noFlowLabel.text.length) { - _noFlowLabel.text = [NSBundle mxk_localizedStringForKey:@"login_error_no_login_flow"]; + _noFlowLabel.text = [MatrixKitL10n loginErrorNoLoginFlow]; } - [_retryButton setTitle:[NSBundle mxk_localizedStringForKey:@"retry"] forState:UIControlStateNormal]; - [_retryButton setTitle:[NSBundle mxk_localizedStringForKey:@"retry"] forState:UIControlStateNormal]; + [_retryButton setTitle:[MatrixKitL10n retry] forState:UIControlStateNormal]; + [_retryButton setTitle:[MatrixKitL10n retry] forState:UIControlStateNormal]; _retryButton.hidden = NO; } } @@ -1976,7 +1978,7 @@ - (void)onReachabilityStatusChange:(NSNotification *)notif } else if (status == AFNetworkReachabilityStatusNotReachable) { - _noFlowLabel.text = [NSBundle mxk_localizedStringForKey:@"network_error_not_reachable"]; + _noFlowLabel.text = [MatrixKitL10n networkErrorNotReachable]; } } @@ -2089,7 +2091,7 @@ - (void)showAuthenticationFallBackView:(NSString*)fallbackPage { if (!cancelFallbackBarButton) { - cancelFallbackBarButton = [[UIBarButtonItem alloc] initWithTitle:[NSBundle mxk_localizedStringForKey:@"login_leave_fallback"] style:UIBarButtonItemStylePlain target:self action:@selector(hideRegistrationFallbackView)]; + cancelFallbackBarButton = [[UIBarButtonItem alloc] initWithTitle:[MatrixKitL10n loginLeaveFallback] style:UIBarButtonItemStylePlain target:self action:@selector(hideRegistrationFallbackView)]; } // Add cancel button in right bar items diff --git a/MatrixKit/Controllers/MXKCallViewController.m b/MatrixKit/Controllers/MXKCallViewController.m index 56d2b6da8..55781b106 100644 --- a/MatrixKit/Controllers/MXKCallViewController.m +++ b/MatrixKit/Controllers/MXKCallViewController.m @@ -24,6 +24,8 @@ #import "MXKTools.h" #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + NSString *const kMXKCallViewControllerWillAppearNotification = @"kMXKCallViewControllerWillAppearNotification"; NSString *const kMXKCallViewControllerAppearedNotification = @"kMXKCallViewControllerAppearedNotification"; NSString *const kMXKCallViewControllerWillDisappearNotification = @"kMXKCallViewControllerWillDisappearNotification"; @@ -149,14 +151,14 @@ - (void)viewDidLoad [self.speakerButton setImage:[NSBundle mxk_imageFromMXKAssetsBundleWithName:@"icon_speaker_on"] forState:UIControlStateSelected]; // Localize string - [answerCallButton setTitle:[NSBundle mxk_localizedStringForKey:@"answer_call"] forState:UIControlStateNormal]; - [answerCallButton setTitle:[NSBundle mxk_localizedStringForKey:@"answer_call"] forState:UIControlStateHighlighted]; - [rejectCallButton setTitle:[NSBundle mxk_localizedStringForKey:@"reject_call"] forState:UIControlStateNormal]; - [rejectCallButton setTitle:[NSBundle mxk_localizedStringForKey:@"reject_call"] forState:UIControlStateHighlighted]; - [endCallButton setTitle:[NSBundle mxk_localizedStringForKey:@"end_call"] forState:UIControlStateNormal]; - [endCallButton setTitle:[NSBundle mxk_localizedStringForKey:@"end_call"] forState:UIControlStateHighlighted]; - [_resumeButton setTitle:[NSBundle mxk_localizedStringForKey:@"resume_call"] forState:UIControlStateNormal]; - [_resumeButton setTitle:[NSBundle mxk_localizedStringForKey:@"resume_call"] forState:UIControlStateHighlighted]; + [answerCallButton setTitle:[MatrixKitL10n answerCall] forState:UIControlStateNormal]; + [answerCallButton setTitle:[MatrixKitL10n answerCall] forState:UIControlStateHighlighted]; + [rejectCallButton setTitle:[MatrixKitL10n rejectCall] forState:UIControlStateNormal]; + [rejectCallButton setTitle:[MatrixKitL10n rejectCall] forState:UIControlStateHighlighted]; + [endCallButton setTitle:[MatrixKitL10n endCall] forState:UIControlStateNormal]; + [endCallButton setTitle:[MatrixKitL10n endCall] forState:UIControlStateHighlighted]; + [_resumeButton setTitle:[MatrixKitL10n resumeCall] forState:UIControlStateNormal]; + [_resumeButton setTitle:[MatrixKitL10n resumeCall] forState:UIControlStateHighlighted]; // Refresh call information self.mxCall = mxCall; @@ -362,7 +364,7 @@ - (void)setMxCall:(MXCall *)call // Check the permission right now NSString *appDisplayName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]; [MXKTools checkAccessForMediaType:AVMediaTypeVideo - manualChangeMessage:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"camera_access_not_granted_for_call"], appDisplayName] + manualChangeMessage:[MatrixKitL10n cameraAccessNotGrantedForCall:appDisplayName] showPopUpInViewController:self completionHandler:^(BOOL granted) { @@ -507,17 +509,17 @@ - (void)updatePeerInfoDisplay if (mxCall.isConsulting) { - callerNameLabel.text = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"call_consulting_with_user"], peerDisplayName]; + callerNameLabel.text = [MatrixKitL10n callConsultingWithUser:peerDisplayName]; } else { if (mxCall.isVideoCall) { - callerNameLabel.text = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"call_video_with_user"], peerDisplayName]; + callerNameLabel.text = [MatrixKitL10n callVideoWithUser:peerDisplayName]; } else { - callerNameLabel.text = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"call_voice_with_user"], peerDisplayName]; + callerNameLabel.text = [MatrixKitL10n callVoiceWithUser:peerDisplayName]; } } @@ -639,8 +641,8 @@ - (IBAction)onButtonPressed:(id)sender NSString *appDisplayName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]; [MXKTools checkAccessForCall:mxCall.isVideoCall - manualChangeMessageForAudio:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"microphone_access_not_granted_for_call"], appDisplayName] - manualChangeMessageForVideo:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"camera_access_not_granted_for_call"], appDisplayName] + manualChangeMessageForAudio:[MatrixKitL10n microphoneAccessNotGrantedForCall:appDisplayName] + manualChangeMessageForVideo:[MatrixKitL10n cameraAccessNotGrantedForCall:appDisplayName] showPopUpInViewController:self completionHandler:^(BOOL granted) { if (granted) @@ -685,7 +687,7 @@ - (IBAction)onButtonPressed:(id)sender if (self.speakerButton == nil) { // audio device action - UIAlertAction *audioDeviceAction = [UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"call_more_actions_change_audio_device"] + UIAlertAction *audioDeviceAction = [UIAlertAction actionWithTitle:[MatrixKitL10n callMoreActionsChangeAudioDevice] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -703,7 +705,7 @@ - (IBAction)onButtonPressed:(id)sender // check the call can send DTMF tones if (self.mxCall.supportsDTMF) { - UIAlertAction *dialpadAction = [UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"call_more_actions_dialpad"] + UIAlertAction *dialpadAction = [UIAlertAction actionWithTitle:[MatrixKitL10n callMoreActionsDialpad] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -719,9 +721,9 @@ - (IBAction)onButtonPressed:(id)sender // check the call be holded/unholded if (mxCall.supportsHolding) { - NSString *actionLocKey = (mxCall.state == MXCallStateOnHold) ? @"call_more_actions_unhold" : @"call_more_actions_hold"; + NSString *actionLocKey = (mxCall.state == MXCallStateOnHold) ? [MatrixKitL10n callMoreActionsUnhold] : [MatrixKitL10n callMoreActionsHold]; - UIAlertAction *holdAction = [UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:actionLocKey] + UIAlertAction *holdAction = [UIAlertAction actionWithTitle:actionLocKey style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -737,7 +739,7 @@ - (IBAction)onButtonPressed:(id)sender // check the call be transferred if (mxCall.supportsTransferring && self.peer) { - UIAlertAction *transferAction = [UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"call_more_actions_transfer"] + UIAlertAction *transferAction = [UIAlertAction actionWithTitle:[MatrixKitL10n callMoreActionsTransfer] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -763,7 +765,7 @@ - (IBAction)onButtonPressed:(id)sender }]; // add cancel action always - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { @@ -831,7 +833,7 @@ - (void)showAudioDeviceOptions NSString *name = route.name; if (route.routeType == MXiOSAudioOutputRouteTypeLoudSpeakers) { - name = [NSBundle mxk_localizedStringForKey:@"call_more_actions_audio_use_device"]; + name = [MatrixKitL10n callMoreActionsAudioUseDevice]; } MXWeakify(self); UIAlertAction *routeAction = [UIAlertAction actionWithTitle:name @@ -861,7 +863,7 @@ - (void)showAudioDeviceOptions // add cancel action MXWeakify(self); - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { @@ -909,7 +911,7 @@ - (void)call:(MXCall *)call stateDidChange:(MXCallState)state reason:(MXEvent *) { case MXCallStateFledgling: self.isRinging = NO; - callStatusLabel.text = [NSBundle mxk_localizedStringForKey:@"call_connecting"]; + callStatusLabel.text = [MatrixKitL10n callConnecting]; break; case MXCallStateWaitLocalMedia: self.isRinging = NO; @@ -932,12 +934,12 @@ - (void)call:(MXCall *)call stateDidChange:(MXCallState)state reason:(MXEvent *) self.isRinging = YES; } - callStatusLabel.text = [NSBundle mxk_localizedStringForKey:@"call_connecting"]; + callStatusLabel.text = [MatrixKitL10n callConnecting]; break; } case MXCallStateInviteSent: { - callStatusLabel.text = [NSBundle mxk_localizedStringForKey:@"call_ringing"]; + callStatusLabel.text = [MatrixKitL10n callRinging]; break; } case MXCallStateRinging: @@ -945,11 +947,11 @@ - (void)call:(MXCall *)call stateDidChange:(MXCallState)state reason:(MXEvent *) [self configureSpeakerButton]; if (call.isVideoCall) { - callStatusLabel.text = [NSBundle mxk_localizedStringForKey:@"incoming_video_call"]; + callStatusLabel.text = [MatrixKitL10n incomingVideoCall]; } else { - callStatusLabel.text = [NSBundle mxk_localizedStringForKey:@"incoming_voice_call"]; + callStatusLabel.text = [MatrixKitL10n incomingVoiceCall]; } // Update bottom bar endCallButton.hidden = YES; @@ -1006,7 +1008,7 @@ - (void)call:(MXCall *)call stateDidChange:(MXCallState)state reason:(MXEvent *) break; case MXCallStateOnHold: - callStatusLabel.text = [NSBundle mxk_localizedStringForKey:@"call_holded"]; + callStatusLabel.text = [MatrixKitL10n callHolded]; break; case MXCallStateRemotelyOnHold: @@ -1015,20 +1017,20 @@ - (void)call:(MXCall *)call stateDidChange:(MXCallState)state reason:(MXEvent *) speakerButton.enabled = NO; cameraSwitchButton.enabled = NO; self.moreButton.enabled = NO; - callStatusLabel.text = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"call_remote_holded"], peerDisplayName]; + callStatusLabel.text = [MatrixKitL10n callRemoteHolded:peerDisplayName]; break; case MXCallStateInviteExpired: // MXCallStateInviteExpired state is sent as an notification // MXCall will move quickly to the MXCallStateEnded state self.isRinging = NO; - callStatusLabel.text = [NSBundle mxk_localizedStringForKey:@"call_invite_expired"]; + callStatusLabel.text = [MatrixKitL10n callInviteExpired]; break; case MXCallStateEnded: { self.isRinging = NO; - callStatusLabel.text = [NSBundle mxk_localizedStringForKey:@"call_ended"]; + callStatusLabel.text = [MatrixKitL10n callEnded]; NSString *soundName = [self soundNameForCallEnding]; if (soundName) @@ -1066,18 +1068,18 @@ - (void)call:(MXCall *)call didEncounterError:(NSError *)error reason:(MXCallHan NSString *title = [error.userInfo valueForKey:NSLocalizedFailureReasonErrorKey]; if (!title) { - title = [NSBundle mxk_localizedStringForKey:@"error"]; + title = [MatrixKitL10n error]; } NSString *msg = [error.userInfo valueForKey:NSLocalizedDescriptionKey]; if (!msg) { - msg = [NSBundle mxk_localizedStringForKey:@"error_common_message"]; + msg = [MatrixKitL10n errorCommonMessage]; } MXWeakify(self); errorAlert = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert]; - [errorAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [errorAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1100,7 +1102,7 @@ - (void)callConsultingStatusDidChange:(MXCall *)call if (call.isConsulting) { - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"call_transfer_to_user"], call.transferee.displayname]; + NSString *title = [MatrixKitL10n callTransferToUser:call.transferee.displayname]; [_transferButton setTitle:title forState:UIControlStateNormal]; _transferButton.hidden = call.state != MXCallStateConnected; } @@ -1130,11 +1132,11 @@ - (void)callAssertedIdentityDidChange:(MXCall *)call if (mxCall.isVideoCall) { - callerNameLabel.text = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"call_video_with_user"], peerDisplayName]; + callerNameLabel.text = [MatrixKitL10n callVideoWithUser:peerDisplayName]; } else { - callerNameLabel.text = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"call_voice_with_user"], peerDisplayName]; + callerNameLabel.text = [MatrixKitL10n callVoiceWithUser:peerDisplayName]; } if (peerAvatarURL) diff --git a/MatrixKit/Controllers/MXKContactListViewController.m b/MatrixKit/Controllers/MXKContactListViewController.m index 712b9a8a1..5ee99cd24 100644 --- a/MatrixKit/Controllers/MXKContactListViewController.m +++ b/MatrixKit/Controllers/MXKContactListViewController.m @@ -20,6 +20,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @interface MXKContactListViewController () { // YES -> only matrix users @@ -115,8 +117,8 @@ - (void)viewDidLoad } // Localize string - [_contactsControls setTitle:[NSBundle mxk_localizedStringForKey:@"contact_mx_users"] forSegmentAtIndex:0]; - [_contactsControls setTitle:[NSBundle mxk_localizedStringForKey:@"contact_local_contacts"] forSegmentAtIndex:1]; + [_contactsControls setTitle:[MatrixKitL10n contactMxUsers] forSegmentAtIndex:0]; + [_contactsControls setTitle:[MatrixKitL10n contactLocalContacts] forSegmentAtIndex:1]; // Apply search option in navigation bar self.enableBarButtonSearch = _enableBarButtonSearch; diff --git a/MatrixKit/Controllers/MXKNotificationSettingsViewController.m b/MatrixKit/Controllers/MXKNotificationSettingsViewController.m index 82e0ab3af..156b0c9c3 100644 --- a/MatrixKit/Controllers/MXKNotificationSettingsViewController.m +++ b/MatrixKit/Controllers/MXKNotificationSettingsViewController.m @@ -26,6 +26,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + #define MXKNOTIFICATIONSETTINGS_SECTION_INTRO_INDEX 0 #define MXKNOTIFICATIONSETTINGS_SECTION_PER_WORD_INDEX 1 #define MXKNOTIFICATIONSETTINGS_SECTION_PER_ROOM_INDEX 2 @@ -315,13 +317,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (areAllDisabled) { - [masterBtnCell.mxkButton setTitle:[NSBundle mxk_localizedStringForKey:@"notification_settings_enable_notifications"] forState:UIControlStateNormal]; - [masterBtnCell.mxkButton setTitle:[NSBundle mxk_localizedStringForKey:@"notification_settings_enable_notifications"] forState:UIControlStateHighlighted]; + [masterBtnCell.mxkButton setTitle:[MatrixKitL10n notificationSettingsEnableNotifications] forState:UIControlStateNormal]; + [masterBtnCell.mxkButton setTitle:[MatrixKitL10n notificationSettingsEnableNotifications] forState:UIControlStateHighlighted]; } else { - [masterBtnCell.mxkButton setTitle:[NSBundle mxk_localizedStringForKey:@"notification_settings_disable_all"] forState:UIControlStateNormal]; - [masterBtnCell.mxkButton setTitle:[NSBundle mxk_localizedStringForKey:@"notification_settings_disable_all"] forState:UIControlStateHighlighted]; + [masterBtnCell.mxkButton setTitle:[MatrixKitL10n notificationSettingsDisableAll] forState:UIControlStateNormal]; + [masterBtnCell.mxkButton setTitle:[MatrixKitL10n notificationSettingsDisableAll] forState:UIControlStateHighlighted]; } [masterBtnCell.mxkButton addTarget:self action:@selector(onButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; @@ -340,12 +342,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (areAllDisabled) { - introCell.mxkTextView.text = [NSBundle mxk_localizedStringForKey:@"notification_settings_enable_notifications_warning"]; + introCell.mxkTextView.text = [MatrixKitL10n notificationSettingsEnableNotificationsWarning]; introCell.mxkTextView.backgroundColor = [UIColor redColor]; } else { - introCell.mxkTextView.text = [NSBundle mxk_localizedStringForKey:@"notification_settings_global_info"]; + introCell.mxkTextView.text = [MatrixKitL10n notificationSettingsGlobalInfo]; introCell.mxkTextView.backgroundColor = [UIColor clearColor]; } @@ -363,7 +365,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N { introCell = [[MXKTableViewCellWithTextView alloc] init]; } - introCell.mxkTextView.text = [NSBundle mxk_localizedStringForKey:@"notification_settings_per_word_info"]; + introCell.mxkTextView.text = [MatrixKitL10n notificationSettingsPerWordInfo]; introCell.mxkTextView.font = [UIFont systemFontOfSize:14]; cell = introCell; @@ -472,37 +474,37 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (rowIndex == ruleContainsUserNameIndex) { pushRule = [_mxAccount.mxSession.notificationCenter ruleById:kMXNotificationCenterContainUserNameRuleID]; - ruleDescription = [NSBundle mxk_localizedStringForKey:@"notification_settings_contain_my_user_name"]; + ruleDescription = [MatrixKitL10n notificationSettingsContainMyUserName]; } if (rowIndex == ruleContainsDisplayNameIndex) { pushRule = [_mxAccount.mxSession.notificationCenter ruleById:kMXNotificationCenterContainDisplayNameRuleID]; - ruleDescription = [NSBundle mxk_localizedStringForKey:@"notification_settings_contain_my_display_name"]; + ruleDescription = [MatrixKitL10n notificationSettingsContainMyDisplayName]; } if (rowIndex == ruleOneToOneRoomIndex) { pushRule = [_mxAccount.mxSession.notificationCenter ruleById:kMXNotificationCenterOneToOneRoomRuleID]; - ruleDescription = [NSBundle mxk_localizedStringForKey:@"notification_settings_just_sent_to_me"]; + ruleDescription = [MatrixKitL10n notificationSettingsJustSentToMe]; } if (rowIndex == ruleInviteForMeIndex) { pushRule = [_mxAccount.mxSession.notificationCenter ruleById:kMXNotificationCenterInviteMeRuleID]; - ruleDescription = [NSBundle mxk_localizedStringForKey:@"notification_settings_invite_to_a_new_room"]; + ruleDescription = [MatrixKitL10n notificationSettingsInviteToANewRoom]; } if (rowIndex == ruleMemberEventIndex) { pushRule = [_mxAccount.mxSession.notificationCenter ruleById:kMXNotificationCenterMemberEventRuleID]; - ruleDescription = [NSBundle mxk_localizedStringForKey:@"notification_settings_people_join_leave_rooms"]; + ruleDescription = [MatrixKitL10n notificationSettingsPeopleJoinLeaveRooms]; } if (rowIndex == ruleCallIndex) { pushRule = [_mxAccount.mxSession.notificationCenter ruleById:kMXNotificationCenterCallRuleID]; - ruleDescription = [NSBundle mxk_localizedStringForKey:@"notification_settings_receive_a_call"]; + ruleDescription = [MatrixKitL10n notificationSettingsReceiveACall]; } if (rowIndex == ruleSuppressBotsNotificationsIndex) { pushRule = [_mxAccount.mxSession.notificationCenter ruleById:kMXNotificationCenterSuppressBotsNotificationsRuleID]; - ruleDescription = [NSBundle mxk_localizedStringForKey:@"notification_settings_suppress_from_bots"]; + ruleDescription = [MatrixKitL10n notificationSettingsSuppressFromBots]; } if (pushRule) @@ -534,7 +536,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N pushRuleCell.mxSession = _mxAccount.mxSession; pushRuleCell.mxPushRule = pushRule; - pushRuleCell.ruleDescription.text = [NSBundle mxk_localizedStringForKey:@"notification_settings_notify_all_other"]; + pushRuleCell.ruleDescription.text = [MatrixKitL10n notificationSettingsNotifyAllOther]; cell = pushRuleCell; } @@ -556,7 +558,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa { UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, MAXFLOAT)]; textView.font = [UIFont systemFontOfSize:14]; - textView.text = areAllDisabled ? [NSBundle mxk_localizedStringForKey:@"notification_settings_enable_notifications_warning"] : [NSBundle mxk_localizedStringForKey:@"notification_settings_global_info"]; + textView.text = areAllDisabled ? [MatrixKitL10n notificationSettingsEnableNotificationsWarning] : [MatrixKitL10n notificationSettingsGlobalInfo]; CGSize contentSize = [textView sizeThatFits:textView.frame.size]; return contentSize.height + 1; } @@ -567,7 +569,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa { UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, MAXFLOAT)]; textView.font = [UIFont systemFontOfSize:14]; - textView.text = [NSBundle mxk_localizedStringForKey:@"notification_settings_per_word_info"]; + textView.text = [MatrixKitL10n notificationSettingsPerWordInfo]; CGSize contentSize = [textView sizeThatFits:textView.frame.size]; return contentSize.height + 1; } @@ -610,23 +612,23 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger if (section == MXKNOTIFICATIONSETTINGS_SECTION_PER_WORD_INDEX) { - sectionLabel.text = [NSBundle mxk_localizedStringForKey:@"notification_settings_per_word_notifications"]; + sectionLabel.text = [MatrixKitL10n notificationSettingsPerWordNotifications]; } else if (section == MXKNOTIFICATIONSETTINGS_SECTION_PER_ROOM_INDEX) { - sectionLabel.text = [NSBundle mxk_localizedStringForKey:@"notification_settings_per_room_notifications"]; + sectionLabel.text = [MatrixKitL10n notificationSettingsPerRoomNotifications]; } else if (section == MXKNOTIFICATIONSETTINGS_SECTION_PER_SENDER_INDEX) { - sectionLabel.text = [NSBundle mxk_localizedStringForKey:@"notification_settings_per_sender_notifications"]; + sectionLabel.text = [MatrixKitL10n notificationSettingsPerSenderNotifications]; } else if (section == MXKNOTIFICATIONSETTINGS_SECTION_OTHERS_INDEX) { - sectionLabel.text = [NSBundle mxk_localizedStringForKey:@"notification_settings_other_alerts"]; + sectionLabel.text = [MatrixKitL10n notificationSettingsOtherAlerts]; } else if (section == MXKNOTIFICATIONSETTINGS_SECTION_DEFAULT_INDEX) { - sectionLabel.text = [NSBundle mxk_localizedStringForKey:@"notification_settings_by_default"]; + sectionLabel.text = [MatrixKitL10n notificationSettingsByDefault]; } return sectionHeader; diff --git a/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.m b/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.m index b4ed69bfa..67623bc18 100644 --- a/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.m +++ b/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.m @@ -28,6 +28,8 @@ #import "MXKConstants.h" +#import "MXKSwiftHeader.h" + @interface MXKRoomMemberDetailsViewController () { id membersListener; @@ -318,9 +320,9 @@ - (IBAction)onActionButtonPressed:(id)sender [currentAlert dismissViewControllerAnimated:NO completion:nil]; } - currentAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"room_member_ignore_prompt"] message:nil preferredStyle:UIAlertControllerStyleAlert]; + currentAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n roomMemberIgnorePrompt] message:nil preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"yes"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -355,7 +357,7 @@ - (IBAction)onActionButtonPressed:(id)sender }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"no"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -766,49 +768,49 @@ - (NSString*)actionButtonTitle:(MXKRoomMemberDetailsAction)action switch (action) { case MXKRoomMemberDetailsActionInvite: - title = [NSBundle mxk_localizedStringForKey:@"invite"]; + title = [MatrixKitL10n invite]; break; case MXKRoomMemberDetailsActionLeave: - title = [NSBundle mxk_localizedStringForKey:@"leave"]; + title = [MatrixKitL10n leave]; break; case MXKRoomMemberDetailsActionKick: - title = [NSBundle mxk_localizedStringForKey:@"kick"]; + title = [MatrixKitL10n kick]; break; case MXKRoomMemberDetailsActionBan: - title = [NSBundle mxk_localizedStringForKey:@"ban"]; + title = [MatrixKitL10n ban]; break; case MXKRoomMemberDetailsActionUnban: - title = [NSBundle mxk_localizedStringForKey:@"unban"]; + title = [MatrixKitL10n unban]; break; case MXKRoomMemberDetailsActionIgnore: - title = [NSBundle mxk_localizedStringForKey:@"ignore"]; + title = [MatrixKitL10n ignore]; break; case MXKRoomMemberDetailsActionUnignore: - title = [NSBundle mxk_localizedStringForKey:@"unignore"]; + title = [MatrixKitL10n unignore]; break; case MXKRoomMemberDetailsActionSetDefaultPowerLevel: - title = [NSBundle mxk_localizedStringForKey:@"set_default_power_level"]; + title = [MatrixKitL10n setDefaultPowerLevel]; break; case MXKRoomMemberDetailsActionSetModerator: - title = [NSBundle mxk_localizedStringForKey:@"set_moderator"]; + title = [MatrixKitL10n setModerator]; break; case MXKRoomMemberDetailsActionSetAdmin: - title = [NSBundle mxk_localizedStringForKey:@"set_admin"]; + title = [MatrixKitL10n setAdmin]; break; case MXKRoomMemberDetailsActionSetCustomPowerLevel: - title = [NSBundle mxk_localizedStringForKey:@"set_power_level"]; + title = [MatrixKitL10n setPowerLevel]; break; case MXKRoomMemberDetailsActionStartChat: - title = [NSBundle mxk_localizedStringForKey:@"start_chat"]; + title = [MatrixKitL10n startChat]; break; case MXKRoomMemberDetailsActionStartVoiceCall: - title = [NSBundle mxk_localizedStringForKey:@"start_voice_call"]; + title = [MatrixKitL10n startVoiceCall]; break; case MXKRoomMemberDetailsActionStartVideoCall: - title = [NSBundle mxk_localizedStringForKey:@"start_video_call"]; + title = [MatrixKitL10n startVideoCall]; break; case MXKRoomMemberDetailsActionMention: - title = [NSBundle mxk_localizedStringForKey:@"mention"]; + title = [MatrixKitL10n mention]; break; default: break; @@ -916,9 +918,9 @@ - (void)setPowerLevel:(NSInteger)value promptUser:(BOOL)promptUser [currentAlert dismissViewControllerAnimated:NO completion:nil]; } - currentAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"room_member_power_level_prompt"] message:nil preferredStyle:UIAlertControllerStyleAlert]; + currentAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n roomMemberPowerLevelPrompt] message:nil preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"no"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -930,7 +932,7 @@ - (void)setPowerLevel:(NSInteger)value promptUser:(BOOL)promptUser }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"yes"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -981,12 +983,12 @@ - (void)updateUserPowerLevel [currentAlert dismissViewControllerAnimated:NO completion:nil]; } - currentAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"power_level"] message:nil preferredStyle:UIAlertControllerStyleAlert]; + currentAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n powerLevel] message:nil preferredStyle:UIAlertControllerStyleAlert]; if (![self.mainSession.myUser.userId isEqualToString:_mxRoomMember.userId]) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"reset_to_default"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n resetToDefault] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1011,7 +1013,7 @@ - (void)updateUserPowerLevel textField.keyboardType = UIKeyboardTypeDecimalPad; }]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { diff --git a/MatrixKit/Controllers/MXKRoomMemberListViewController.m b/MatrixKit/Controllers/MXKRoomMemberListViewController.m index 2c33a9be7..165778380 100644 --- a/MatrixKit/Controllers/MXKRoomMemberListViewController.m +++ b/MatrixKit/Controllers/MXKRoomMemberListViewController.m @@ -24,6 +24,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @interface MXKRoomMemberListViewController () { /** @@ -524,10 +526,10 @@ - (void)inviteNewMember:(id)sender } // Ask for userId to invite - currentAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"user_id_title"] message:nil preferredStyle:UIAlertControllerStyleAlert]; + currentAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n userIdTitle] message:nil preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -543,10 +545,10 @@ - (void)inviteNewMember:(id)sender [currentAlert addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.secureTextEntry = NO; - textField.placeholder = [NSBundle mxk_localizedStringForKey:@"user_id_placeholder"]; + textField.placeholder = [MatrixKitL10n userIdPlaceholder]; }]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"invite"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n invite] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { diff --git a/MatrixKit/Controllers/MXKRoomSettingsViewController.m b/MatrixKit/Controllers/MXKRoomSettingsViewController.m index eeeb8e839..8f729e9b9 100644 --- a/MatrixKit/Controllers/MXKRoomSettingsViewController.m +++ b/MatrixKit/Controllers/MXKRoomSettingsViewController.m @@ -18,6 +18,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @interface MXKRoomSettingsViewController() { // the room events listener @@ -180,7 +182,7 @@ - (void)initWithSession:(MXSession*)mxSession andRoomId:(NSString*)roomId }]; } - self.title = [NSBundle mxk_localizedStringForKey:@"room_details_title"]; + self.title = [MatrixKitL10n roomDetailsTitle]; } - (void)refreshRoomSettings diff --git a/MatrixKit/Controllers/MXKRoomViewController.m b/MatrixKit/Controllers/MXKRoomViewController.m index 2db94fdae..9226a2512 100644 --- a/MatrixKit/Controllers/MXKRoomViewController.m +++ b/MatrixKit/Controllers/MXKRoomViewController.m @@ -841,18 +841,18 @@ - (void)onTimelineError:(NSNotification *)notif MXError *mxError = [[MXError alloc] initWithNSError:error]; if ([mxError.errcode isEqualToString:kMXErrCodeStringNotFound]) { - errorTitle = [NSBundle mxk_localizedStringForKey:@"room_error_timeline_event_not_found_title"]; - errorMessage = [NSBundle mxk_localizedStringForKey:@"room_error_timeline_event_not_found"]; + errorTitle = [MatrixKitL10n roomErrorTimelineEventNotFoundTitle]; + errorMessage = [MatrixKitL10n roomErrorTimelineEventNotFound]; } else { - errorTitle = [NSBundle mxk_localizedStringForKey:@"room_error_cannot_load_timeline"]; + errorTitle = [MatrixKitL10n roomErrorCannotLoadTimeline]; errorMessage = mxError.error; } } else { - errorTitle = [NSBundle mxk_localizedStringForKey:@"room_error_cannot_load_timeline"]; + errorTitle = [MatrixKitL10n roomErrorCannotLoadTimeline]; } // And show it @@ -861,7 +861,7 @@ - (void)onTimelineError:(NSNotification *)notif __weak typeof(self) weakSelf = self; currentAlert = [UIAlertController alertControllerWithTitle:errorTitle message:errorMessage preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -971,15 +971,15 @@ - (void)processRoomJoinFailureWithError:(NSError *)error completion:(void(^)(MXK { // minging kludge until https://matrix.org/jira/browse/SYN-678 is fixed // 'Error when trying to join an empty room should be more explicit' - msg = [NSBundle mxk_localizedStringForKey:@"room_error_join_failed_empty_room"]; + msg = [MatrixKitL10n roomErrorJoinFailedEmptyRoom]; } MXWeakify(self); [self->currentAlert dismissViewControllerAnimated:NO completion:nil]; - self->currentAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"room_error_join_failed_title"] message:msg preferredStyle:UIAlertControllerStyleAlert]; + self->currentAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n roomErrorJoinFailedTitle] message:msg preferredStyle:UIAlertControllerStyleAlert]; - [self->currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [self->currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1014,11 +1014,11 @@ - (void)leaveRoomOnEvent:(MXEvent*)event { if (self.roomDataSource.room.isDirect) { - reason = [NSBundle mxk_localizedStringForKey:@"room_left_for_dm"]; + reason = [MatrixKitL10n roomLeftForDm]; } else { - reason = [NSBundle mxk_localizedStringForKey:@"room_left"]; + reason = [MatrixKitL10n roomLeft]; } } @@ -2203,9 +2203,9 @@ - (void)promptUserToResendEvent:(NSString *)eventId __weak typeof(self) weakSelf = self; - currentAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"resend_message"] message:textMessage preferredStyle:UIAlertControllerStyleAlert]; + currentAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n resendMessage] message:textMessage preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2214,7 +2214,7 @@ - (void)promptUserToResendEvent:(NSString *)eventId }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2645,9 +2645,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac } __weak __typeof(self) weakSelf = self; - currentAlert = [UIAlertController alertControllerWithTitle:nil message:[NSBundle mxk_localizedStringForKey:@"attachment_cancel_download"] preferredStyle:UIAlertControllerStyleAlert]; + currentAlert = [UIAlertController alertControllerWithTitle:nil message:[MatrixKitL10n attachmentCancelDownload] preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"no"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2656,7 +2656,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"yes"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2692,9 +2692,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac } __weak __typeof(self) weakSelf = self; - currentAlert = [UIAlertController alertControllerWithTitle:nil message:[NSBundle mxk_localizedStringForKey:@"attachment_cancel_upload"] preferredStyle:UIAlertControllerStyleAlert]; + currentAlert = [UIAlertController alertControllerWithTitle:nil message:[MatrixKitL10n attachmentCancelUpload] preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"no"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2703,7 +2703,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"yes"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2763,7 +2763,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac // Add actions for a failed event if (selectedEvent.sentState == MXEventSentStateFailed) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"resend"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n resend] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2775,7 +2775,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"delete"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n delete] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2805,7 +2805,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac selectedComponent = nil; } - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"copy"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n copy] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2829,7 +2829,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac if ([MXKAppSettings standardAppSettings].messageDetailsAllowSharing) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"share"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n share] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2856,7 +2856,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac if (components.count > 1) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"select_all"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n selectAll] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2874,7 +2874,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac { if ([MXKAppSettings standardAppSettings].messageDetailsAllowSaving) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"save"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n save] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2907,7 +2907,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac if (attachment.type != MXKAttachmentTypeSticker) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"copy"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n copyButtonName] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2938,7 +2938,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac if ([MXKAppSettings standardAppSettings].messageDetailsAllowSharing) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"share"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n share] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -2982,7 +2982,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac NSString *uploadId = roomBubbleTableViewCell.bubbleData.attachment.contentURL; if ([MXMediaManager existingUploaderWithId:uploadId]) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel_upload"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancelUpload] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -3023,7 +3023,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac NSString *downloadId = roomBubbleTableViewCell.bubbleData.attachment.downloadId; if ([MXMediaManager existingDownloaderWithIdentifier:downloadId]) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel_download"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancelDownload] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -3043,7 +3043,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac } } - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"show_details"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n showDetails] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -3059,7 +3059,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac }]]; } - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { @@ -3131,7 +3131,7 @@ - (void)selectAllTextMessageInCell:(id)cell [self becomeFirstResponder]; UIMenuController *menu = [UIMenuController sharedMenuController]; - menu.menuItems = @[[[UIMenuItem alloc] initWithTitle:[NSBundle mxk_localizedStringForKey:@"share"] action:@selector(share:)]]; + menu.menuItems = @[[[UIMenuItem alloc] initWithTitle:[MatrixKitL10n share] action:@selector(share:)]]; [menu setTargetRect:roomBubbleTableViewCell.messageTextView.frame inView:roomBubbleTableViewCell]; [menu setMenuVisible:YES animated:YES]; }); @@ -3713,9 +3713,9 @@ - (void)showAttachmentInCell:(UITableViewCell*)cell [self->currentAlert dismissViewControllerAnimated:NO completion:nil]; __weak typeof(self) weakSelf = self; - self->currentAlert = [UIAlertController alertControllerWithTitle:@"" message:[NSBundle mxk_localizedStringForKey:@"attachment_e2e_keys_file_prompt"] preferredStyle:UIAlertControllerStyleAlert]; + self->currentAlert = [UIAlertController alertControllerWithTitle:@"" message:[MatrixKitL10n attachmentE2eKeysFilePrompt] preferredStyle:UIAlertControllerStyleAlert]; - [self->currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"view"] + [self->currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n view] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -3730,7 +3730,7 @@ - (void)showAttachmentInCell:(UITableViewCell*)cell }]]; - [self->currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"attachment_e2e_keys_import"] + [self->currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n attachmentE2eKeysImport] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { diff --git a/MatrixKit/Controllers/MXKSearchViewController.m b/MatrixKit/Controllers/MXKSearchViewController.m index 5f8dd30b3..6b93653d2 100644 --- a/MatrixKit/Controllers/MXKSearchViewController.m +++ b/MatrixKit/Controllers/MXKSearchViewController.m @@ -20,6 +20,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @interface MXKSearchViewController () { /** @@ -113,7 +115,7 @@ - (void)viewDidLoad self.searchSearchBarHeightConstraint.constant = 0; [self.view setNeedsUpdateConstraints]; - self.noResultsLabel.text = [NSBundle mxk_localizedStringForKey:@"search_no_results"]; + self.noResultsLabel.text = [MatrixKitL10n searchNoResults]; self.noResultsLabel.hidden = YES; searchBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(showSearchBar:)]; diff --git a/MatrixKit/Controllers/MXKWebViewViewController.m b/MatrixKit/Controllers/MXKWebViewViewController.m index bad8ebb42..fd12d22f8 100644 --- a/MatrixKit/Controllers/MXKWebViewViewController.m +++ b/MatrixKit/Controllers/MXKWebViewViewController.m @@ -22,6 +22,8 @@ #import +#import "MXKSwiftHeader.h" + NSString *const kMXKWebViewViewControllerPostMessageJSLog = @"jsLog"; // Override console.* logs methods to send WebKit postMessage events to native code. @@ -158,7 +160,7 @@ - (void)viewDidLoad [self.view addConstraint:bottomConstraint]; } - backButton = [[UIBarButtonItem alloc] initWithTitle:[NSBundle mxk_localizedStringForKey:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(goBack)]; + backButton = [[UIBarButtonItem alloc] initWithTitle:[MatrixKitL10n back] style:UIBarButtonItemStylePlain target:self action:@selector(goBack)]; if (_URL.length) { diff --git a/MatrixKit/Generated/Strings.swift b/MatrixKit/Generated/Strings.swift index 2767d3c1f..dcfd2c2f1 100644 --- a/MatrixKit/Generated/Strings.swift +++ b/MatrixKit/Generated/Strings.swift @@ -1339,6 +1339,10 @@ public class MatrixKitL10n: NSObject { public static var rejectCall: String { return MatrixKitL10n.tr("reject_call") } + /// Rename + public static var rename: String { + return MatrixKitL10n.tr("rename") + } /// Resend public static var resend: String { return MatrixKitL10n.tr("resend") diff --git a/MatrixKit/Models/Account/MXKAccount.m b/MatrixKit/Models/Account/MXKAccount.m index 47aa14381..d8afdfb16 100644 --- a/MatrixKit/Models/Account/MXKAccount.m +++ b/MatrixKit/Models/Account/MXKAccount.m @@ -33,6 +33,8 @@ #import +#import "MXKSwiftHeader.h" + NSString *const kMXKAccountUserInfoDidChangeNotification = @"kMXKAccountUserInfoDidChangeNotification"; NSString *const kMXKAccountAPNSActivityDidChangeNotification = @"kMXKAccountAPNSActivityDidChangeNotification"; NSString *const kMXKAccountPushKitActivityDidChangeNotification = @"kMXKAccountPushKitActivityDidChangeNotification"; @@ -454,7 +456,7 @@ - (void)enablePushNotifications:(BOOL)enable code:0 userInfo:@{ NSLocalizedDescriptionKey: - [NSBundle mxk_localizedStringForKey:@"account_error_push_not_allowed"] + [MatrixKitL10n accountErrorPushNotAllowed] }]; if (failure) { @@ -531,7 +533,7 @@ - (void)enablePushKitNotifications:(BOOL)enable code:0 userInfo:@{ NSLocalizedDescriptionKey: - [NSBundle mxk_localizedStringForKey:@"account_error_push_not_allowed"] + [MatrixKitL10n accountErrorPushNotAllowed] }]; failure (error); } @@ -648,7 +650,7 @@ - (void)setUserDisplayName:(NSString*)displayname success:(void (^)(void))succes } else if (failure) { - failure ([NSError errorWithDomain:kMXKAccountErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey: [NSBundle mxk_localizedStringForKey:@"account_error_matrix_session_is_not_opened"]}]); + failure ([NSError errorWithDomain:kMXKAccountErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey: [MatrixKitL10n accountErrorMatrixSessionIsNotOpened]}]); } } @@ -668,7 +670,7 @@ - (void)setUserAvatarUrl:(NSString*)avatarUrl success:(void (^)(void))success fa } else if (failure) { - failure ([NSError errorWithDomain:kMXKAccountErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey: [NSBundle mxk_localizedStringForKey:@"account_error_matrix_session_is_not_opened"]}]); + failure ([NSError errorWithDomain:kMXKAccountErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey: [MatrixKitL10n accountErrorMatrixSessionIsNotOpened]}]); } } @@ -689,7 +691,7 @@ - (void)changePassword:(NSString*)oldPassword with:(NSString*)newPassword succes } else if (failure) { - failure ([NSError errorWithDomain:kMXKAccountErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey: [NSBundle mxk_localizedStringForKey:@"account_error_matrix_session_is_not_opened"]}]); + failure ([NSError errorWithDomain:kMXKAccountErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey: [MatrixKitL10n accountErrorMatrixSessionIsNotOpened]}]); } } diff --git a/MatrixKit/Models/Contact/MXKContactManager.m b/MatrixKit/Models/Contact/MXKContactManager.m index 5a63ce9a8..def4967d5 100644 --- a/MatrixKit/Models/Contact/MXKContactManager.m +++ b/MatrixKit/Models/Contact/MXKContactManager.m @@ -27,6 +27,8 @@ #import #import +#import "MXKSwiftHeader.h" + NSString *const kMXKContactManagerDidUpdateMatrixContactsNotification = @"kMXKContactManagerDidUpdateMatrixContactsNotification"; NSString *const kMXKContactManagerDidUpdateLocalContactsNotification = @"kMXKContactManagerDidUpdateLocalContactsNotification"; @@ -1138,9 +1140,9 @@ + (void)requestUserConfirmationForLocalContactsSyncInViewController:(UIViewContr { NSString *appDisplayName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]; - [MXKContactManager requestUserConfirmationForLocalContactsSyncWithTitle:[NSBundle mxk_localizedStringForKey:@"local_contacts_access_discovery_warning_title"] - message:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"local_contacts_access_discovery_warning"], appDisplayName] - manualPermissionChangeMessage:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"local_contacts_access_not_granted"], appDisplayName] + [MXKContactManager requestUserConfirmationForLocalContactsSyncWithTitle:[MatrixKitL10n localContactsAccessDiscoveryWarningTitle] + message:[MatrixKitL10n localContactsAccessDiscoveryWarning:appDisplayName] + manualPermissionChangeMessage:[MatrixKitL10n localContactsAccessNotGranted:appDisplayName] showPopUpInViewController:viewController completionHandler:handler]; } @@ -1159,7 +1161,7 @@ + (void)requestUserConfirmationForLocalContactsSyncWithTitle:(NSString*)title { UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1170,7 +1172,7 @@ + (void)requestUserConfirmationForLocalContactsSyncWithTitle:(NSString*)title }]]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { diff --git a/MatrixKit/Models/Group/MXKSessionGroupsDataSource.m b/MatrixKit/Models/Group/MXKSessionGroupsDataSource.m index 2b256e9c7..cb9f7a948 100644 --- a/MatrixKit/Models/Group/MXKSessionGroupsDataSource.m +++ b/MatrixKit/Models/Group/MXKSessionGroupsDataSource.m @@ -22,6 +22,8 @@ #import "MXKConstants.h" +#import "MXKSwiftHeader.h" + #pragma mark - Constant definitions NSString *const kMXKGroupCellIdentifier = @"kMXKGroupCellIdentifier"; @@ -512,11 +514,11 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte if (section == _groupInvitesSection) { - sectionTitle = [NSBundle mxk_localizedStringForKey:@"group_invite_section"]; + sectionTitle = [MatrixKitL10n groupInviteSection]; } else if (section == _joinedGroupsSection) { - sectionTitle = [NSBundle mxk_localizedStringForKey:@"group_section"]; + sectionTitle = [MatrixKitL10n groupSection]; } return sectionTitle; diff --git a/MatrixKit/Models/PublicRoomList/DirectoryServerList/MXKDirectoryServerCellData.m b/MatrixKit/Models/PublicRoomList/DirectoryServerList/MXKDirectoryServerCellData.m index 606f2e900..e1f80368b 100644 --- a/MatrixKit/Models/PublicRoomList/DirectoryServerList/MXKDirectoryServerCellData.m +++ b/MatrixKit/Models/PublicRoomList/DirectoryServerList/MXKDirectoryServerCellData.m @@ -19,6 +19,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @implementation MXKDirectoryServerCellData; @synthesize desc, icon; @synthesize homeserver, includeAllNetworks; @@ -41,7 +43,7 @@ - (id)initWithHomeserver:(NSString *)theHomeserver includeAllNetworks:(BOOL)theI else { // Use the Matrix name and logo when looking for Matrix rooms only - desc = [NSBundle mxk_localizedStringForKey:@"matrix"]; + desc = [MatrixKitL10n matrix]; icon = [NSBundle mxk_imageFromMXKAssetsBundleWithName:@"network_matrix"]; } } diff --git a/MatrixKit/Utils/ErrorPresentation/MXKErrorAlertPresentation.m b/MatrixKit/Utils/ErrorPresentation/MXKErrorAlertPresentation.m index 149c574a4..c8ff3ad96 100644 --- a/MatrixKit/Utils/ErrorPresentation/MXKErrorAlertPresentation.m +++ b/MatrixKit/Utils/ErrorPresentation/MXKErrorAlertPresentation.m @@ -19,6 +19,8 @@ #import "MXKErrorPresentableBuilder.h" #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @interface MXKErrorAlertPresentation() @property (nonatomic, strong) MXKErrorPresentableBuilder *errorPresentableBuidler; @@ -51,7 +53,7 @@ - (void)presentErrorFromViewController:(UIViewController*)viewController UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { if (handler) diff --git a/MatrixKit/Utils/ErrorPresentation/MXKErrorPresentableBuilder.m b/MatrixKit/Utils/ErrorPresentation/MXKErrorPresentableBuilder.m index 66241b8c6..10c1aca39 100644 --- a/MatrixKit/Utils/ErrorPresentation/MXKErrorPresentableBuilder.m +++ b/MatrixKit/Utils/ErrorPresentation/MXKErrorPresentableBuilder.m @@ -19,6 +19,8 @@ #import "NSBundle+MatrixKit.h" #import "MXKErrorViewModel.h" +#import "MXKSwiftHeader.h" + @implementation MXKErrorPresentableBuilder - (id )errorPresentableFromError:(NSError*)error @@ -34,12 +36,12 @@ @implementation MXKErrorPresentableBuilder if (!title) { - title = [NSBundle mxk_localizedStringForKey:@"error"]; + title = [MatrixKitL10n error]; } if (!message) { - message = [NSBundle mxk_localizedStringForKey:@"error_common_message"]; + message = [MatrixKitL10n errorCommonMessage]; } return [[MXKErrorViewModel alloc] initWithTitle:title message:message]; @@ -47,8 +49,8 @@ @implementation MXKErrorPresentableBuilder - (id )commonErrorPresentable { - return [[MXKErrorViewModel alloc] initWithTitle:[NSBundle mxk_localizedStringForKey:@"error"] - message:[NSBundle mxk_localizedStringForKey:@"error_common_message"]]; + return [[MXKErrorViewModel alloc] initWithTitle:[MatrixKitL10n error] + message:[MatrixKitL10n errorCommonMessage]]; } @end diff --git a/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m b/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m index 516f26b77..d12e16300 100644 --- a/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m +++ b/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m @@ -351,29 +351,27 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if ([redactorId isEqualToString:mxSession.myUserId]) { - NSString *formatString = [NSString stringWithFormat:@"%@%@", [NSBundle mxk_localizedStringForKey:@"notice_event_redacted_by_you"], [NSBundle mxk_localizedStringForKey:@"notice_event_redacted_reason"]]; - redactedBy = [NSString stringWithFormat:formatString, redactedReason]; + redactedBy = [NSString stringWithFormat:@"%@%@", [MatrixKitL10n noticeEventRedactedByYou], [MatrixKitL10n noticeEventRedactedReason:redactedReason]]; } else if (redactedBy.length) { - NSString *formatString = [NSString stringWithFormat:@"%@%@", [NSBundle mxk_localizedStringForKey:@"notice_event_redacted_by"], [NSBundle mxk_localizedStringForKey:@"notice_event_redacted_reason"]]; - redactedBy = [NSString stringWithFormat:formatString, redactedBy, redactedReason]; + redactedBy = [NSString stringWithFormat:@"%@%@", [MatrixKitL10n noticeEventRedactedBy:redactedBy], [MatrixKitL10n noticeEventRedactedReason:redactedReason]]; } else { - redactedBy = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_event_redacted_reason"], redactedReason]; + redactedBy = [MatrixKitL10n noticeEventRedactedReason:redactedReason]; } } else if ([redactorId isEqualToString:mxSession.myUserId]) { - redactedBy = [NSBundle mxk_localizedStringForKey:@"notice_event_redacted_by_you"]; + redactedBy = [MatrixKitL10n noticeEventRedactedByYou]; } else if (redactedBy.length) { - redactedBy = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_event_redacted_by"], redactedBy]; + redactedBy = [MatrixKitL10n noticeEventRedactedBy:redactedBy]; } - redactedInfo = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_event_redacted"], redactedBy]; + redactedInfo = [MatrixKitL10n noticeEventRedacted:redactedBy]; } } @@ -409,22 +407,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_name_changed_by_you_for_dm"], roomName]; + displayText = [MatrixKitL10n noticeRoomNameChangedByYouForDm:roomName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_name_changed_by_you"], roomName]; + displayText = [MatrixKitL10n noticeRoomNameChangedByYou:roomName]; } } else { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_name_changed_for_dm"], senderDisplayName, roomName]; + displayText = [MatrixKitL10n noticeRoomNameChangedForDm:senderDisplayName :roomName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_name_changed"], senderDisplayName, roomName]; + displayText = [MatrixKitL10n noticeRoomNameChanged:senderDisplayName :roomName]; } } } @@ -434,22 +432,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_name_removed_by_you_for_dm"]; + displayText = [MatrixKitL10n noticeRoomNameRemovedByYouForDm]; } else { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_name_removed_by_you"]; + displayText = [MatrixKitL10n noticeRoomNameRemovedByYou]; } } else { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_name_removed_for_dm"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomNameRemovedForDm:senderDisplayName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_name_removed"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomNameRemoved:senderDisplayName]; } } } @@ -474,22 +472,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_topic_changed_by_you"], roomTopic]; + displayText = [MatrixKitL10n noticeTopicChangedByYou:roomTopic]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_topic_changed"], senderDisplayName, roomTopic]; + displayText = [MatrixKitL10n noticeTopicChanged:senderDisplayName :roomTopic]; } } else { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_topic_removed_by_you"]; + displayText = [MatrixKitL10n noticeRoomTopicRemovedByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_topic_removed"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomTopicRemoved:senderDisplayName]; } } @@ -512,11 +510,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState } if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_profile_change_redacted_by_you"], redactedInfo]; + displayText = [MatrixKitL10n noticeProfileChangeRedactedByYou:redactedInfo]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_profile_change_redacted"], senderDisplayName, redactedInfo]; + displayText = [MatrixKitL10n noticeProfileChangeRedacted:senderDisplayName :redactedInfo]; } } else @@ -541,33 +539,33 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_display_name_set_by_you"], displayname]; + displayText = [MatrixKitL10n noticeDisplayNameSetByYou:displayname]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_display_name_set"], event.sender, displayname]; + displayText = [MatrixKitL10n noticeDisplayNameSet:event.sender :displayname]; } } else if (!displayname) { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_display_name_removed_by_you"]; + displayText = [MatrixKitL10n noticeDisplayNameRemovedByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_display_name_removed"], event.sender]; + displayText = [MatrixKitL10n noticeDisplayNameRemoved:event.sender]; } } else { if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_display_name_changed_from_by_you"], prevDisplayname, displayname]; + displayText = [MatrixKitL10n noticeDisplayNameChangedFromByYou:prevDisplayname :displayname]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_display_name_changed_from"], event.sender, prevDisplayname, displayname]; + displayText = [MatrixKitL10n noticeDisplayNameChangedFrom:event.sender :prevDisplayname :displayname]; } } } @@ -590,17 +588,17 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (displayText) { - displayText = [NSString stringWithFormat:@"%@ %@", displayText, [NSBundle mxk_localizedStringForKey:@"notice_avatar_changed_too"]]; + displayText = [NSString stringWithFormat:@"%@ %@", displayText, [MatrixKitL10n noticeAvatarChangedToo]]; } else { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_avatar_url_changed_by_you"]; + displayText = [MatrixKitL10n noticeAvatarUrlChangedByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_avatar_url_changed"], senderDisplayName]; + displayText = [MatrixKitL10n noticeAvatarUrlChanged:senderDisplayName]; } } } @@ -628,11 +626,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if ([event.stateKey isEqualToString:mxSession.myUserId]) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_third_party_registered_invite_by_you"], event.content[@"third_party_invite"][@"display_name"]]; + displayText = [MatrixKitL10n noticeRoomThirdPartyRegisteredInviteByYou:event.content[@"third_party_invite"][@"display_name"]]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_third_party_registered_invite"], targetDisplayName, event.content[@"third_party_invite"][@"display_name"]]; + displayText = [MatrixKitL10n noticeRoomThirdPartyRegisteredInvite:targetDisplayName :event.content[@"third_party_invite"][@"display_name"]]; } } else @@ -641,11 +639,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_conference_call_request_by_you"]; + displayText = [MatrixKitL10n noticeConferenceCallRequestByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_conference_call_request"], senderDisplayName]; + displayText = [MatrixKitL10n noticeConferenceCallRequest:senderDisplayName]; } } else @@ -653,11 +651,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState // The targeted member display name (if any) is available in content if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_invite_by_you"], targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomInviteByYou:targetDisplayName]; } else if ([targetDisplayName isEqualToString:mxSession.myUserId]) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_invite_you"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomInviteYou:senderDisplayName]; } else { @@ -666,7 +664,7 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState targetDisplayName = contentDisplayname; } - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_invite"], senderDisplayName, targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomInvite:senderDisplayName :targetDisplayName]; } } } @@ -675,14 +673,14 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if ([MXCallManager isConferenceUser:event.stateKey]) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_conference_call_started"]; + displayText = [MatrixKitL10n noticeConferenceCallStarted]; } else { // The targeted member display name (if any) is available in content if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_join_by_you"]; + displayText = [MatrixKitL10n noticeRoomJoinByYou]; } else { @@ -691,7 +689,7 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState targetDisplayName = contentDisplayname; } - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_join"], targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomJoin:targetDisplayName]; } } } @@ -713,7 +711,7 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if ([MXCallManager isConferenceUser:event.stateKey]) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_conference_call_finished"]; + displayText = [MatrixKitL10n noticeConferenceCallFinished]; } else { @@ -721,22 +719,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_reject_by_you"]; + displayText = [MatrixKitL10n noticeRoomRejectByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_reject"], targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomReject:targetDisplayName]; } } else { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_leave_by_you"]; + displayText = [MatrixKitL10n noticeRoomLeaveByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_leave"], targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomLeave:targetDisplayName]; } } } @@ -747,15 +745,15 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_withdraw_by_you"], targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomWithdrawByYou:targetDisplayName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_withdraw"], senderDisplayName, targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomWithdraw:senderDisplayName :targetDisplayName]; } if (event.content[@"reason"]) { - displayText = [displayText stringByAppendingString:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_reason"], event.content[@"reason"]]]; + displayText = [displayText stringByAppendingString:[MatrixKitL10n noticeRoomReason:event.content[@"reason"]]]; } } @@ -763,28 +761,28 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_kick_by_you"], targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomKickByYou:targetDisplayName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_kick"], senderDisplayName, targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomKick:senderDisplayName :targetDisplayName]; } // add reason if exists if (event.content[@"reason"]) { - displayText = [displayText stringByAppendingString:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_reason"], event.content[@"reason"]]]; + displayText = [displayText stringByAppendingString:[MatrixKitL10n noticeRoomReason:event.content[@"reason"]]]; } } else if ([prevMembership isEqualToString:@"ban"]) { if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_unban_by_you"], targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomUnbanByYou:targetDisplayName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_unban"], senderDisplayName, targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomUnban:senderDisplayName :targetDisplayName]; } } } @@ -799,15 +797,15 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_ban_by_you"], targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomBanByYou:targetDisplayName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_ban"], senderDisplayName, targetDisplayName]; + displayText = [MatrixKitL10n noticeRoomBan:senderDisplayName :targetDisplayName]; } if (event.content[@"reason"]) { - displayText = [displayText stringByAppendingString:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_reason"], event.content[@"reason"]]]; + displayText = [displayText stringByAppendingString:[MatrixKitL10n noticeRoomReason:event.content[@"reason"]]]; } } @@ -835,22 +833,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_created_by_you_for_dm"]; + displayText = [MatrixKitL10n noticeRoomCreatedByYouForDm]; } else { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_created_by_you"]; + displayText = [MatrixKitL10n noticeRoomCreatedByYou]; } } else { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_created_for_dm"], (roomState ? [roomState.members memberName:creatorId] : creatorId)]; + displayText = [MatrixKitL10n noticeRoomCreatedForDm:(roomState ? [roomState.members memberName:creatorId] : creatorId)]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_created"], (roomState ? [roomState.members memberName:creatorId] : creatorId)]; + displayText = [MatrixKitL10n noticeRoomCreated:(roomState ? [roomState.members memberName:creatorId] : creatorId)]; } } // Append redacted info if any @@ -874,22 +872,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_join_rule_public_by_you_for_dm"]; + displayText = [MatrixKitL10n noticeRoomJoinRulePublicByYouForDm]; } else { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_join_rule_public_by_you"]; + displayText = [MatrixKitL10n noticeRoomJoinRulePublicByYou]; } } else if ([joinRule isEqualToString:kMXRoomJoinRuleInvite]) { if (isRoomDirect) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_join_rule_invite_by_you_for_dm"]; + displayText = [MatrixKitL10n noticeRoomJoinRuleInviteByYouForDm]; } else { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_join_rule_invite_by_you"]; + displayText = [MatrixKitL10n noticeRoomJoinRuleInviteByYou]; } } } @@ -900,22 +898,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_join_rule_public_for_dm"], displayName]; + displayText = [MatrixKitL10n noticeRoomJoinRulePublicForDm:displayName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_join_rule_public"], displayName]; + displayText = [MatrixKitL10n noticeRoomJoinRulePublic:displayName]; } } else if ([joinRule isEqualToString:kMXRoomJoinRuleInvite]) { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_join_rule_invite_for_dm"], displayName]; + displayText = [MatrixKitL10n noticeRoomJoinRuleInviteForDm:displayName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_join_rule_invite"], displayName]; + displayText = [MatrixKitL10n noticeRoomJoinRuleInvite:displayName]; } } } @@ -923,7 +921,7 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState if (!displayText) { // use old string for non-handled cases: "knock" and "private" - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_join_rule"], joinRule]; + displayText = [MatrixKitL10n noticeRoomJoinRule:joinRule]; } // Append redacted info if any @@ -938,11 +936,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_power_level_intro_for_dm"]; + displayText = [MatrixKitL10n noticeRoomPowerLevelIntroForDm]; } else { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_power_level_intro"]; + displayText = [MatrixKitL10n noticeRoomPowerLevelIntro]; } NSDictionary *users; MXJSONModelSetDictionary(users, event.content[@"users"]); @@ -953,10 +951,10 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState } if (event.content[@"users_default"]) { - displayText = [NSString stringWithFormat:@"%@\n\u2022 %@: %@", displayText, [NSBundle mxk_localizedStringForKey:@"default"], event.content[@"users_default"]]; + displayText = [NSString stringWithFormat:@"%@\n\u2022 %@: %@", displayText, [MatrixKitL10n default], event.content[@"users_default"]]; } - displayText = [NSString stringWithFormat:@"%@\n%@", displayText, [NSBundle mxk_localizedStringForKey:@"notice_room_power_level_acting_requirement"]]; + displayText = [NSString stringWithFormat:@"%@\n%@", displayText, [MatrixKitL10n noticeRoomPowerLevelActingRequirement]]; if (event.content[@"ban"]) { displayText = [NSString stringWithFormat:@"%@\n\u2022 ban: %@", displayText, event.content[@"ban"]]; @@ -974,7 +972,7 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState displayText = [NSString stringWithFormat:@"%@\n\u2022 invite: %@", displayText, event.content[@"invite"]]; } - displayText = [NSString stringWithFormat:@"%@\n%@", displayText, [NSBundle mxk_localizedStringForKey:@"notice_room_power_level_event_requirement"]]; + displayText = [NSString stringWithFormat:@"%@\n%@", displayText, [MatrixKitL10n noticeRoomPowerLevelEventRequirement]]; NSDictionary *events; MXJSONModelSetDictionary(events, event.content[@"events"]); @@ -1006,11 +1004,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_aliases_for_dm"], aliases]; + displayText = [MatrixKitL10n noticeRoomAliasesForDm:aliases]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_aliases"], aliases]; + displayText = [MatrixKitL10n noticeRoomAliases:aliases]; } // Append redacted info if any if (redactedInfo) @@ -1026,7 +1024,7 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState MXJSONModelSetArray(groups, event.content[@"groups"]); if (groups) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_related_groups"], groups]; + displayText = [MatrixKitL10n noticeRoomRelatedGroups:groups]; // Append redacted info if any if (redactedInfo) { @@ -1065,7 +1063,7 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState && event.decryptionError.code == MXDecryptingErrorUnknownInboundSessionIdCode) { // Make the unknown inbound session id error description more user friendly - errorDescription = [NSBundle mxk_localizedStringForKey:@"notice_crypto_error_unknown_inbound_session_id"]; + errorDescription = [MatrixKitL10n noticeCryptoErrorUnknownInboundSessionId]; } else if ([event.decryptionError.domain isEqualToString:MXDecryptingErrorDomain] && event.decryptionError.code == MXDecryptingErrorDuplicateMessageIndexCode) @@ -1081,12 +1079,12 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState if (errorDescription) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_crypto_unable_to_decrypt"], errorDescription]; + displayText = [MatrixKitL10n noticeCryptoUnableToDecrypt:errorDescription]; } } else { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_encrypted_message"]; + displayText = [MatrixKitL10n noticeEncryptedMessage]; } } @@ -1111,22 +1109,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_encryption_enabled_ok_by_you"]; + displayText = [MatrixKitL10n noticeEncryptionEnabledOkByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_encryption_enabled_ok"], senderDisplayName]; + displayText = [MatrixKitL10n noticeEncryptionEnabledOk:senderDisplayName]; } } else { if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_encryption_enabled_unknown_algorithm_by_you"], algorithm]; + displayText = [MatrixKitL10n noticeEncryptionEnabledUnknownAlgorithmByYou:algorithm]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_encryption_enabled_unknown_algorithm"], senderDisplayName, algorithm]; + displayText = [MatrixKitL10n noticeEncryptionEnabledUnknownAlgorithm:senderDisplayName :algorithm]; } } @@ -1151,11 +1149,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_anyone_by_you"]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToAnyoneByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_anyone"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToAnyone:senderDisplayName]; } } } @@ -1165,22 +1163,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_by_you_for_dm"]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersByYouForDm]; } else { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_by_you"]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersByYou]; } } else { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_for_dm"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersForDm:senderDisplayName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembers:senderDisplayName]; } } } @@ -1190,22 +1188,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_from_invited_point_by_you_for_dm"]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersFromInvitedPointByYouForDm]; } else { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_from_invited_point_by_you"]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersFromInvitedPointByYou]; } } else { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_from_invited_point_for_dm"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersFromInvitedPointForDm:senderDisplayName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_from_invited_point"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersFromInvitedPoint:senderDisplayName]; } } } @@ -1215,22 +1213,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_from_joined_point_by_you_for_dm"]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersFromJoinedPointByYouForDm]; } else { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_from_joined_point_by_you"]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersFromJoinedPointByYou]; } } else { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_from_joined_point_for_dm"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersFromJoinedPointForDm:senderDisplayName]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_history_visible_to_members_from_joined_point"], senderDisplayName]; + displayText = [MatrixKitL10n noticeRoomHistoryVisibleToMembersFromJoinedPoint:senderDisplayName]; } } } @@ -1277,74 +1275,74 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if ([msgtype isEqualToString:kMXMessageTypeImage]) { - body = body? body : [NSBundle mxk_localizedStringForKey:@"notice_image_attachment"]; + body = body? body : [MatrixKitL10n noticeImageAttachment]; // Check attachment validity if (![self isSupportedAttachment:event]) { MXLogDebug(@"[MXKEventFormatter] Warning: Unsupported attachment %@", event.description); - body = [NSBundle mxk_localizedStringForKey:@"notice_invalid_attachment"]; + body = [MatrixKitL10n noticeInvalidAttachment]; *error = MXKEventFormatterErrorUnsupported; } } else if ([msgtype isEqualToString:kMXMessageTypeAudio]) { - body = body? body : [NSBundle mxk_localizedStringForKey:@"notice_audio_attachment"]; + body = body? body : [MatrixKitL10n noticeAudioAttachment]; if (![self isSupportedAttachment:event]) { MXLogDebug(@"[MXKEventFormatter] Warning: Unsupported attachment %@", event.description); if (_isForSubtitle || !_settings.showUnsupportedEventsInRoomHistory) { - body = [NSBundle mxk_localizedStringForKey:@"notice_invalid_attachment"]; + body = [MatrixKitL10n noticeInvalidAttachment]; } else { - body = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_unsupported_attachment"], event.description]; + body = [MatrixKitL10n noticeUnsupportedAttachment:event.description]; } *error = MXKEventFormatterErrorUnsupported; } } else if ([msgtype isEqualToString:kMXMessageTypeVideo]) { - body = body? body : [NSBundle mxk_localizedStringForKey:@"notice_video_attachment"]; + body = body? body : [MatrixKitL10n noticeVideoAttachment]; if (![self isSupportedAttachment:event]) { MXLogDebug(@"[MXKEventFormatter] Warning: Unsupported attachment %@", event.description); if (_isForSubtitle || !_settings.showUnsupportedEventsInRoomHistory) { - body = [NSBundle mxk_localizedStringForKey:@"notice_invalid_attachment"]; + body = [MatrixKitL10n noticeInvalidAttachment]; } else { - body = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_unsupported_attachment"], event.description]; + body = [MatrixKitL10n noticeUnsupportedAttachment:event.description]; } *error = MXKEventFormatterErrorUnsupported; } } else if ([msgtype isEqualToString:kMXMessageTypeLocation]) { - body = body? body : [NSBundle mxk_localizedStringForKey:@"notice_location_attachment"]; + body = body? body : [MatrixKitL10n noticeLocationAttachment]; if (![self isSupportedAttachment:event]) { MXLogDebug(@"[MXKEventFormatter] Warning: Unsupported attachment %@", event.description); if (_isForSubtitle || !_settings.showUnsupportedEventsInRoomHistory) { - body = [NSBundle mxk_localizedStringForKey:@"notice_invalid_attachment"]; + body = [MatrixKitL10n noticeInvalidAttachment]; } else { - body = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_unsupported_attachment"], event.description]; + body = [MatrixKitL10n noticeUnsupportedAttachment:event.description]; } *error = MXKEventFormatterErrorUnsupported; } } else if ([msgtype isEqualToString:kMXMessageTypeFile]) { - body = body? body : [NSBundle mxk_localizedStringForKey:@"notice_file_attachment"]; + body = body? body : [MatrixKitL10n noticeFileAttachment]; // Check attachment validity if (![self isSupportedAttachment:event]) { MXLogDebug(@"[MXKEventFormatter] Warning: Unsupported attachment %@", event.description); - body = [NSBundle mxk_localizedStringForKey:@"notice_invalid_attachment"]; + body = [MatrixKitL10n noticeInvalidAttachment]; *error = MXKEventFormatterErrorUnsupported; } } @@ -1410,7 +1408,7 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState if (type && eventId) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_feedback"], eventId, type]; + displayText = [MatrixKitL10n noticeFeedback:eventId :type]; // Append redacted info if any if (redactedInfo) { @@ -1424,11 +1422,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState NSString *eventId = event.redacts; if (isEventSenderMyUser) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_redaction_by_you"], eventId]; + displayText = [MatrixKitL10n noticeRedactionByYou:eventId]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_redaction"], senderDisplayName, eventId]; + displayText = [MatrixKitL10n noticeRedaction:senderDisplayName :eventId]; } break; } @@ -1442,22 +1440,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_third_party_invite_by_you_for_dm"], displayname]; + displayText = [MatrixKitL10n noticeRoomThirdPartyInviteByYouForDm:displayname]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_third_party_invite_by_you"], displayname]; + displayText = [MatrixKitL10n noticeRoomThirdPartyInviteByYou:displayname]; } } else { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_third_party_invite_for_dm"], senderDisplayName, displayname]; + displayText = [MatrixKitL10n noticeRoomThirdPartyInviteForDm:senderDisplayName :displayname]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_third_party_invite"], senderDisplayName, displayname]; + displayText = [MatrixKitL10n noticeRoomThirdPartyInvite:senderDisplayName :displayname]; } } } @@ -1469,22 +1467,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_third_party_revoked_invite_by_you_for_dm"], displayname]; + displayText = [MatrixKitL10n noticeRoomThirdPartyRevokedInviteByYouForDm:displayname]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_third_party_revoked_invite_by_you"], displayname]; + displayText = [MatrixKitL10n noticeRoomThirdPartyRevokedInviteByYou:displayname]; } } else { if (isRoomDirect) { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_third_party_revoked_invite_for_dm"], senderDisplayName, displayname]; + displayText = [MatrixKitL10n noticeRoomThirdPartyRevokedInviteForDm:senderDisplayName :displayname]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_third_party_revoked_invite"], senderDisplayName, displayname]; + displayText = [MatrixKitL10n noticeRoomThirdPartyRevokedInvite:senderDisplayName :displayname]; } } } @@ -1498,22 +1496,22 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_placed_video_call_by_you"]; + displayText = [MatrixKitL10n noticePlacedVideoCallByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_placed_video_call"], senderDisplayName]; + displayText = [MatrixKitL10n noticePlacedVideoCall:senderDisplayName]; } } else { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_placed_voice_call_by_you"]; + displayText = [MatrixKitL10n noticePlacedVoiceCallByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_placed_voice_call"], senderDisplayName]; + displayText = [MatrixKitL10n noticePlacedVoiceCall:senderDisplayName]; } } break; @@ -1522,11 +1520,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_answered_video_call_by_you"]; + displayText = [MatrixKitL10n noticeAnsweredVideoCallByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_answered_video_call"], senderDisplayName]; + displayText = [MatrixKitL10n noticeAnsweredVideoCall:senderDisplayName]; } break; } @@ -1534,11 +1532,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_ended_video_call_by_you"]; + displayText = [MatrixKitL10n noticeEndedVideoCallByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_ended_video_call"], senderDisplayName]; + displayText = [MatrixKitL10n noticeEndedVideoCall:senderDisplayName]; } break; } @@ -1546,11 +1544,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState { if (isEventSenderMyUser) { - displayText = [NSBundle mxk_localizedStringForKey:@"notice_declined_video_call_by_you"]; + displayText = [MatrixKitL10n noticeDeclinedVideoCallByYou]; } else { - displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_declined_video_call"], senderDisplayName]; + displayText = [MatrixKitL10n noticeDeclinedVideoCall:senderDisplayName]; } break; } @@ -1575,11 +1573,11 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState if (![self isSupportedAttachment:event]) { MXLogDebug(@"[MXKEventFormatter] Warning: Unsupported sticker %@", event.description); - body = [NSBundle mxk_localizedStringForKey:@"notice_invalid_attachment"]; + body = [MatrixKitL10n noticeInvalidAttachment]; *error = MXKEventFormatterErrorUnsupported; } - displayText = body? body : [NSBundle mxk_localizedStringForKey:@"notice_sticker"]; + displayText = body? body : [MatrixKitL10n noticeSticker]; } break; } @@ -1610,13 +1608,13 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState switch (*error) { case MXKEventFormatterErrorUnsupported: - shortDescription = [NSBundle mxk_localizedStringForKey:@"notice_error_unsupported_event"]; + shortDescription = [MatrixKitL10n noticeErrorUnsupportedEvent]; break; case MXKEventFormatterErrorUnexpected: - shortDescription = [NSBundle mxk_localizedStringForKey:@"notice_error_unexpected_event"]; + shortDescription = [MatrixKitL10n noticeErrorUnexpectedEvent]; break; case MXKEventFormatterErrorUnknownEventType: - shortDescription = [NSBundle mxk_localizedStringForKey:@"notice_error_unknown_event_type"]; + shortDescription = [MatrixKitL10n noticeErrorUnknownEventType]; break; default: @@ -1820,7 +1818,7 @@ - (NSString*)renderReplyTo:(NSString*)htmlString withRoomState:(MXRoomState*)roo if (inReplyToTextRange.location != NSNotFound) { - html = [html stringByReplacingCharactersInRange:inReplyToTextRange withString:[NSBundle mxk_localizedStringForKey:@"notice_in_reply_to"]]; + html = [html stringByReplacingCharactersInRange:inReplyToTextRange withString:[MatrixKitL10n noticeInReplyTo]]; } if (inReplyToLinkRange.location != NSNotFound) diff --git a/MatrixKit/Utils/EventFormatter/MXKRoomNameStringLocalizations.m b/MatrixKit/Utils/EventFormatter/MXKRoomNameStringLocalizations.m index e748719a2..d3d6c81ea 100644 --- a/MatrixKit/Utils/EventFormatter/MXKRoomNameStringLocalizations.m +++ b/MatrixKit/Utils/EventFormatter/MXKRoomNameStringLocalizations.m @@ -18,6 +18,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @implementation MXKRoomNameStringLocalizations - (instancetype)init @@ -25,7 +27,7 @@ - (instancetype)init self = [super init]; if (self) { - _emptyRoom = [NSBundle mxk_localizedStringForKey:@"room_displayname_empty_room"]; + _emptyRoom = [MatrixKitL10n roomDisplaynameEmptyRoom]; _twoMembers = [NSBundle mxk_localizedStringForKey:@"room_displayname_two_members"]; _moreThanTwoMembers = [NSBundle mxk_localizedStringForKey:@"room_displayname_more_than_two_members"]; } diff --git a/MatrixKit/Utils/MXKTools.m b/MatrixKit/Utils/MXKTools.m index 7d445eaa2..43031e4a8 100644 --- a/MatrixKit/Utils/MXKTools.m +++ b/MatrixKit/Utils/MXKTools.m @@ -24,6 +24,7 @@ #import "NSBundle+MatrixKit.h" #import +#import "MXKSwiftHeader.h" #pragma mark - Constants definitions @@ -184,22 +185,22 @@ + (NSString*)formatSecondsInterval:(CGFloat)secondsInterval if (secondsInterval < 1) { - [formattedString appendFormat:@"< 1%@", [NSBundle mxk_localizedStringForKey:@"format_time_s"]];; + [formattedString appendFormat:@"< 1%@", [MatrixKitL10n formatTimeS]]; } else if (secondsInterval < 60) { - [formattedString appendFormat:@"%d%@", (int)secondsInterval, [NSBundle mxk_localizedStringForKey:@"format_time_s"]]; + [formattedString appendFormat:@"%d%@", (int)secondsInterval, [MatrixKitL10n formatTimeS]]; } else if (secondsInterval < 3600) { - [formattedString appendFormat:@"%d%@ %2d%@", (int)(secondsInterval/60), [NSBundle mxk_localizedStringForKey:@"format_time_m"], - ((int)secondsInterval) % 60, [NSBundle mxk_localizedStringForKey:@"format_time_s"]]; + [formattedString appendFormat:@"%d%@ %2d%@", (int)(secondsInterval/60), [MatrixKitL10n formatTimeM], + ((int)secondsInterval) % 60, [MatrixKitL10n formatTimeS]]; } else if (secondsInterval >= 3600) { - [formattedString appendFormat:@"%d%@ %d%@ %d%@", (int)(secondsInterval / 3600), [NSBundle mxk_localizedStringForKey:@"format_time_h"], - ((int)(secondsInterval) % 3600) / 60, [NSBundle mxk_localizedStringForKey:@"format_time_m"], - (int)(secondsInterval) % 60, [NSBundle mxk_localizedStringForKey:@"format_time_s"]]; + [formattedString appendFormat:@"%d%@ %d%@ %d%@", (int)(secondsInterval / 3600), [MatrixKitL10n formatTimeH], + ((int)(secondsInterval) % 3600) / 60, [MatrixKitL10n formatTimeM], + (int)(secondsInterval) % 60, [MatrixKitL10n formatTimeS]]; } [formattedString appendString:@" left"]; @@ -212,26 +213,26 @@ + (NSString *)formatSecondsIntervalFloored:(CGFloat)secondsInterval if (secondsInterval < 0) { - formattedString = [NSString stringWithFormat:@"0%@", [NSBundle mxk_localizedStringForKey:@"format_time_s"]]; + formattedString = [NSString stringWithFormat:@"0%@", [MatrixKitL10n formatTimeS]]; } else { NSUInteger seconds = secondsInterval; if (seconds < 60) { - formattedString = [NSString stringWithFormat:@"%tu%@", seconds, [NSBundle mxk_localizedStringForKey:@"format_time_s"]]; + formattedString = [NSString stringWithFormat:@"%tu%@", seconds, [MatrixKitL10n formatTimeS]]; } else if (secondsInterval < 3600) { - formattedString = [NSString stringWithFormat:@"%tu%@", seconds / 60, [NSBundle mxk_localizedStringForKey:@"format_time_m"]]; + formattedString = [NSString stringWithFormat:@"%tu%@", seconds / 60, [MatrixKitL10n formatTimeM]]; } else if (secondsInterval < 86400) { - formattedString = [NSString stringWithFormat:@"%tu%@", seconds / 3600, [NSBundle mxk_localizedStringForKey:@"format_time_h"]]; + formattedString = [NSString stringWithFormat:@"%tu%@", seconds / 3600, [MatrixKitL10n formatTimeH]]; } else { - formattedString = [NSString stringWithFormat:@"%tu%@", seconds / 86400, [NSBundle mxk_localizedStringForKey:@"format_time_d"]]; + formattedString = [NSString stringWithFormat:@"%tu%@", seconds / 86400, [MatrixKitL10n formatTimeD]]; } } @@ -712,15 +713,15 @@ + (UIColor*)convertImageToPatternColor:(NSString*)resourceName backgroundColor:( + (UIAlertController*)videoConversionPromptForVideoAsset:(AVAsset *)videoAsset withCompletion:(void (^)(NSString * _Nullable presetName))completion { - UIAlertController *compressionPrompt = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"attachment_size_prompt_title"] - message:[NSBundle mxk_localizedStringForKey:@"attachment_size_prompt_message"] + UIAlertController *compressionPrompt = [UIAlertController alertControllerWithTitle:[MatrixKitL10n attachmentSizePromptTitle] + message:[MatrixKitL10n attachmentSizePromptMessage] preferredStyle:UIAlertControllerStyleActionSheet]; CGSize naturalSize = [videoAsset tracksWithMediaType:AVMediaTypeVideo].firstObject.naturalSize; // Provide 480p as the baseline preset. NSString *fileSizeString = [MXKTools estimatedFileSizeStringForVideoAsset:videoAsset withPresetName:AVAssetExportPreset640x480]; - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_small_with_resolution"], @"480p", fileSizeString]; + NSString *title = [MatrixKitL10n attachmentSmallWithResolution:@"480p" :fileSizeString]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -732,7 +733,7 @@ + (UIAlertController*)videoConversionPromptForVideoAsset:(AVAsset *)videoAsset if (naturalSize.height > 480) { NSString *fileSizeString = [MXKTools estimatedFileSizeStringForVideoAsset:videoAsset withPresetName:AVAssetExportPreset1280x720]; - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_medium_with_resolution"], @"720p", fileSizeString]; + NSString *title = [MatrixKitL10n attachmentMediumWithResolution:@"720p" :fileSizeString]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -745,7 +746,7 @@ + (UIAlertController*)videoConversionPromptForVideoAsset:(AVAsset *)videoAsset if (naturalSize.height > 720) { NSString *fileSizeString = [MXKTools estimatedFileSizeStringForVideoAsset:videoAsset withPresetName:AVAssetExportPreset1920x1080]; - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_large_with_resolution"], @"1080p", fileSizeString]; + NSString *title = [MatrixKitL10n attachmentLargeWithResolution:@"1080p" :fileSizeString]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -754,7 +755,7 @@ + (UIAlertController*)videoConversionPromptForVideoAsset:(AVAsset *)videoAsset }]]; } - [compressionPrompt addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [compressionPrompt addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { // Cancelled. Call the completion with nil. @@ -797,7 +798,7 @@ + (void)checkAccessForMediaType:(NSString *)mediaType UIApplication *sharedApplication = [UIApplication performSelector:@selector(sharedApplication)]; if (sharedApplication && UIApplicationOpenSettingsURLString) { - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"settings"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n settings] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -811,7 +812,7 @@ + (void)checkAccessForMediaType:(NSString *)mediaType }]]; } - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -899,7 +900,7 @@ + (void)checkAccessForContacts:(NSString *)manualChangeMessage UIApplication *sharedApplication = [UIApplication performSelector:@selector(sharedApplication)]; if (sharedApplication && UIApplicationOpenSettingsURLString) { - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"settings"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n settings] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -912,7 +913,7 @@ + (void)checkAccessForContacts:(NSString *)manualChangeMessage }]]; } - [alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { diff --git a/MatrixKit/Views/Authentication/MXKAuthInputsEmailCodeBasedView.m b/MatrixKit/Views/Authentication/MXKAuthInputsEmailCodeBasedView.m index 8b5014ae4..f43aada0d 100644 --- a/MatrixKit/Views/Authentication/MXKAuthInputsEmailCodeBasedView.m +++ b/MatrixKit/Views/Authentication/MXKAuthInputsEmailCodeBasedView.m @@ -18,6 +18,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @implementation MXKAuthInputsEmailCodeBasedView + (UINib *)nib @@ -30,11 +32,11 @@ - (void)awakeFromNib { [super awakeFromNib]; - _userLoginTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"login_user_id_placeholder"]; - _emailAndTokenTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"login_email_placeholder"]; - _promptEmailTokenLabel.text = [NSBundle mxk_localizedStringForKey:@"login_prompt_email_token"]; + _userLoginTextField.placeholder = [MatrixKitL10n loginUserIdPlaceholder]; + _emailAndTokenTextField.placeholder = [MatrixKitL10n loginEmailPlaceholder]; + _promptEmailTokenLabel.text = [MatrixKitL10n loginPromptEmailToken]; - _displayNameTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"login_display_name_placeholder"]; + _displayNameTextField.placeholder = [MatrixKitL10n loginDisplayNamePlaceholder]; } #pragma mark - @@ -82,7 +84,7 @@ - (NSString*)validateParameters { if (!self.areAllRequiredFieldsSet) { - errorMsg = [NSBundle mxk_localizedStringForKey:@"login_invalid_param"]; + errorMsg = [MatrixKitL10n loginInvalidParam]; } } @@ -197,4 +199,4 @@ - (MXAuthenticationSession*)validateAuthenticationSession:(MXAuthenticationSessi return nil; } -@end \ No newline at end of file +@end diff --git a/MatrixKit/Views/Authentication/MXKAuthInputsPasswordBasedView.m b/MatrixKit/Views/Authentication/MXKAuthInputsPasswordBasedView.m index 082afbab2..237a7a1cc 100644 --- a/MatrixKit/Views/Authentication/MXKAuthInputsPasswordBasedView.m +++ b/MatrixKit/Views/Authentication/MXKAuthInputsPasswordBasedView.m @@ -23,6 +23,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @implementation MXKAuthInputsPasswordBasedView + (UINib *)nib @@ -35,12 +37,12 @@ - (void)awakeFromNib { [super awakeFromNib]; - _userLoginTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"login_user_id_placeholder"]; - _passWordTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"login_password_placeholder"]; - _emailTextField.placeholder = [NSString stringWithFormat:@"%@ (%@)", [NSBundle mxk_localizedStringForKey:@"login_email_placeholder"], [NSBundle mxk_localizedStringForKey:@"login_optional_field"]]; - _emailInfoLabel.text = [NSBundle mxk_localizedStringForKey:@"login_email_info"]; + _userLoginTextField.placeholder = [MatrixKitL10n loginUserIdPlaceholder]; + _passWordTextField.placeholder = [MatrixKitL10n loginPasswordPlaceholder]; + _emailTextField.placeholder = [NSString stringWithFormat:@"%@ (%@)", [MatrixKitL10n loginEmailPlaceholder], [MatrixKitL10n loginOptionalField]]; + _emailInfoLabel.text = [MatrixKitL10n loginEmailInfo]; - _displayNameTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"login_display_name_placeholder"]; + _displayNameTextField.placeholder = [MatrixKitL10n loginDisplayNamePlaceholder]; } #pragma mark - @@ -89,7 +91,7 @@ - (NSString*)validateParameters // Check user login and pass fields if (!self.areAllRequiredFieldsSet) { - errorMsg = [NSBundle mxk_localizedStringForKey:@"login_invalid_param"]; + errorMsg = [MatrixKitL10n loginInvalidParam]; } } @@ -103,7 +105,7 @@ - (void)prepareParameters:(void (^)(NSDictionary *parameters, NSError *error))ca // Sanity check on required fields if (!self.areAllRequiredFieldsSet) { - callback(nil, [NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[NSBundle mxk_localizedStringForKey:@"login_invalid_param"]}]); + callback(nil, [NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[MatrixKitL10n loginInvalidParam]}]); return; } diff --git a/MatrixKit/Views/Authentication/MXKAuthInputsView.m b/MatrixKit/Views/Authentication/MXKAuthInputsView.m index 2a420dd5f..3977b6355 100644 --- a/MatrixKit/Views/Authentication/MXKAuthInputsView.m +++ b/MatrixKit/Views/Authentication/MXKAuthInputsView.m @@ -19,6 +19,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + NSString *const MXKAuthErrorDomain = @"MXKAuthErrorDomain"; @implementation MXKAuthInputsView @@ -85,7 +87,7 @@ - (void)prepareParameters:(void (^)(NSDictionary *parameters, NSError *error))ca // Do nothing by default if (callback) { - callback (nil, [NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[NSBundle mxk_localizedStringForKey:@"not_supported_yet"]}]); + callback (nil, [NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[MatrixKitL10n notSupportedYet]}]); } } @@ -94,7 +96,7 @@ - (void)updateAuthSessionWithCompletedStages:(NSArray *)completedStages didUpdat // Do nothing by default if (callback) { - callback (nil, [NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[NSBundle mxk_localizedStringForKey:@"not_supported_yet"]}]); + callback (nil, [NSError errorWithDomain:MXKAuthErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey:[MatrixKitL10n notSupportedYet]}]); } } diff --git a/MatrixKit/Views/DeviceView/MXKDeviceView.m b/MatrixKit/Views/DeviceView/MXKDeviceView.m index 7d6ad60a3..3551e08e2 100644 --- a/MatrixKit/Views/DeviceView/MXKDeviceView.m +++ b/MatrixKit/Views/DeviceView/MXKDeviceView.m @@ -22,6 +22,8 @@ #import "MXKConstants.h" +#import "MXKSwiftHeader.h" + static NSAttributedString *verticalWhitespace = nil; @interface MXKDeviceView () @@ -75,14 +77,14 @@ - (void)awakeFromNib [self.bgView addGestureRecognizer:tap]; // Localize string - [_cancelButton setTitle:[NSBundle mxk_localizedStringForKey:@"ok"] forState:UIControlStateNormal]; - [_cancelButton setTitle:[NSBundle mxk_localizedStringForKey:@"ok"] forState:UIControlStateHighlighted]; + [_cancelButton setTitle:[MatrixKitL10n ok] forState:UIControlStateNormal]; + [_cancelButton setTitle:[MatrixKitL10n ok] forState:UIControlStateHighlighted]; - [_renameButton setTitle:[NSBundle mxk_localizedStringForKey:@"rename"] forState:UIControlStateNormal]; - [_renameButton setTitle:[NSBundle mxk_localizedStringForKey:@"rename"] forState:UIControlStateHighlighted]; + [_renameButton setTitle:[MatrixKitL10n rename] forState:UIControlStateNormal]; + [_renameButton setTitle:[MatrixKitL10n rename] forState:UIControlStateHighlighted]; - [_deleteButton setTitle:[NSBundle mxk_localizedStringForKey:@"delete"] forState:UIControlStateNormal]; - [_deleteButton setTitle:[NSBundle mxk_localizedStringForKey:@"delete"] forState:UIControlStateHighlighted]; + [_deleteButton setTitle:[MatrixKitL10n delete] forState:UIControlStateNormal]; + [_deleteButton setTitle:[MatrixKitL10n delete] forState:UIControlStateHighlighted]; } - (void)layoutSubviews @@ -147,15 +149,15 @@ - (instancetype)initWithDevice:(MXDevice*)device andMatrixSession:(MXSession*)se { // Device information NSMutableAttributedString *deviceInformationString = [[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"device_details_title"] - attributes:@{NSForegroundColorAttributeName : _defaultTextColor, - NSFontAttributeName: [UIFont boldSystemFontOfSize:15]}]; + initWithString:[MatrixKitL10n deviceDetailsTitle] + attributes:@{NSForegroundColorAttributeName : _defaultTextColor, + NSFontAttributeName: [UIFont boldSystemFontOfSize:15]}]; [deviceInformationString appendAttributedString:[MXKDeviceView verticalWhitespace]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"device_details_name"] - attributes:@{NSForegroundColorAttributeName : _defaultTextColor, - NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; + initWithString:[MatrixKitL10n deviceDetailsName] + attributes:@{NSForegroundColorAttributeName : _defaultTextColor, + NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:device.displayName.length ? device.displayName : @"" attributes:@{NSForegroundColorAttributeName : _defaultTextColor, @@ -163,16 +165,17 @@ - (instancetype)initWithDevice:(MXDevice*)device andMatrixSession:(MXSession*)se [deviceInformationString appendAttributedString:[MXKDeviceView verticalWhitespace]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"device_details_identifier"] attributes:@{NSForegroundColorAttributeName : _defaultTextColor, - NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; + initWithString:[MatrixKitL10n deviceDetailsIdentifier] + attributes:@{NSForegroundColorAttributeName : _defaultTextColor, + NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:device.deviceId - attributes:@{NSForegroundColorAttributeName : _defaultTextColor, - NSFontAttributeName: [UIFont systemFontOfSize:14]}]]; + initWithString:device.deviceId + attributes:@{NSForegroundColorAttributeName : _defaultTextColor, + NSFontAttributeName: [UIFont systemFontOfSize:14]}]]; [deviceInformationString appendAttributedString:[MXKDeviceView verticalWhitespace]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"device_details_last_seen"] + initWithString:[MatrixKitL10n deviceDetailsLastSeen] attributes:@{NSForegroundColorAttributeName : _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; @@ -184,7 +187,7 @@ - (instancetype)initWithDevice:(MXDevice*)device andMatrixSession:(MXSession*)se [dateFormatter setTimeStyle:NSDateFormatterShortStyle]; [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4]; - NSString *lastSeen = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"device_details_last_seen_format"], device.lastSeenIp, [dateFormatter stringFromDate:lastSeenDate]]; + NSString *lastSeen = [MatrixKitL10n deviceDetailsLastSeenFormat:device.lastSeenIp :[dateFormatter stringFromDate:lastSeenDate]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:lastSeen @@ -259,8 +262,8 @@ - (void)renameDevice [currentAlert dismissViewControllerAnimated:NO completion:nil]; __weak typeof(self) weakSelf = self; - currentAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"device_details_rename_prompt_title"] - message:[NSBundle mxk_localizedStringForKey:@"device_details_rename_prompt_message"] preferredStyle:UIAlertControllerStyleAlert]; + currentAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n deviceDetailsRenamePromptTitle] + message:[MatrixKitL10n deviceDetailsRenamePromptMessage] preferredStyle:UIAlertControllerStyleAlert]; [currentAlert addTextFieldWithConfigurationHandler:^(UITextField *textField) { @@ -274,7 +277,7 @@ - (void)renameDevice } }]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -286,7 +289,7 @@ - (void)renameDevice }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -372,7 +375,7 @@ - (void)deleteDevice __weak typeof(self) weakSelf = self; // Prompt the user before deleting the device. - self->currentAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"device_details_delete_prompt_title"] message:[NSBundle mxk_localizedStringForKey:@"device_details_delete_prompt_message"] preferredStyle:UIAlertControllerStyleAlert]; + self->currentAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n deviceDetailsDeletePromptTitle] message:[MatrixKitL10n deviceDetailsDeletePromptMessage] preferredStyle:UIAlertControllerStyleAlert]; [self->currentAlert addTextFieldWithConfigurationHandler:^(UITextField *textField) { @@ -382,7 +385,7 @@ - (void)deleteDevice textField.keyboardType = UIKeyboardTypeDefault; }]; - [self->currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [self->currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -395,7 +398,7 @@ - (void)deleteDevice }]]; - [self->currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"submit"] + [self->currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n submit] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { diff --git a/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.m b/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.m index e258340cb..a6537cbd5 100644 --- a/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.m +++ b/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.m @@ -22,6 +22,8 @@ #import "MXKConstants.h" +#import "MXKSwiftHeader.h" + static NSAttributedString *verticalWhitespace = nil; @interface MXKEncryptionInfoView () @@ -54,11 +56,11 @@ - (void)awakeFromNib [super awakeFromNib]; // Localize string - [_cancelButton setTitle:[NSBundle mxk_localizedStringForKey:@"ok"] forState:UIControlStateNormal]; - [_cancelButton setTitle:[NSBundle mxk_localizedStringForKey:@"ok"] forState:UIControlStateHighlighted]; + [_cancelButton setTitle:[MatrixKitL10n ok] forState:UIControlStateNormal]; + [_cancelButton setTitle:[MatrixKitL10n ok] forState:UIControlStateHighlighted]; - [_confirmVerifyButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_verify_ok"] forState:UIControlStateNormal]; - [_confirmVerifyButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_verify_ok"] forState:UIControlStateHighlighted]; + [_confirmVerifyButton setTitle:[MatrixKitL10n roomEventEncryptionVerifyOk] forState:UIControlStateNormal]; + [_confirmVerifyButton setTitle:[MatrixKitL10n roomEventEncryptionVerifyOk] forState:UIControlStateHighlighted]; } - (void)layoutSubviews @@ -138,7 +140,7 @@ - (void)updateTextViewText { // Prepare the text view content NSMutableAttributedString *textViewAttributedString = [[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_title"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoTitle] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:17]}]; @@ -181,7 +183,7 @@ - (void)updateTextViewText // Event information NSMutableAttributedString *eventInformationString = [[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoEvent] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:15]}]; [eventInformationString appendAttributedString:[MXKEncryptionInfoView verticalWhitespace]]; @@ -199,23 +201,23 @@ - (void)updateTextViewText if (!senderKey.length) { - senderKey = [NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event_none"]; + senderKey = [MatrixKitL10n roomEventEncryptionInfoEventNone]; } if (!claimedKey.length) { - claimedKey = [NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event_none"]; + claimedKey = [MatrixKitL10n roomEventEncryptionInfoEventNone]; } if (!algorithm.length) { - algorithm = [NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event_unencrypted"]; + algorithm = [MatrixKitL10n roomEventEncryptionInfoEventUnencrypted]; } if (!sessionId.length) { - sessionId = [NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event_none"]; + sessionId = [MatrixKitL10n roomEventEncryptionInfoEventNone]; } [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event_user_id"] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, + initWithString:[MatrixKitL10n roomEventEncryptionInfoEventUserId] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:senderId @@ -224,7 +226,7 @@ - (void)updateTextViewText [eventInformationString appendAttributedString:[MXKEncryptionInfoView verticalWhitespace]]; [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event_identity_key"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoEventIdentityKey] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] @@ -234,7 +236,7 @@ - (void)updateTextViewText [eventInformationString appendAttributedString:[MXKEncryptionInfoView verticalWhitespace]]; [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event_fingerprint_key"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoEventFingerprintKey] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] @@ -244,7 +246,7 @@ - (void)updateTextViewText [eventInformationString appendAttributedString:[MXKEncryptionInfoView verticalWhitespace]]; [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event_algorithm"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoEventAlgorithm] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] @@ -256,7 +258,7 @@ - (void)updateTextViewText if (decryptionError.length) { [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event_decryption_error"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoEventDecryptionError] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] @@ -267,7 +269,7 @@ - (void)updateTextViewText } [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_event_session_id"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoEventSessionId] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [eventInformationString appendAttributedString:[[NSMutableAttributedString alloc] @@ -281,7 +283,7 @@ - (void)updateTextViewText // Device information NSMutableAttributedString *deviceInformationString = [[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_device"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoDevice] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:15]}]; [deviceInformationString appendAttributedString:[MXKEncryptionInfoView verticalWhitespace]]; @@ -302,41 +304,41 @@ - (void)updateTextViewText case MXDeviceUnverified: { verification = [[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_device_not_verified"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoDeviceNotVerified] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]; - [_verifyButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_verify"] forState:UIControlStateNormal]; - [_verifyButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_verify"] forState:UIControlStateHighlighted]; - [_blockButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_block"] forState:UIControlStateNormal]; - [_blockButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_block"] forState:UIControlStateHighlighted]; + [_verifyButton setTitle:[MatrixKitL10n roomEventEncryptionInfoVerify] forState:UIControlStateNormal]; + [_verifyButton setTitle:[MatrixKitL10n roomEventEncryptionInfoVerify] forState:UIControlStateHighlighted]; + [_blockButton setTitle:[MatrixKitL10n roomEventEncryptionInfoBlock] forState:UIControlStateNormal]; + [_blockButton setTitle:[MatrixKitL10n roomEventEncryptionInfoBlock] forState:UIControlStateHighlighted]; break; } case MXDeviceVerified: { verification = [[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_device_verified"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoDeviceVerified] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont systemFontOfSize:14]}]; - [_verifyButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_unverify"] forState:UIControlStateNormal]; - [_verifyButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_unverify"] forState:UIControlStateHighlighted]; - [_blockButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_block"] forState:UIControlStateNormal]; - [_blockButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_block"] forState:UIControlStateHighlighted]; + [_verifyButton setTitle:[MatrixKitL10n roomEventEncryptionInfoUnverify] forState:UIControlStateNormal]; + [_verifyButton setTitle:[MatrixKitL10n roomEventEncryptionInfoUnverify] forState:UIControlStateHighlighted]; + [_blockButton setTitle:[MatrixKitL10n roomEventEncryptionInfoBlock] forState:UIControlStateNormal]; + [_blockButton setTitle:[MatrixKitL10n roomEventEncryptionInfoBlock] forState:UIControlStateHighlighted]; break; } case MXDeviceBlocked: { verification = [[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_device_blocked"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoDeviceBlocked] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]; - [_verifyButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_verify"] forState:UIControlStateNormal]; - [_verifyButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_verify"] forState:UIControlStateHighlighted]; - [_blockButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_unblock"] forState:UIControlStateNormal]; - [_blockButton setTitle:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_unblock"] forState:UIControlStateHighlighted]; + [_verifyButton setTitle:[MatrixKitL10n roomEventEncryptionInfoVerify] forState:UIControlStateNormal]; + [_verifyButton setTitle:[MatrixKitL10n roomEventEncryptionInfoVerify] forState:UIControlStateHighlighted]; + [_blockButton setTitle:[MatrixKitL10n roomEventEncryptionInfoUnblock] forState:UIControlStateNormal]; + [_blockButton setTitle:[MatrixKitL10n roomEventEncryptionInfoUnblock] forState:UIControlStateHighlighted]; break; } @@ -345,7 +347,7 @@ - (void)updateTextViewText } [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_device_name"] + initWithString:[MatrixKitL10n roomEventEncryptionInfoDeviceName] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] @@ -355,7 +357,7 @@ - (void)updateTextViewText [deviceInformationString appendAttributedString:[MXKEncryptionInfoView verticalWhitespace]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_device_id"] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; + initWithString:[MatrixKitL10n roomEventEncryptionInfoDeviceId] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:deviceId attributes:@{NSForegroundColorAttributeName: _defaultTextColor, @@ -363,12 +365,12 @@ - (void)updateTextViewText [deviceInformationString appendAttributedString:[MXKEncryptionInfoView verticalWhitespace]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_device_verification"] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; + initWithString:[MatrixKitL10n roomEventEncryptionInfoDeviceVerification] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [deviceInformationString appendAttributedString:verification]; [deviceInformationString appendAttributedString:[MXKEncryptionInfoView verticalWhitespace]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_device_fingerprint"] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; + initWithString:[MatrixKitL10n roomEventEncryptionInfoDeviceFingerprint] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]]; [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:fingerprint attributes:@{NSForegroundColorAttributeName: _defaultTextColor, @@ -379,7 +381,7 @@ - (void)updateTextViewText { // Unknown device [deviceInformationString appendAttributedString:[[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_info_device_unknown"] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont italicSystemFontOfSize:14]}]]; + initWithString:[MatrixKitL10n roomEventEncryptionInfoDeviceUnknown] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont italicSystemFontOfSize:14]}]]; } [textViewAttributedString appendAttributedString:deviceInformationString]; @@ -449,10 +451,10 @@ - (IBAction)onButtonPressed:(id)sender { // Prompt user NSMutableAttributedString *textViewAttributedString = [[NSMutableAttributedString alloc] - initWithString:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_verify_title"] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, + initWithString:[MatrixKitL10n roomEventEncryptionVerifyTitle] attributes:@{NSForegroundColorAttributeName: _defaultTextColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:17]}]; - NSString *message = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"room_event_encryption_verify_message"], _mxDeviceInfo.displayName, _mxDeviceInfo.deviceId, _mxDeviceInfo.fingerprint]; + NSString *message = [MatrixKitL10n roomEventEncryptionVerifyMessage:_mxDeviceInfo.displayName :_mxDeviceInfo.deviceId :_mxDeviceInfo.fingerprint]; [textViewAttributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:message @@ -461,8 +463,8 @@ - (IBAction)onButtonPressed:(id)sender self.textView.attributedText = textViewAttributedString; - [_cancelButton setTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] forState:UIControlStateNormal]; - [_cancelButton setTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] forState:UIControlStateHighlighted]; + [_cancelButton setTitle:[MatrixKitL10n cancel] forState:UIControlStateNormal]; + [_cancelButton setTitle:[MatrixKitL10n cancel] forState:UIControlStateHighlighted]; _verifyButton.hidden = _blockButton.hidden = YES; _confirmVerifyButton.hidden = NO; } diff --git a/MatrixKit/Views/EncryptionKeys/MXKEncryptionKeysExportView.m b/MatrixKit/Views/EncryptionKeys/MXKEncryptionKeysExportView.m index 983bc7310..8351571dd 100644 --- a/MatrixKit/Views/EncryptionKeys/MXKEncryptionKeysExportView.m +++ b/MatrixKit/Views/EncryptionKeys/MXKEncryptionKeysExportView.m @@ -22,6 +22,8 @@ #import +#import "MXKSwiftHeader.h" + @interface MXKEncryptionKeysExportView () { MXSession *mxSession; @@ -39,7 +41,7 @@ - (instancetype)initWithMatrixSession:(MXSession *)matrixSession mxSession = matrixSession; _passphraseMinLength = 1; - _alertController = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"e2e_export_room_keys"] message:[NSBundle mxk_localizedStringForKey:@"e2e_export_prompt"] preferredStyle:UIAlertControllerStyleAlert]; + _alertController = [UIAlertController alertControllerWithTitle:[MatrixKitL10n e2eExportRoomKeys] message:[MatrixKitL10n e2eExportPrompt] preferredStyle:UIAlertControllerStyleAlert]; } return self; } @@ -70,18 +72,18 @@ - (void)showInUIViewController:(UIViewController*)viewController [_alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.secureTextEntry = YES; - textField.placeholder = [NSBundle mxk_localizedStringForKey:@"e2e_passphrase_create"]; + textField.placeholder = [MatrixKitL10n e2ePassphraseCreate]; [textField resignFirstResponder]; }]; [_alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.secureTextEntry = YES; - textField.placeholder = [NSBundle mxk_localizedStringForKey:@"e2e_passphrase_confirm"]; + textField.placeholder = [MatrixKitL10n e2ePassphraseConfirm]; [textField resignFirstResponder]; }]; - [_alertController addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [_alertController addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -92,7 +94,7 @@ - (void)showInUIViewController:(UIViewController*)viewController }]]; - [_alertController addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"e2e_export"] + [_alertController addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n e2eExport] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -113,20 +115,20 @@ - (void)showInUIViewController:(UIViewController*)viewController NSString *error; if (!password.length) { - error = [NSBundle mxk_localizedStringForKey:@"e2e_passphrase_empty"]; + error = [MatrixKitL10n e2ePassphraseEmpty]; } else if (password.length < self.passphraseMinLength) { - error = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"e2e_passphrase_too_short"], self.passphraseMinLength]; + error = [MatrixKitL10n e2ePassphraseTooShort:self.passphraseMinLength]; } else { - error = [NSBundle mxk_localizedStringForKey:@"e2e_passphrase_not_match"]; + error = [MatrixKitL10n e2ePassphraseNotMatch]; } - UIAlertController *otherAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"error"] message:error preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *otherAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n error] message:error preferredStyle:UIAlertControllerStyleAlert]; - [otherAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + [otherAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { if (weakSelf) { @@ -160,9 +162,9 @@ - (void)showInUIViewController:(UIViewController*)viewController onLoading(NO); // TODO: i18n the error - UIAlertController *otherAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"error"] message:error.localizedDescription preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *otherAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n error] message:error.localizedDescription preferredStyle:UIAlertControllerStyleAlert]; - [otherAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + [otherAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { if (weakSelf) { diff --git a/MatrixKit/Views/EncryptionKeys/MXKEncryptionKeysImportView.m b/MatrixKit/Views/EncryptionKeys/MXKEncryptionKeysImportView.m index 5d9f9c67a..154cca7d9 100644 --- a/MatrixKit/Views/EncryptionKeys/MXKEncryptionKeysImportView.m +++ b/MatrixKit/Views/EncryptionKeys/MXKEncryptionKeysImportView.m @@ -21,6 +21,8 @@ #import +#import "MXKSwiftHeader.h" + @interface MXKEncryptionKeysImportView () { MXSession *mxSession; @@ -37,7 +39,7 @@ - (instancetype)initWithMatrixSession:(MXSession *)matrixSession { mxSession = matrixSession; - _alertController = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"e2e_import_room_keys"] message:[NSBundle mxk_localizedStringForKey:@"e2e_import_prompt"] preferredStyle:UIAlertControllerStyleAlert]; + _alertController = [UIAlertController alertControllerWithTitle:[MatrixKitL10n e2eImportRoomKeys] message:[MatrixKitL10n e2eImportPrompt] preferredStyle:UIAlertControllerStyleAlert]; } return self; } @@ -50,11 +52,11 @@ - (void)showInViewController:(MXKViewController*)mxkViewController toImportKeys: [_alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.secureTextEntry = YES; - textField.placeholder = [NSBundle mxk_localizedStringForKey:@"e2e_passphrase_enter"]; + textField.placeholder = [MatrixKitL10n e2ePassphraseEnter]; [textField resignFirstResponder]; }]; - [_alertController addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [_alertController addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -65,7 +67,7 @@ - (void)showInViewController:(MXKViewController*)mxkViewController toImportKeys: }]]; - [_alertController addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"e2e_import"] + [_alertController addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n e2eImport] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -94,9 +96,9 @@ - (void)showInViewController:(MXKViewController*)mxkViewController toImportKeys: [mxkViewController stopActivityIndicator]; // TODO: i18n the error - UIAlertController *otherAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"error"] message:error.localizedDescription preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *otherAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n error] message:error.localizedDescription preferredStyle:UIAlertControllerStyleAlert]; - [otherAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + [otherAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { if (weakSelf) { diff --git a/MatrixKit/Views/Group/MXKGroupTableViewCell.m b/MatrixKit/Views/Group/MXKGroupTableViewCell.m index 175234a75..188a4c493 100644 --- a/MatrixKit/Views/Group/MXKGroupTableViewCell.m +++ b/MatrixKit/Views/Group/MXKGroupTableViewCell.m @@ -18,6 +18,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @implementation MXKGroupTableViewCell @synthesize delegate; @@ -48,11 +50,11 @@ - (void)render:(MXKCellData *)cellData { if (groupCellData.group.summary.usersSection.totalUserCountEstimate > 1) { - _memberCount.text = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"num_members_other"], @(groupCellData.group.summary.usersSection.totalUserCountEstimate)]; + _memberCount.text = [MatrixKitL10n numMembersOther:@(groupCellData.group.summary.usersSection.totalUserCountEstimate).stringValue]; } else if (groupCellData.group.summary.usersSection.totalUserCountEstimate == 1) { - _memberCount.text = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"num_members_one"], @1]; + _memberCount.text = [MatrixKitL10n numMembersOne:@(1).stringValue]; } else { diff --git a/MatrixKit/Views/MXKEventDetailsView.m b/MatrixKit/Views/MXKEventDetailsView.m index cf85632e8..59ed20691 100644 --- a/MatrixKit/Views/MXKEventDetailsView.m +++ b/MatrixKit/Views/MXKEventDetailsView.m @@ -21,6 +21,8 @@ #import "MXKConstants.h" +#import "MXKSwiftHeader.h" + @interface MXKEventDetailsView () { /** @@ -55,10 +57,10 @@ - (void)awakeFromNib [super awakeFromNib]; // Localize string - [_redactButton setTitle:[NSBundle mxk_localizedStringForKey:@"redact"] forState:UIControlStateNormal]; - [_redactButton setTitle:[NSBundle mxk_localizedStringForKey:@"redact"] forState:UIControlStateHighlighted]; - [_closeButton setTitle:[NSBundle mxk_localizedStringForKey:@"close"] forState:UIControlStateNormal]; - [_closeButton setTitle:[NSBundle mxk_localizedStringForKey:@"close"] forState:UIControlStateHighlighted]; + [_redactButton setTitle:[MatrixKitL10n redact] forState:UIControlStateNormal]; + [_redactButton setTitle:[MatrixKitL10n redact] forState:UIControlStateHighlighted]; + [_closeButton setTitle:[MatrixKitL10n close] forState:UIControlStateNormal]; + [_closeButton setTitle:[MatrixKitL10n close] forState:UIControlStateHighlighted]; } - (instancetype)initWithEvent:(MXEvent*)event andMatrixSession:(MXSession*)session diff --git a/MatrixKit/Views/MXKRoomCreationView.m b/MatrixKit/Views/MXKRoomCreationView.m index b458c0a9f..d132e8e00 100644 --- a/MatrixKit/Views/MXKRoomCreationView.m +++ b/MatrixKit/Views/MXKRoomCreationView.m @@ -22,6 +22,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @interface MXKRoomCreationView () { UIAlertController *mxSessionPicker; @@ -73,18 +75,18 @@ - (void)awakeFromNib _participantsTextField.inputAccessoryView = inputAccessoryView; // Localize strings - _roomNameLabel.text = [NSBundle mxk_localizedStringForKey:@"room_creation_name_title"]; - _roomNameTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"room_creation_name_placeholder"]; - _roomAliasLabel.text = [NSBundle mxk_localizedStringForKey:@"room_creation_alias_title"]; - _roomAliasTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"room_creation_alias_placeholder"]; - _participantsLabel.text = [NSBundle mxk_localizedStringForKey:@"room_creation_participants_title"]; - _participantsTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"room_creation_participants_placeholder"]; + _roomNameLabel.text = [MatrixKitL10n roomCreationNameTitle]; + _roomNameTextField.placeholder = [MatrixKitL10n roomCreationNamePlaceholder]; + _roomAliasLabel.text = [MatrixKitL10n roomCreationAliasTitle]; + _roomAliasTextField.placeholder = [MatrixKitL10n roomCreationAliasPlaceholder]; + _participantsLabel.text = [MatrixKitL10n roomCreationParticipantsTitle]; + _participantsTextField.placeholder = [MatrixKitL10n roomCreationParticipantsPlaceholder]; - [_roomVisibilityControl setTitle:[NSBundle mxk_localizedStringForKey:@"public"] forSegmentAtIndex:0]; - [_roomVisibilityControl setTitle:[NSBundle mxk_localizedStringForKey:@"private"] forSegmentAtIndex:1]; + [_roomVisibilityControl setTitle:[MatrixKitL10n public] forSegmentAtIndex:0]; + [_roomVisibilityControl setTitle:[MatrixKitL10n private] forSegmentAtIndex:1]; - [_createRoomBtn setTitle:[NSBundle mxk_localizedStringForKey:@"create_room"] forState:UIControlStateNormal]; - [_createRoomBtn setTitle:[NSBundle mxk_localizedStringForKey:@"create_room"] forState:UIControlStateHighlighted]; + [_createRoomBtn setTitle:[MatrixKitL10n createRoom] forState:UIControlStateNormal]; + [_createRoomBtn setTitle:[MatrixKitL10n createRoom] forState:UIControlStateHighlighted]; } - (void)dealloc @@ -178,11 +180,11 @@ - (void)setMxSessions:(NSArray *)mxSessions // Update alias placeholder in room creation section if (homeServerSuffixArray.count == 1) { - _roomAliasTextField.placeholder = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"room_creation_alias_placeholder_with_homeserver"], homeServerSuffixArray.firstObject]; + _roomAliasTextField.placeholder = [MatrixKitL10n roomCreationAliasPlaceholderWithHomeserver:homeServerSuffixArray.firstObject]; } else { - _roomAliasTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"room_creation_alias_placeholder"]; + _roomAliasTextField.placeholder = [MatrixKitL10n roomCreationAliasPlaceholder]; } } @@ -318,7 +320,7 @@ - (void)selectMatrixSession:(void (^)(MXSession *selectedSession))onSelection [mxSessionPicker dismissViewControllerAnimated:NO completion:nil]; } - mxSessionPicker = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"select_account"] message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + mxSessionPicker = [UIAlertController alertControllerWithTitle:[MatrixKitL10n selectAccount] message:nil preferredStyle:UIAlertControllerStyleActionSheet]; __weak typeof(self) weakSelf = self; @@ -342,7 +344,7 @@ - (void)selectMatrixSession:(void (^)(MXSession *selectedSession))onSelection }]]; } - [mxSessionPicker addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [mxSessionPicker addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { diff --git a/MatrixKit/Views/PushRule/MXKPushRuleCreationTableViewCell.m b/MatrixKit/Views/PushRule/MXKPushRuleCreationTableViewCell.m index b90f3baf3..b0929edc9 100644 --- a/MatrixKit/Views/PushRule/MXKPushRuleCreationTableViewCell.m +++ b/MatrixKit/Views/PushRule/MXKPushRuleCreationTableViewCell.m @@ -18,6 +18,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @interface MXKPushRuleCreationTableViewCell () { /** @@ -41,14 +43,14 @@ - (void)setMxPushRuleKind:(MXPushRuleKind)mxPushRuleKind switch (mxPushRuleKind) { case MXPushRuleKindContent: - _inputTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"notification_settings_word_to_match"]; + _inputTextField.placeholder = [MatrixKitL10n notificationSettingsWordToMatch]; _inputTextField.autocorrectionType = UITextAutocorrectionTypeDefault; break; case MXPushRuleKindRoom: - _inputTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"notification_settings_select_room"]; + _inputTextField.placeholder = [MatrixKitL10n notificationSettingsSelectRoom]; break; case MXPushRuleKindSender: - _inputTextField.placeholder = [NSBundle mxk_localizedStringForKey:@"notification_settings_sender_hint"]; + _inputTextField.placeholder = [MatrixKitL10n notificationSettingsSenderHint]; _inputTextField.autocorrectionType = UITextAutocorrectionTypeNo; break; default: diff --git a/MatrixKit/Views/PushRule/MXKPushRuleTableViewCell.m b/MatrixKit/Views/PushRule/MXKPushRuleTableViewCell.m index 08c173ad4..221c16c2c 100644 --- a/MatrixKit/Views/PushRule/MXKPushRuleTableViewCell.m +++ b/MatrixKit/Views/PushRule/MXKPushRuleTableViewCell.m @@ -19,6 +19,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @implementation MXKPushRuleTableViewCell - (void)awakeFromNib @@ -69,7 +71,7 @@ - (void)setMxPushRule:(MXPushRule *)mxPushRule MXRoom *room = [_mxSession roomWithRoomId:mxPushRule.ruleId]; if (room) { - description = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notification_settings_room_rule_title"], room.summary.displayname]; + description = [MatrixKitL10n notificationSettingsRoomRuleTitle:room.summary.displayname]; } break; } @@ -113,20 +115,20 @@ - (void)setMxPushRule:(MXPushRule *)mxPushRule { if (ruleAction.actionType == MXPushRuleActionTypeDontNotify) { - notify = [NSBundle mxk_localizedStringForKey:@"notification_settings_never_notify"]; + notify = [MatrixKitL10n notificationSettingsNeverNotify]; sound = @""; highlight = @""; break; } else if (ruleAction.actionType == MXPushRuleActionTypeNotify || ruleAction.actionType == MXPushRuleActionTypeCoalesce) { - notify = [NSBundle mxk_localizedStringForKey:@"notification_settings_always_notify"]; + notify = [MatrixKitL10n notificationSettingsAlwaysNotify]; } else if (ruleAction.actionType == MXPushRuleActionTypeSetTweak) { if ([ruleAction.parameters[@"set_tweak"] isEqualToString:@"sound"]) { - sound = [NSString stringWithFormat:@", %@", [NSBundle mxk_localizedStringForKey:@"notification_settings_custom_sound"]]; + sound = [NSString stringWithFormat:@", %@", [MatrixKitL10n notificationSettingsCustomSound]]; } else if ([ruleAction.parameters[@"set_tweak"] isEqualToString:@"highlight"]) { @@ -134,7 +136,7 @@ - (void)setMxPushRule:(MXPushRule *)mxPushRule // If not present, highlight. Else check its value before highlighting if (nil == ruleAction.parameters[@"value"] || YES == [ruleAction.parameters[@"value"] boolValue]) { - highlight = [NSString stringWithFormat:@", %@", [NSBundle mxk_localizedStringForKey:@"notification_settings_highlight"]]; + highlight = [NSString stringWithFormat:@", %@", [MatrixKitL10n notificationSettingsHighlight]]; } } } diff --git a/MatrixKit/Views/RoomBubbleList/MXKRoomOutgoingBubbleTableViewCell.m b/MatrixKit/Views/RoomBubbleList/MXKRoomOutgoingBubbleTableViewCell.m index f65a14f14..9c74f6aff 100644 --- a/MatrixKit/Views/RoomBubbleList/MXKRoomOutgoingBubbleTableViewCell.m +++ b/MatrixKit/Views/RoomBubbleList/MXKRoomOutgoingBubbleTableViewCell.m @@ -22,6 +22,8 @@ #import "MXKRoomBubbleCellData.h" +#import "MXKSwiftHeader.h" + @implementation MXKRoomOutgoingBubbleTableViewCell - (void)render:(MXKCellData *)cellData @@ -39,8 +41,8 @@ - (void)render:(MXKCellData *)cellData { UIButton *unsentButton = [[UIButton alloc] initWithFrame:CGRectMake(0, component.position.y, 58 , 20)]; - [unsentButton setTitle:[NSBundle mxk_localizedStringForKey:@"unsent"] forState:UIControlStateNormal]; - [unsentButton setTitle:[NSBundle mxk_localizedStringForKey:@"unsent"] forState:UIControlStateSelected]; + [unsentButton setTitle:[MatrixKitL10n unsent] forState:UIControlStateNormal]; + [unsentButton setTitle:[MatrixKitL10n unsent] forState:UIControlStateSelected]; [unsentButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; [unsentButton setTitleColor:[UIColor redColor] forState:UIControlStateSelected]; diff --git a/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.m b/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.m index 4404e5c5f..72892cbf2 100644 --- a/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.m +++ b/MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.m @@ -95,8 +95,8 @@ - (void)awakeFromNib self.editable = YES; // Localize string - [_rightInputToolbarButton setTitle:[NSBundle mxk_localizedStringForKey:@"send"] forState:UIControlStateNormal]; - [_rightInputToolbarButton setTitle:[NSBundle mxk_localizedStringForKey:@"send"] forState:UIControlStateHighlighted]; + [_rightInputToolbarButton setTitle:[MatrixKitL10n send] forState:UIControlStateNormal]; + [_rightInputToolbarButton setTitle:[MatrixKitL10n send] forState:UIControlStateHighlighted]; validationViews = [NSMutableArray array]; } @@ -142,7 +142,7 @@ - (IBAction)onTouchUpInside:(UIButton*)button { optionsListView = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - [optionsListView addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"attach_media"] + [optionsListView addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n attachMedia] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -162,7 +162,7 @@ - (IBAction)onTouchUpInside:(UIButton*)button }]]; - [optionsListView addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"capture_media"] + [optionsListView addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n captureMedia] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -195,7 +195,7 @@ - (IBAction)onTouchUpInside:(UIButton*)button optionsListView = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; } - [optionsListView addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"invite_user"] + [optionsListView addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n inviteUser] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -204,10 +204,10 @@ - (IBAction)onTouchUpInside:(UIButton*)button typeof(self) self = weakSelf; // Ask for userId to invite - self->optionsListView = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"user_id_title"] message:nil preferredStyle:UIAlertControllerStyleAlert]; + self->optionsListView = [UIAlertController alertControllerWithTitle:[MatrixKitL10n userIdTitle] message:nil preferredStyle:UIAlertControllerStyleAlert]; - [self->optionsListView addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + [self->optionsListView addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { if (weakSelf) { @@ -220,11 +220,11 @@ - (IBAction)onTouchUpInside:(UIButton*)button [self->optionsListView addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.secureTextEntry = NO; - textField.placeholder = [NSBundle mxk_localizedStringForKey:@"user_id_placeholder"]; + textField.placeholder = [MatrixKitL10n userIdPlaceholder]; }]; - [self->optionsListView addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"invite"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + [self->optionsListView addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n invite] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { if (weakSelf) { @@ -256,7 +256,7 @@ - (IBAction)onTouchUpInside:(UIButton*)button if (optionsListView) { - [self->optionsListView addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + [self->optionsListView addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { if (weakSelf) { @@ -609,15 +609,15 @@ - (void)sendImage:(NSData*)imageData withCompressionMode:(MXKRoomInputToolbarCom { __weak typeof(self) weakSelf = self; - compressionPrompt = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"attachment_size_prompt_title"] - message:[NSBundle mxk_localizedStringForKey:@"attachment_size_prompt_message"] + compressionPrompt = [UIAlertController alertControllerWithTitle:[MatrixKitL10n attachmentSizePromptTitle] + message:[MatrixKitL10n attachmentSizePromptMessage] preferredStyle:UIAlertControllerStyleActionSheet]; if (compressionSizes.small.fileSize) { NSString *fileSizeString = [MXTools fileSizeToString:compressionSizes.small.fileSize]; - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_small"], fileSizeString]; + NSString *title = [MatrixKitL10n attachmentSmall:fileSizeString]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault @@ -641,7 +641,7 @@ - (void)sendImage:(NSData*)imageData withCompressionMode:(MXKRoomInputToolbarCom { NSString *fileSizeString = [MXTools fileSizeToString:compressionSizes.medium.fileSize]; - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_medium"], fileSizeString]; + NSString *title = [MatrixKitL10n attachmentMedium:fileSizeString]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault @@ -665,7 +665,7 @@ - (void)sendImage:(NSData*)imageData withCompressionMode:(MXKRoomInputToolbarCom { NSString *fileSizeString = [MXTools fileSizeToString:compressionSizes.large.fileSize]; - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_large"], fileSizeString]; + NSString *title = [MatrixKitL10n attachmentLarge:fileSizeString]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault @@ -686,8 +686,8 @@ - (void)sendImage:(NSData*)imageData withCompressionMode:(MXKRoomInputToolbarCom } NSString *fileSizeString = [MXTools fileSizeToString:compressionSizes.original.fileSize]; - - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_original"], fileSizeString]; + + NSString *title = [MatrixKitL10n attachmentOriginal:fileSizeString]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault @@ -705,7 +705,7 @@ - (void)sendImage:(NSData*)imageData withCompressionMode:(MXKRoomInputToolbarCom }]]; - [compressionPrompt addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [compressionPrompt addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { @@ -838,15 +838,15 @@ - (void)sendSelectedAssets:(NSArray*)assets withFileSizes:(MXKFileSize && (fileSizes.small || fileSizes.medium || fileSizes.large)) { // Ask the user for the compression value - compressionPrompt = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"attachment_size_prompt_title"] - message:[NSBundle mxk_localizedStringForKey:@"attachment_size_prompt_message"] + compressionPrompt = [UIAlertController alertControllerWithTitle:[MatrixKitL10n attachmentSizePromptTitle] + message:[MatrixKitL10n attachmentSizePromptMessage] preferredStyle:UIAlertControllerStyleActionSheet]; __weak typeof(self) weakSelf = self; if (fileSizes.small) { - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_small"], [MXTools fileSizeToString:fileSizes.small]]; + NSString *title = [MatrixKitL10n attachmentSmall:[MXTools fileSizeToString:fileSizes.small]]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault @@ -866,7 +866,7 @@ - (void)sendSelectedAssets:(NSArray*)assets withFileSizes:(MXKFileSize if (fileSizes.medium) { - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_medium"], [MXTools fileSizeToString:fileSizes.medium]]; + NSString *title = [MatrixKitL10n attachmentMedium:[MXTools fileSizeToString:fileSizes.medium]]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault @@ -886,7 +886,7 @@ - (void)sendSelectedAssets:(NSArray*)assets withFileSizes:(MXKFileSize if (fileSizes.large) { - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_large"], [MXTools fileSizeToString:fileSizes.large]]; + NSString *title = [MatrixKitL10n attachmentLarge:[MXTools fileSizeToString:fileSizes.large]]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault @@ -904,7 +904,7 @@ - (void)sendSelectedAssets:(NSArray*)assets withFileSizes:(MXKFileSize }]]; } - NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_original"], [MXTools fileSizeToString:fileSizes.original]]; + NSString *title = [MatrixKitL10n attachmentOriginal:[MXTools fileSizeToString:fileSizes.original]]; [compressionPrompt addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault @@ -921,7 +921,7 @@ - (void)sendSelectedAssets:(NSArray*)assets withFileSizes:(MXKFileSize }]]; - [compressionPrompt addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [compressionPrompt addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { @@ -1040,7 +1040,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking imageValidationView.stretchable = YES; // the user validates the image - [imageValidationView setRightButtonTitle:[NSBundle mxk_localizedStringForKey:@"ok"] handler:^(MXKImageView* imageView, NSString* buttonTitle) + [imageValidationView setRightButtonTitle:[MatrixKitL10n ok] handler:^(MXKImageView* imageView, NSString* buttonTitle) { if (weakSelf) { @@ -1066,7 +1066,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking }]; // the user wants to use an other image - [imageValidationView setLeftButtonTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] handler:^(MXKImageView* imageView, NSString* buttonTitle) + [imageValidationView setLeftButtonTitle:[MatrixKitL10n cancel] handler:^(MXKImageView* imageView, NSString* buttonTitle) { if (weakSelf) { @@ -1188,7 +1188,7 @@ - (void)paste:(id)sender imageValidationView.stretchable = YES; // the user validates the image - [imageValidationView setRightButtonTitle:[NSBundle mxk_localizedStringForKey:@"ok"] handler:^(MXKImageView* imageView, NSString* buttonTitle) + [imageValidationView setRightButtonTitle:[MatrixKitL10n ok] handler:^(MXKImageView* imageView, NSString* buttonTitle) { if (weakSelf) { @@ -1199,7 +1199,7 @@ - (void)paste:(id)sender }]; // the user wants to use an other image - [imageValidationView setLeftButtonTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] handler:^(MXKImageView* imageView, NSString* buttonTitle) + [imageValidationView setLeftButtonTitle:[MatrixKitL10n cancel] handler:^(MXKImageView* imageView, NSString* buttonTitle) { // Dismiss the image validation view. if (weakSelf) @@ -1241,7 +1241,7 @@ - (void)paste:(id)sender videoValidationView.stretchable = YES; // the user validates the image - [videoValidationView setRightButtonTitle:[NSBundle mxk_localizedStringForKey:@"ok"] handler:^(MXKImageView* imageView, NSString* buttonTitle) + [videoValidationView setRightButtonTitle:[MatrixKitL10n ok] handler:^(MXKImageView* imageView, NSString* buttonTitle) { if (weakSelf) { @@ -1253,7 +1253,7 @@ - (void)paste:(id)sender }]; // the user wants to use an other image - [videoValidationView setLeftButtonTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] handler:^(MXKImageView* imageView, NSString* buttonTitle) + [videoValidationView setLeftButtonTitle:[MatrixKitL10n cancel] handler:^(MXKImageView* imageView, NSString* buttonTitle) { // Dismiss the video validation view. if (weakSelf) @@ -1291,7 +1291,7 @@ - (void)paste:(id)sender docValidationView.stretchable = YES; // the user validates the image - [docValidationView setRightButtonTitle:[NSBundle mxk_localizedStringForKey:@"ok"] handler:^(MXKImageView* imageView, NSString* buttonTitle) + [docValidationView setRightButtonTitle:[MatrixKitL10n ok] handler:^(MXKImageView* imageView, NSString* buttonTitle) { if (weakSelf) { @@ -1303,7 +1303,7 @@ - (void)paste:(id)sender }]; // the user wants to use an other image - [docValidationView setLeftButtonTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] handler:^(MXKImageView* imageView, NSString* buttonTitle) + [docValidationView setLeftButtonTitle:[MatrixKitL10n cancel] handler:^(MXKImageView* imageView, NSString* buttonTitle) { // Dismiss the validation view. if (weakSelf) diff --git a/MatrixKit/Views/RoomList/MXKPublicRoomTableViewCell.m b/MatrixKit/Views/RoomList/MXKPublicRoomTableViewCell.m index 6d533abdf..d6321f100 100644 --- a/MatrixKit/Views/RoomList/MXKPublicRoomTableViewCell.m +++ b/MatrixKit/Views/RoomList/MXKPublicRoomTableViewCell.m @@ -18,6 +18,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @implementation MXKPublicRoomTableViewCell - (void)render:(MXPublicRoom*)publicRoom @@ -39,11 +41,11 @@ - (void)render:(MXPublicRoom*)publicRoom // Set member count if (publicRoom.numJoinedMembers > 1) { - _memberCount.text = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"num_members_other"], @(publicRoom.numJoinedMembers)]; + _memberCount.text = [MatrixKitL10n numMembersOther:@(publicRoom.numJoinedMembers).stringValue]; } else if (publicRoom.numJoinedMembers == 1) { - _memberCount.text = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"num_members_one"], @1]; + _memberCount.text = [MatrixKitL10n numMembersOne:@(1).stringValue]; } else { diff --git a/MatrixKit/Views/RoomMemberList/MXKRoomMemberTableViewCell.m b/MatrixKit/Views/RoomMemberList/MXKRoomMemberTableViewCell.m index c6709d071..d312f27c1 100644 --- a/MatrixKit/Views/RoomMemberList/MXKRoomMemberTableViewCell.m +++ b/MatrixKit/Views/RoomMemberList/MXKRoomMemberTableViewCell.m @@ -29,6 +29,8 @@ #import "NSBundle+MatrixKit.h" +#import "MXKSwiftHeader.h" + @interface MXKRoomMemberTableViewCell () { NSRange lastSeenRange; @@ -114,7 +116,7 @@ - (void)render:(MXKCellData *)cellData if (memberCellData.roomMember.membership == MXMembershipLeave || memberCellData.roomMember.membership == MXMembershipBan) { self.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1.0]; - presenceText = (memberCellData.roomMember.membership == MXMembershipLeave) ? [NSBundle mxk_localizedStringForKey:@"membership_leave"] : [NSBundle mxk_localizedStringForKey:@"membership_ban"]; + presenceText = (memberCellData.roomMember.membership == MXMembershipLeave) ? [MatrixKitL10n membershipLeave] : [MatrixKitL10n membershipBan]; } else { @@ -124,7 +126,7 @@ - (void)render:(MXKCellData *)cellData if (memberCellData.roomMember.membership == MXMembershipInvite) { thumbnailBorderColor = [UIColor lightGrayColor]; - presenceText = [NSBundle mxk_localizedStringForKey:@"membership_invite"]; + presenceText = [MatrixKitL10n membershipInvite]; } else { @@ -216,7 +218,7 @@ - (NSString*)lastActiveTime { case MXPresenceOffline: { - lastActiveTime = [NSBundle mxk_localizedStringForKey:@"offline"]; + lastActiveTime = [MatrixKitL10n offline]; break; } case MXPresenceUnknown: diff --git a/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m b/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m index d13894a7a..243950124 100644 --- a/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m +++ b/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m @@ -23,6 +23,8 @@ #import "NSBundle+MatrixKit.h" #import "MXRoom+Sync.h" +#import "MXKSwiftHeader.h" + @interface MXKRoomTitleView () { // Observer kMXRoomSummaryDidChangeNotification to keep updated the room name. @@ -84,7 +86,7 @@ - (void)refreshDisplay } else { - self.displayNameTextField.text = [NSBundle mxk_localizedStringForKey:@"room_please_select"]; + self.displayNameTextField.text = [MatrixKitL10n roomPleaseSelect]; self.displayNameTextField.enabled = NO; } self.displayNameTextField.hidden = NO; @@ -168,7 +170,7 @@ - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField } else { - alertMsg = [NSBundle mxk_localizedStringForKey:@"room_error_name_edition_not_authorized"]; + alertMsg = [MatrixKitL10n roomErrorNameEditionNotAuthorized]; } } @@ -183,7 +185,7 @@ - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField currentAlert = [UIAlertController alertControllerWithTitle:nil message:alertMsg preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { diff --git a/MatrixKit/Views/RoomTitle/MXKRoomTitleViewWithTopic.m b/MatrixKit/Views/RoomTitle/MXKRoomTitleViewWithTopic.m index 21487f873..9fbe1dec9 100644 --- a/MatrixKit/Views/RoomTitle/MXKRoomTitleViewWithTopic.m +++ b/MatrixKit/Views/RoomTitle/MXKRoomTitleViewWithTopic.m @@ -23,6 +23,8 @@ #import "NSBundle+MatrixKit.h" #import "MXRoom+Sync.h" +#import "MXKSwiftHeader.h" + @interface MXKRoomTitleViewWithTopic () { id roomTopicListener; @@ -370,7 +372,7 @@ - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField } else { - alertMsg = [NSBundle mxk_localizedStringForKey:@"room_error_name_edition_not_authorized"]; + alertMsg = [MatrixKitL10n roomErrorNameEditionNotAuthorized]; } // Check whether the user is allowed to change room topic @@ -399,7 +401,7 @@ - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField } else { - alertMsg = [NSBundle mxk_localizedStringForKey:@"room_error_topic_edition_not_authorized"]; + alertMsg = [MatrixKitL10n roomErrorTopicEditionNotAuthorized]; } } @@ -413,7 +415,7 @@ - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField } currentAlert = [UIAlertController alertControllerWithTitle:nil message:alertMsg preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {