Skip to content

Commit

Permalink
/issues/4899 - Fixed various localization issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Sep 29, 2021
1 parent f721482 commit 931b245
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 52 deletions.
3 changes: 2 additions & 1 deletion Riot/Managers/Call/CallPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,10 @@ class CallPresenter: NSObject {
} else {
createJitsiBlock()
}

#else
AppDelegate.theDelegate().showAlert(withTitle: nil,
message: Bundle.mxk_localizedString(forKey: "not_supported_yet"))
message: MatrixKitL10n.notSupportedYet)
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/Authentication/AuthenticationViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ - (void)showClearDataAfterSoftLogoutConfirmation
}

alert = [UIAlertController alertControllerWithTitle:[VectorL10n authSoftlogoutClearDataSignOutTitle]
message:[VectorL10n authSoftlogoutClearDataSignOutMsg]
message:[VectorL10n authSoftlogoutClearDataSignOutMsg]
preferredStyle:UIAlertControllerStyleAlert];


Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/Call/Views/CallAudioRouteView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CallAudioRouteView: UIView {
titleLabel.text = route.name
case .loudSpeakers:
iconImageView.image = Asset.Images.callAudioRouteSpeakers.image
titleLabel.text = Bundle.mxk_localizedString(forKey: "call_more_actions_audio_use_device")
titleLabel.text = MatrixKitL10n.callMoreActionsAudioUseDevice
case .externalWired, .externalBluetooth, .externalCar:
iconImageView.image = Asset.Images.callAudioRouteHeadphones.image
titleLabel.text = route.name
Expand Down
4 changes: 2 additions & 2 deletions Riot/Modules/Camera/CameraAccessAlertPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ final class CameraAccessAlertPresenter {

let alert = UIAlertController(title: VectorL10n.camera, message: VectorL10n.cameraAccessNotGranted(appDisplayName), preferredStyle: .alert)

let cancelActionTitle = Bundle.mxk_localizedString(forKey: "ok")
let cancelActionTitle = MatrixKitL10n.ok
let cancelAction = UIAlertAction(title: cancelActionTitle, style: .cancel)

let settingsActionTitle = Bundle.mxk_localizedString(forKey: "settings")
let settingsActionTitle = MatrixKitL10n.settings
let settingsAction = UIAlertAction(title: settingsActionTitle, style: .default, handler: { _ in
UIApplication.shared.open(settingsURL, options: [:], completionHandler: { (succeed) in
if !succeed {
Expand Down
28 changes: 14 additions & 14 deletions Riot/Modules/Integrations/IntegrationManagerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ - (void)onPostMessageRequest:(NSString*)requestId data:(NSDictionary*)requestDat
}
else
{
[self sendLocalisedError:@"widget_integration_missing_room_id" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationMissingRoomId] toRequest:requestId];
return;
}
}
Expand Down Expand Up @@ -249,7 +249,7 @@ - (void)onPostMessageRequest:(NSString*)requestId data:(NSDictionary*)requestDat

if (!userId)
{
[self sendLocalisedError:@"widget_integration_missing_user_id" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationMissingUserId] toRequest:requestId];
return;
}

Expand Down Expand Up @@ -292,7 +292,7 @@ - (void)roomCheckForRequest:(NSString*)requestId data:(NSDictionary*)requestData
}
else
{
[self sendLocalisedError:@"widget_integration_room_not_recognised" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationRoomNotRecognised] toRequest:requestId];
}
}

Expand Down Expand Up @@ -324,7 +324,7 @@ - (void)inviteUser:(NSString*)userId request:(NSString*)requestId data:(NSDictio
} failure:^(NSError *error) {
MXStrongifyAndReturnIfNil(self);

[self sendLocalisedError:@"widget_integration_need_to_be_able_to_invite" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationNeedToBeAbleToInvite] toRequest:requestId];
}];
}
}];
Expand All @@ -348,13 +348,13 @@ - (void)setWidget:(NSString*)requestId data:(NSDictionary*)requestData

