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

Commit

Permalink
[iOS] Add getLanguageSync for local, and fix original getLanguage met…
Browse files Browse the repository at this point in the history
…hod. (#1552)
  • Loading branch information
wqyfavor authored and cxfeng1 committed Sep 20, 2018
1 parent 8fd46ec commit 5996ca5
Showing 1 changed file with 10 additions and 3 deletions.
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

0 comments on commit 5996ca5

Please sign in to comment.