Skip to content

Commit f4307cf

Browse files
committed
语音部分文字使用NSLocalizedString本地化
1 parent a60f9b0 commit f4307cf

4 files changed

Lines changed: 14 additions & 13 deletions

File tree

MessageDisplayKit/Classes/Controllers/XHMessageTableViewController/XHDisplayLocationViewController/XHDisplayLocationViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ - (void)loadLocations {
3131
identifier:[NSString stringWithFormat:@"%f, %f", coord.latitude, coord.longitude]];
3232

3333
// Create an annotation to show where the region is located on the map.
34-
XHAnnotation *myRegionAnnotation = [[XHAnnotation alloc] initWithCLRegion:newRegion title:@"消息的位置" subtitle:self.message.geolocations];
34+
XHAnnotation *myRegionAnnotation = [[XHAnnotation alloc] initWithCLRegion:newRegion title:NSLocalizedStringFromTable(@"MessageLocation", @"MessageDisplayKitString", nil) subtitle:self.message.geolocations];
3535
myRegionAnnotation.coordinate = newRegion.center;
3636
myRegionAnnotation.radius = newRegion.radius;
3737

MessageDisplayKit/Classes/Views/MessageInputView/XHMessageInputView.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
#import "NSString+MessageInputView.h"
1313
#import "XHMacro.h"
1414

15-
#define kXHTouchToRecord @"按住 说话"
16-
#define kXHTouchToFinish @"松开 结束"
17-
1815
@interface XHMessageInputView () <UITextViewDelegate>
1916

2017
@property (nonatomic, weak, readwrite) XHMessageTextView *inputTextView;
@@ -342,7 +339,7 @@ - (void)setupMessageInputViewBarWithStyle:(XHMessageInputViewStyle)style {
342339
textView.returnKeyType = UIReturnKeySend;
343340
textView.enablesReturnKeyAutomatically = YES; // UITextView内部判断send按钮是否可以用
344341

345-
textView.placeHolder = @"发送新消息";
342+
textView.placeHolder = NSLocalizedStringFromTable(@"SendAMessage", @"MessageDisplayKitString", nil);
346343
textView.delegate = self;
347344

348345
[self addSubview:textView];
@@ -387,8 +384,8 @@ - (void)setupMessageInputViewBarWithStyle:(XHMessageInputViewStyle)style {
387384
UIEdgeInsets edgeInsets = UIEdgeInsetsMake(9, 9, 9, 9);
388385
button = [self createButtonWithImage:XH_STRETCH_IMAGE([UIImage imageNamed:@"VoiceBtn_Black"], edgeInsets) HLImage:XH_STRETCH_IMAGE([UIImage imageNamed:@"VoiceBtn_BlackHL"], edgeInsets)];
389386
[button setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
390-
[button setTitle:kXHTouchToRecord forState:UIControlStateNormal];
391-
[button setTitle:kXHTouchToFinish forState:UIControlStateHighlighted];
387+
[button setTitle:NSLocalizedStringFromTable(@"HoldToTalk", @"MessageDisplayKitString", nil) forState:UIControlStateNormal];
388+
[button setTitle:NSLocalizedStringFromTable(@"ReleaseToSend", @"MessageDisplayKitString", nil) forState:UIControlStateHighlighted];
392389
buttonFrame = _inputTextView.frame;
393390
button.frame = buttonFrame;
394391
button.alpha = self.voiceChangeButton.selected;

MessageDisplayKit/Classes/Views/MessageInputView/XHVoiceRecordHUD.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
#import "XHVoiceRecordHUD.h"
1010

11-
#define kXHVoiceRecordPauseString @"手指上滑,取消发送"
12-
#define kXHVoiceRecordResaueString @"松开手指,取消发送"
13-
1411
@interface XHVoiceRecordHUD ()
1512

1613
@property (nonatomic, weak) UILabel *remindLabel;
@@ -58,13 +55,13 @@ - (void)startRecordingHUDAtView:(UIView *)view {
5855
- (void)pauseRecord {
5956
[self configRecoding:YES];
6057
self.remindLabel.backgroundColor = [UIColor clearColor];
61-
self.remindLabel.text = kXHVoiceRecordPauseString;
58+
self.remindLabel.text = NSLocalizedStringFromTable(@"SlideToCancel", @"MessageDisplayKitString", nil);
6259
}
6360

6461
- (void)resaueRecord {
6562
[self configRecoding:NO];
6663
self.remindLabel.backgroundColor = [UIColor colorWithRed:1.000 green:0.000 blue:0.000 alpha:0.630];
67-
self.remindLabel.text = kXHVoiceRecordResaueString;
64+
self.remindLabel.text = NSLocalizedStringFromTable(@"ReleaseToCancel", @"MessageDisplayKitString", nil);
6865
}
6966

7067
- (void)stopRecordCompled:(void(^)(BOOL fnished))compled {
@@ -130,7 +127,7 @@ - (void)setup {
130127
remindLabel.layer.cornerRadius = 4;
131128
remindLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
132129
remindLabel.backgroundColor = [UIColor clearColor];
133-
remindLabel.text = kXHVoiceRecordPauseString;
130+
remindLabel.text = NSLocalizedStringFromTable(@"SlideToCancel", @"MessageDisplayKitString", nil);
134131
remindLabel.textAlignment = NSTextAlignmentCenter;
135132
[self addSubview:remindLabel];
136133
_remindLabel = remindLabel;

MessageDisplayKit/Resources/en.lproj/MessageDisplayKitString.strings

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@
3232
"Setting" = "Setting";
3333
"Profile" = "Profile";
3434
"News" = "News";
35+
36+
"HoldToTalk" = "Hold to talk";
37+
"ReleaseToSend" = "Release to send";
38+
"SlideToCancel" = "Slide up to cancel";
39+
"ReleaseToCancel" = "Release to cancel";
40+
"SendAMessage" = "Send a message";
41+
"MessageLocation" = "Message Location";

0 commit comments

Comments
 (0)