Skip to content

Commit 3e3e5fa

Browse files
authored
Merge pull request #6 from lixm1988/main
UI国际化
2 parents 13dc89d + cc340d5 commit 3e3e5fa

File tree

8 files changed

+95
-28
lines changed

8 files changed

+95
-28
lines changed

Classes/Process/EaseCallManager.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#import <Masonry/Masonry.h>
1616
#import "EaseCallModal.h"
1717
#import <CommonCrypto/CommonDigest.h>
18+
#import "EaseCallLocalizable.h"
1819

1920
static NSString* kAction = @"action";
2021
static NSString* kChannelName = @"channelName";
@@ -466,12 +467,12 @@ - (void)sendInviteMsgToCallee:(NSString*)aUid type:(EaseCallType)aType callId:(N
466467
{
467468
if([aUid length] == 0 || [aCallId length] == 0 || [aChannelName length] == 0)
468469
return;
469-
NSString* strType = @"语音";
470+
NSString* strType = EaseCallLocalizableString(@"voice", nil);
470471
if(aType == EaseCallTypeMulti)
471-
strType = @"多人视频";
472+
strType = EaseCallLocalizableString(@"conferenece", nil);
472473
if(aType == EaseCallType1v1Video)
473-
strType = @"视频";
474-
EMTextMessageBody* msgBody = [[EMTextMessageBody alloc] initWithText:[NSString stringWithFormat: @"邀请您进行%@通话",strType]];
474+
strType = EaseCallLocalizableString(@"video", nil);
475+
EMTextMessageBody* msgBody = [[EMTextMessageBody alloc] initWithText:[NSString stringWithFormat: EaseCallLocalizableString(@"inviteInfo", nil),strType]];
475476
NSMutableDictionary* ext = [@{kMsgType:kMsgTypeValue,kAction:kInviteAction,kCallId:aCallId,kCallType:[NSNumber numberWithInt:(int)aType],kCallerDevId:self.modal.curDevId,kChannelName:aChannelName,kTs:[self getTs]} mutableCopy];
476477
if(aExt && aExt.count > 0) {
477478
[ext setValue:aExt forKey:kExt];
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// EaseCallLocalizable.h
3+
// Pods
4+
//
5+
// Created by lixiaoming on 2021/12/9.
6+
//
7+
8+
#ifndef EaseCallLocalizable_h
9+
#define EaseCallLocalizable_h
10+
#define EaseCallLocalizableString(key,comment) ^{\
11+
NSBundle* bundle = [NSBundle bundleForClass:[EaseCallManager class]];\
12+
return NSLocalizedStringFromTableInBundle(key, nil, bundle, comment);\
13+
}()
14+
15+
#endif /* EaseCallLocalizable_h */

Classes/ViewController/EaseCallBaseViewController.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#import "EaseCallManager+Private.h"
1111
#import <Masonry/Masonry.h>
1212
#import "UIImage+Ext.h"
13+
#import "EaseCallLocalizable.h"
1314

1415
@interface EaseCallBaseViewController ()
1516

@@ -145,7 +146,7 @@ - (void)setubSubViews
145146
self.hangupLabel.font = [UIFont systemFontOfSize:11];
146147
self.hangupLabel.textColor = [UIColor whiteColor];
147148
self.hangupLabel.textAlignment = NSTextAlignmentCenter;
148-
self.hangupLabel.text = @"挂断";
149+
self.hangupLabel.text = EaseCallLocalizableString(@"Huangup",nil);
149150
[self.contentView addSubview:self.hangupLabel];
150151
[self.hangupLabel mas_makeConstraints:^(MASConstraintMaker *make) {
151152
make.top.equalTo(self.hangupButton.mas_bottom).with.offset(5);
@@ -156,7 +157,7 @@ - (void)setubSubViews
156157
self.acceptLabel.font = [UIFont systemFontOfSize:11];
157158
self.acceptLabel.textColor = [UIColor whiteColor];
158159
self.acceptLabel.textAlignment = NSTextAlignmentCenter;
159-
self.acceptLabel.text = @"接听";
160+
self.acceptLabel.text = EaseCallLocalizableString(@"Answer",nil);
160161
[self.contentView addSubview:self.acceptLabel];
161162
[self.acceptLabel mas_makeConstraints:^(MASConstraintMaker *make) {
162163
make.top.equalTo(self.answerButton.mas_bottom).with.offset(5);
@@ -167,7 +168,7 @@ - (void)setubSubViews
167168
self.microphoneLabel.font = [UIFont systemFontOfSize:11];
168169
self.microphoneLabel.textColor = [UIColor whiteColor];
169170
self.microphoneLabel.textAlignment = NSTextAlignmentCenter;
170-
self.microphoneLabel.text = @"静音";
171+
self.microphoneLabel.text = EaseCallLocalizableString(@"Mute",nil);
171172
[self.contentView addSubview:self.microphoneLabel];
172173
[self.microphoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
173174
make.top.equalTo(self.microphoneButton.mas_bottom).with.offset(5);
@@ -178,7 +179,7 @@ - (void)setubSubViews
178179
self.speakerLabel.font = [UIFont systemFontOfSize:11];
179180
self.speakerLabel.textColor = [UIColor whiteColor];
180181
self.speakerLabel.textAlignment = NSTextAlignmentCenter;
181-
self.speakerLabel.text = @"免提";
182+
self.speakerLabel.text = EaseCallLocalizableString(@"Hands-free",nil);
182183
[self.contentView addSubview:self.speakerLabel];
183184
[self.speakerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
184185
make.top.equalTo(self.speakerButton.mas_bottom).with.offset(5);
@@ -189,7 +190,7 @@ - (void)setubSubViews
189190
self.enableCameraLabel.font = [UIFont systemFontOfSize:11];
190191
self.enableCameraLabel.textColor = [UIColor whiteColor];
191192
self.enableCameraLabel.textAlignment = NSTextAlignmentCenter;
192-
self.enableCameraLabel.text = @"摄像头";
193+
self.enableCameraLabel.text = EaseCallLocalizableString(@"Camera",nil);
193194
[self.contentView addSubview:self.enableCameraLabel];
194195
[self.enableCameraLabel mas_makeConstraints:^(MASConstraintMaker *make) {
195196
make.top.equalTo(self.enableCameraButton.mas_bottom).with.offset(5);
@@ -200,7 +201,7 @@ - (void)setubSubViews
200201
self.switchCameraLabel.font = [UIFont systemFontOfSize:11];
201202
self.switchCameraLabel.textColor = [UIColor whiteColor];
202203
self.switchCameraLabel.textAlignment = NSTextAlignmentCenter;
203-
self.switchCameraLabel.text = @"切换摄像头";
204+
self.switchCameraLabel.text = EaseCallLocalizableString(@"SwitchCamera",nil);
204205
[self.contentView addSubview:self.switchCameraLabel];
205206
[self.switchCameraLabel mas_makeConstraints:^(MASConstraintMaker *make) {
206207
make.top.equalTo(self.switchCameraButton.mas_bottom).with.offset(5);

Classes/ViewController/EaseCallMultiViewController.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#import <SDWebImage/UIImageView+WebCache.h>
1515
#import <SDWebImage/UIView+WebCache.h>
1616
#import "UIImage+Ext.h"
17+
#import "EaseCallLocalizable.h"
1718

1819
@interface EaseCallMultiViewController ()<EaseCallStreamViewDelegate>
1920
@property (nonatomic) UIButton* inviteButton;
@@ -80,7 +81,7 @@ - (void)setupSubViews
8081
self.statusLable.font = [UIFont systemFontOfSize:15];
8182
self.statusLable.textColor = [UIColor colorWithWhite:1.0 alpha:0.5];
8283
self.statusLable.textAlignment = NSTextAlignmentRight;
83-
self.statusLable.text = @"邀请你进行音视频会话";
84+
self.statusLable.text = EaseCallLocalizableString(@"receiveCallInviteprompt",nil);
8485
self.answerButton.hidden = NO;
8586
self.acceptLabel.hidden = NO;
8687
[self.contentView addSubview:self.statusLable];
@@ -429,9 +430,9 @@ - (void)miniAction
429430
self.floatingView.enableVideo = NO;
430431
self.floatingView.delegate = self;
431432
if(self.isJoined) {
432-
self.floatingView.nameLabel.text = @"通话中";
433+
self.floatingView.nameLabel.text = EaseCallLocalizableString(@"Call in progress",nil);
433434
}else{
434-
self.floatingView.nameLabel.text = @"等待接听";
435+
self.floatingView.nameLabel.text = EaseCallLocalizableString(@"waitforanswer",nil);
435436
}
436437
}
437438

Classes/ViewController/EaseCallSingleViewController.m

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#import <Masonry/Masonry.h>
1111
#import <SDWebImage/UIImageView+WebCache.h>
1212
#import "UIImage+Ext.h"
13+
#import "EaseCallLocalizable.h"
1314

1415
@interface EaseCallSingleViewController ()<EaseCallStreamViewDelegate>
1516
@property (nonatomic) NSString* remoteUid;
@@ -71,7 +72,7 @@ - (void)viewDidLoad {
7172
self.switchToVoiceLable.font = [UIFont systemFontOfSize:11];
7273
self.switchToVoiceLable.textColor = [UIColor whiteColor];
7374
self.switchToVoiceLable.textAlignment = NSTextAlignmentCenter;
74-
self.switchToVoiceLable.text = @"转音频";
75+
self.switchToVoiceLable.text = EaseCallLocalizableString(@"switchvoice",nil);
7576
[self.contentView addSubview:self.switchToVoiceLable];
7677
if(self.isCaller) {
7778
[self.switchToVoiceLable mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -98,12 +99,12 @@ - (void)viewDidLoad {
9899
}];
99100

100101
if(self.isCaller) {
101-
self.statusLable.text = @"正在等待对方接受邀请";
102+
self.statusLable.text = EaseCallLocalizableString(@"waitforanswer",nil);
102103
self.answerButton.hidden = YES;
103104
self.acceptLabel.hidden = YES;
104105
}else
105106
{
106-
self.statusLable.text = @"邀请你进行音视频通话";
107+
self.statusLable.text = EaseCallLocalizableString(@"receiveCallInviteprompt",nil);
107108
self.localView.hidden = YES;
108109
self.remoteView.hidden = YES;
109110
}
@@ -450,9 +451,9 @@ - (void)miniAction
450451
}];
451452
}
452453
if(self.isConnected) {
453-
self.floatingView.nameLabel.text = @"通话中";
454+
self.floatingView.nameLabel.text = EaseCallLocalizableString(@"Call in progress",nil);
454455
}else{
455-
self.floatingView.nameLabel.text = @"等待接听";
456+
self.floatingView.nameLabel.text = EaseCallLocalizableString(@"waitforanswer",nil);
456457
self.floatingView.enableVideo = NO;
457458
}
458459
}
@@ -522,7 +523,7 @@ - (void)setRemoteDisplayView:(UIView*)aDisplayView enableVideo:(BOOL)aEnableVide
522523
};
523524
if(self.isMini) {
524525
setDisplayView(self.floatingView);
525-
self.floatingView.nameLabel.text = @"通话中";
526+
self.floatingView.nameLabel.text = EaseCallLocalizableString(@"Call in progress",nil);
526527
return;
527528
}else{
528529
setDisplayView(self.remoteView);
@@ -546,9 +547,9 @@ - (void)showTip:(BOOL)aEnableVoice
546547
{
547548
NSString* msg = @"";
548549
if(aEnableVoice)
549-
msg = @"对方打开了音频";
550+
msg = EaseCallLocalizableString(@"remoteUnmute",nil);
550551
else
551-
msg = @"对方关闭了音频";
552+
msg = EaseCallLocalizableString(@"remoteMute",nil);
552553
_tipLabel.alpha = 1.0;
553554
self.tipLabel.text = msg;
554555
[UIView animateWithDuration:3 animations:^{
@@ -571,7 +572,7 @@ - (void)setIsConnected:(BOOL)isConnected
571572
[self startTimer];
572573
if(self.isMini && self.type == EaseCallType1v1Video) {
573574
self.floatingView.enableVideo = YES;
574-
self.floatingView.nameLabel.text = @"通话中";
575+
self.floatingView.nameLabel.text = EaseCallLocalizableString(@"Call in progress",nil);
575576
}
576577
}
577578
if(self.type == EaseCallType1v1Video && isConnected)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Localizable.strings
3+
Pods
4+
5+
Created by lixiaoming on 2021/12/2.
6+
7+
*/
8+
"voice" = "voice";
9+
"conferenece" = "conferenece";
10+
"video" = "video";
11+
"inviteInfo" = "Invite you to a %@ call";
12+
"Huangup" = "Hang up";
13+
"Answer" = "Answer";
14+
"Mute" = "Mute";
15+
"Hands-free" = "Hands-free";
16+
"Camera" = "Camera";
17+
"SwitchCamera" = "Change camera";
18+
"Call in progress" = "Call in progress";
19+
"waitforanswer" = "Wait for the other party to answer";
20+
"switchvoice" = "Convert to audio";
21+
"waitforanswer" = "Waiting for the other party to accept the invitation";
22+
"receiveCallInviteprompt" = "invited you to a video call";
23+
"remoteUnmute" = "The other party unmuted";
24+
"remoteMute" = "he other party muted";
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Localizable.strings
3+
Pods
4+
5+
Created by lixiaoming on 2021/12/2.
6+
7+
*/
8+
"voice" = "语音";
9+
"conferenece" = "多人视频";
10+
"video" = "视频";
11+
"inviteInfo" = "邀请您进行%@通话";
12+
"Huangup" = "挂断";
13+
"Answer" = "接听";
14+
"Mute" = "静音";
15+
"Hands-free" = "免提";
16+
"Camera" = "摄像头";
17+
"SwitchCamera" = "切换摄像头";
18+
"Call in progress" = "通话中";
19+
"waitforanswer" = "等待接听";
20+
"switchvoice" = "转音频";
21+
"waitforanswer" = "正在等待对方接受邀请";
22+
"receiveCallInviteprompt" = "邀请你进行音视频通话";
23+
"remoteUnmute" = "对方打开了音频";
24+
"remoteMute" = "对方关闭了音频";

EaseCallKit.podspec

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
Pod::Spec.new do |s|
22
s.name = 'EaseCallKit'
3-
s.version = '1.0.0'
4-
s.summary = '测试'
3+
s.version = '3.8.8'
4+
s.summary = 'A Ease Call UIKit'
55
s.description = <<-DESC
6-
测试.
6+
‘一套使用环信IM以及声网SDK实现音视频呼叫的UI库,可以实现单人语音、视频呼叫,以及多人音视频通话’
77
DESC
88
s.homepage = 'https://www.easemob.com'
99
s.license = { :type => 'MIT', :file => 'LICENSE' }
1010
s.author = { 'easemob' => '[email protected]' }
11-
s.source = { :git => 'http://XXX/EaseCallKit.git', :tag => s.version.to_s }
11+
s.source = { :git => 'https://github.com/easemob/easecallkitui-ios.git', :tag => s.version.to_s }
1212
s.frameworks = 'UIKit'
1313
s.libraries = 'stdc++'
1414
s.ios.deployment_target = '9.0'
15-
s.source_files = 'Classes/**/*.{h,m}'
15+
s.source_files = 'Classes/**/*.{h,m,strings}'
1616
s.public_header_files = [
1717
'Classes/Process/EaseCallManager.h',
1818
'Classes/Utils/EaseCallDefine.h',
@@ -24,5 +24,5 @@ Pod::Spec.new do |s|
2424
s.dependency 'HyphenateChat'
2525
s.dependency 'Masonry'
2626
s.dependency 'AgoraRtcEngine_iOS'
27-
s.dependency 'SDWebImage', '~> 3.7.2'
27+
s.dependency 'SDWebImage'
2828
end

0 commit comments

Comments
 (0)