Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[iOS] Add getLanguageSync for local, and fix original getLanguage met… #1552

Merged
merged 1 commit into from
Sep 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions ios/sdk/WeexSDK/Sources/Module/WXLocaleModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,24 @@

@implementation WXLocaleModule

WX_EXPORT_METHOD_SYNC(@selector(getLanguage:))
WX_EXPORT_METHOD(@selector(getLanguage:))
WX_EXPORT_METHOD_SYNC(@selector(getLanguageSync))
WX_EXPORT_METHOD_SYNC(@selector(getLanguages))

/**
Get preferred language of the user
*/
- (NSString *)getLanguage:(WXKeepAliveCallback)callback {
- (void)getLanguage:(WXKeepAliveCallback)callback {
if (callback) {
callback([NSLocale preferredLanguages][0], NO);
}
return [NSLocale preferredLanguages][0];
}

/**
Get preferred language of the user
*/
- (NSString *)getLanguageSync {
return [NSLocale preferredLanguages][0];
}

/**
Expand Down