if (!widget_id)
{
[self sendLocalisedError:@"widget_integration_unable_to_create" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationUnableToCreate] toRequest:requestId];
return;
}

if (!widgetType)
{
[self sendLocalisedError:@"widget_integration_unable_to_create" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationUnableToCreate] toRequest:requestId];
return;
}

Expand Down Expand Up @@ -412,7 +412,7 @@ - (void)setWidget:(NSString*)requestId data:(NSDictionary*)requestData
typeof(self) self = weakSelf;
if (self)
{
[self sendLocalisedError:@"widget_integration_unable_to_create" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationUnableToCreate] toRequest:requestId];
}
}];
}
Expand Down Expand Up @@ -441,7 +441,7 @@ - (void)setWidget:(NSString*)requestId data:(NSDictionary*)requestData
typeof(self) self = weakSelf;
if (self)
{
[self sendLocalisedError:@"widget_integration_failed_to_send_request" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationFailedToSendRequest] toRequest:requestId];
}
}];
}];
Expand Down Expand Up @@ -490,7 +490,7 @@ - (void)canSendEvent:(NSString*)requestId data:(NSDictionary*)requestData

if (room.summary.membership != MXMembershipJoin)
{
[self sendLocalisedError:@"widget_integration_must_be_in_room" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationMustBeInRoom] toRequest:requestId];
return;
}

Expand All @@ -517,7 +517,7 @@ - (void)canSendEvent:(NSString*)requestId data:(NSDictionary*)requestData
}
else
{
[self sendLocalisedError:@"widget_integration_no_permission_in_room" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationNoPermissionInRoom] toRequest:requestId];
}

}];
Expand Down Expand Up @@ -576,7 +576,7 @@ - (void)setPlumbingState:(NSString*)requestId data:(NSDictionary*)requestData
typeof(self) self = weakSelf;
if (self)
{
[self sendLocalisedError:@"widget_integration_failed_to_send_request" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationFailedToSendRequest] toRequest:requestId];
}
}];
}
Expand Down Expand Up @@ -648,7 +648,7 @@ - (void)setBotOptions:(NSString*)userId request:(NSString*)requestId data:(NSDic
typeof(self) self = weakSelf;
if (self)
{
[self sendLocalisedError:@"widget_integration_failed_to_send_request" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationFailedToSendRequest] toRequest:requestId];
}
}];
}
Expand Down Expand Up @@ -687,14 +687,14 @@ - (void)setBotPower:(NSString*)userId request:(NSString*)requestId data:(NSDicti
typeof(self) self = weakSelf;
if (self)
{
[self sendLocalisedError:@"widget_integration_failed_to_send_request" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationFailedToSendRequest] toRequest:requestId];
}
}];
}
else
{
MXLogDebug(@"[IntegrationManagerVC] setBotPower. Power level must be positive integer.");
[self sendLocalisedError:@"widget_integration_positive_power_level" toRequest:requestId];
[self sendError:[VectorL10n widgetIntegrationPositivePowerLevel] toRequest:requestId];
}
}];
}
Expand Down
8 changes: 0 additions & 8 deletions Riot/Modules/Integrations/Widgets/WidgetViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,4 @@
*/
- (void)sendError:(NSString*)message toRequest:(NSString*)requestId;

/**
Send a localised message error to a request from the widget.
@param errorKey the string id of the message error.
@param requestId the id of the widget request.
*/
- (void)sendLocalisedError:(NSString*)errorKey toRequest:(NSString*)requestId;

@end
6 changes: 0 additions & 6 deletions Riot/Modules/Integrations/Widgets/WidgetViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,6 @@ - (void)sendError:(NSString*)message toRequest:(NSString*)requestId
toRequest:requestId];
}

- (void)sendLocalisedError:(NSString*)errorKey toRequest:(NSString*)requestId
{
[self sendError:NSLocalizedStringFromTable(errorKey, @"Vector", nil) toRequest:requestId];
}


