Skip to content

Commit a57b83d

Browse files
authored
Merge pull request #27 from zoyi/fix/ios_locale_legacy
Add IOS locale legacy
2 parents 4248400 + 354fc15 commit a57b83d

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

ios/RCTConvert+ChannelIO.m

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,27 @@ + (ChannelPluginSettings *)settings:(id)json {
6161
}
6262

6363
NSString *language = [RCTConvert NSString:json[@"language"]];
64-
if ([language isEqualToString:@"ko"]) {
65-
settings.language = CHLocaleKorean;
66-
} else if ([language isEqualToString:@"ja"]) {
67-
settings.language = CHLocaleJapanese;
68-
} else if ([language isEqualToString:@"en"]) {
69-
settings.language = CHLocaleEnglish;
64+
NSString *locale = [RCTConvert NSString:json[@"locale"]];
65+
if (json[@"locale"] != 0) {
66+
if ([locale isEqualToString:@"ko"]) {
67+
settings.language = CHLocaleKorean;
68+
} else if ([locale isEqualToString:@"ja"]) {
69+
settings.language = CHLocaleJapanese;
70+
} else if ([locale isEqualToString:@"en"]) {
71+
settings.language = CHLocaleEnglish;
72+
} else {
73+
settings.language = CHLocaleDevice;
74+
}
7075
} else {
71-
settings.language = CHLocaleDevice;
76+
if ([language isEqualToString:@"ko"]) {
77+
settings.language = CHLocaleKorean;
78+
} else if ([language isEqualToString:@"ja"]) {
79+
settings.language = CHLocaleJapanese;
80+
} else if ([language isEqualToString:@"en"]) {
81+
settings.language = CHLocaleEnglish;
82+
} else {
83+
settings.language = CHLocaleDevice;
84+
}
7285
}
7386
return settings;
7487
}

0 commit comments

Comments
 (0)