#pragma mark - Private methods

- (NSString *)stringByReplacingScalarTokenInString:(NSString*)string byScalarToken:(NSString*)scalarToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ final class KeyVerificationScanConfirmationViewController: UIViewController {
self.confirmButton.layer.masksToBounds = true
self.rejectButton.layer.masksToBounds = true

self.confirmButton.setTitle(Bundle.mxk_localizedString(forKey: "yes"), for: .normal)
self.rejectButton.setTitle(Bundle.mxk_localizedString(forKey: "no"), for: .normal)
self.confirmButton.setTitle(MatrixKitL10n.yes, for: .normal)
self.rejectButton.setTitle(MatrixKitL10n.no, for: .normal)
self.rejectButton.actionStyle = .cancel
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ final class KeyVerificationVerifyByScanningViewController: UIViewController {
message: VectorL10n.keyVerificationVerifyQrCodeScanOtherCodeSuccessMessage,
preferredStyle: .alert)

let okAction = UIAlertAction(title: Bundle.mxk_localizedString(forKey: "ok"), style: .default, handler: { _ in
let okAction = UIAlertAction(title: MatrixKitL10n.ok, style: .default, handler: { _ in
completion()
})
alert.addAction(okAction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ final class UserVerificationCoordinator: NSObject, UserVerificationCoordinatorTy
message: VectorL10n.keyVerificationBootstrapNotSetupMessage,
preferredStyle: .alert)

let cancelAction = UIAlertAction(title: Bundle.mxk_localizedString(forKey: "ok"), style: .cancel)
let cancelAction = UIAlertAction(title: MatrixKitL10n.ok, style: .cancel)
alert.addAction(cancelAction)

self.presenter.toPresentable().present(alert, animated: true, completion: nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}
break;
case UserEncryptionTrustLevelUnknown:
[encryptionInformation appendString:NSLocalizedStringFromTable(@"room_participants_security_information_loading", @"Vector", nil)];
[encryptionInformation appendString:[VectorL10n roomParticipantsSecurityLoading]];
break;
default:
break;
Expand Down Expand Up @@ -1144,7 +1144,7 @@ - (void)onActionButtonPressed:(id)sender

}]];

[currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"ban", @"Vector", nil)
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ban]
style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {

if (weakSelf)
Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/Room/RoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -5144,7 +5144,7 @@ - (void)eventDidChangeSentState:(NSNotification *)notif
}

currentAlert = [UIAlertController alertControllerWithTitle:[VectorL10n unknownDevicesAlertTitle]
message:[VectorL10n unknownDevicesAlertTitle]
message:[VectorL10n unknownDevicesAlert]
preferredStyle:UIAlertControllerStyleAlert];

[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n unknownDevicesVerify]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ - (void)presentPasswordRequiredAlertWithSubmitHandler:(void (^)(NSString *passwo

__weak typeof(self) weakSelf = self;

[alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[alert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n submit]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
UITextField *textField = alert.textFields.firstObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ final class SettingsDiscoveryThreePidDetailsViewController: UIViewController {

private func presentPendingEmailVerificationAlert() {

let alert = UIAlertController(title: Bundle.mxk_localizedString(forKey: "account_email_validation_title"),
message: Bundle.mxk_localizedString(forKey: "account_email_validation_message"),
let alert = UIAlertController(title: MatrixKitL10n.accountEmailValidationTitle,
message: MatrixKitL10n.accountEmailValidationMessage,
preferredStyle: .alert)

alert.addAction(UIAlertAction(title: VectorL10n.continue, style: .default, handler: { _ in
self.viewModel.process(viewAction: .confirmEmailValidation)
}))

alert.addAction(UIAlertAction(title: Bundle.mxk_localizedString(forKey: "cancel"), style: .cancel, handler: { _ in
alert.addAction(UIAlertAction(title: MatrixKitL10n.cancel, style: .cancel, handler: { _ in
self.viewModel.process(viewAction: .cancelThreePidValidation)
}))

Expand All @@ -244,8 +244,8 @@ final class SettingsDiscoveryThreePidDetailsViewController: UIViewController {

private func presentPendingMSISDNVerificationAlert() {

let alert = UIAlertController(title: Bundle.mxk_localizedString(forKey: "account_msisdn_validation_title"),
message: Bundle.mxk_localizedString(forKey: "account_msisdn_validation_message"),
let alert = UIAlertController(title: MatrixKitL10n.accountMsisdnValidationTitle,
message: MatrixKitL10n.accountMsisdnValidationMessage,
preferredStyle: .alert)

alert.addTextField { (textField) in
Expand All @@ -260,7 +260,7 @@ final class SettingsDiscoveryThreePidDetailsViewController: UIViewController {
self.viewModel.process(viewAction: .confirmMSISDNValidation(code: smsCode))
}))

alert.addAction(UIAlertAction(title: Bundle.mxk_localizedString(forKey: "cancel"), style: .cancel, handler: { _ in
alert.addAction(UIAlertAction(title: MatrixKitL10n.cancel, style: .cancel, handler: { _ in
self.viewModel.process(viewAction: .cancelThreePidValidation)
}))

Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/Settings/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ - (void)showAuthenticationIfNeededForAdding:(MX3PIDMedium)medium withSession:(MX
title = [VectorL10n settingsAdd3pidPasswordTitleEmail];
}

NSString *message = [VectorL10n settingsAdd3pidInvalidPasswordMessage];
NSString *message = [VectorL10n settingsAdd3pidPasswordMessage];


[session.matrixRestClient add3PIDOnlyWithSessionId:@"" clientSecret:[MXTools generateSecret] authParams:nil success:^{
Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/Spaces/SpaceFeatureUnavailablePresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class SpaceFeatureUnavailablePresenter: NSObject {

let navigationVC = RiotNavigationController(rootViewController: spaceFeatureUnavailableVC)

spaceFeatureUnavailableVC.navigationItem.rightBarButtonItem = MXKBarButtonItem(title: Bundle.mxk_localizedString(forKey: "ok"), style: .plain, action: { [weak navigationVC] in
spaceFeatureUnavailableVC.navigationItem.rightBarButtonItem = MXKBarButtonItem(title: MatrixKitL10n.ok, style: .plain, action: { [weak navigationVC] in
navigationVC?.dismiss(animated: true)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ final class UserInteractiveAuthenticationViewControllerFactory: NSObject {
textField.keyboardType = .default
}

alertController.addAction(UIAlertAction(title: Bundle.mxk_localizedString(forKey: "cancel"), style: .cancel, handler: { _ in
alertController.addAction(UIAlertAction(title: MatrixKitL10n.cancel, style: .cancel, handler: { _ in
onCancelled()
}))

alertController.addAction(UIAlertAction(title: Bundle.mxk_localizedString(forKey: "ok"), style: .default, handler: { _ in
alertController.addAction(UIAlertAction(title: MatrixKitL10n.ok, style: .default, handler: { _ in

guard let password = alertController.textFields?.first?.text else {
// Should not happen
Expand Down
2 changes: 1 addition & 1 deletion Riot/Utils/Tools.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ + (NSString *)presenceText:(MXUser *)user

if (user.currentlyActive)
{
presenceText = [presenceText stringByAppendingString:[VectorL10n roomParticipantsNow]];
presenceText = [presenceText stringByAppendingString:[NSString stringWithFormat:@" %@",[VectorL10n roomParticipantsNow]]];
}
else if (-1 != user.lastActiveAgo && 0 < user.lastActiveAgo)
{
Expand Down
1 change: 1 addition & 0 deletions changelog.d/4899.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replaced localizable strings with generated ones throughout the code. Fixed various translation issues.

0 comments on commit 931b245

Please sign in to comment.