mirror of
https://github.com/status-im/react-native-i18n.git
synced 2025-02-12 12:06:45 +00:00
cb09ea2cc0
On the iOS device the currentLocale returns the region instead of the device language. By using prefered language this is fixed.
28 lines
498 B
Objective-C
28 lines
498 B
Objective-C
//
|
|
// RNI18n.m
|
|
// RNI18n
|
|
//
|
|
// Created by Alexander Zaytsev on 14/06/15.
|
|
// Copyright (c) 2015 Alexander Zaytsev. All rights reserved.
|
|
//
|
|
|
|
#import "RNI18n.h"
|
|
|
|
@interface RNI18n ()
|
|
-(NSString*) getCurrentLocale;
|
|
@end
|
|
|
|
@implementation RNI18n
|
|
RCT_EXPORT_MODULE();
|
|
|
|
-(NSString*) getCurrentLocale{
|
|
NSString *localeString=[[NSLocale preferredLanguages] objectAtIndex:0];
|
|
return localeString;
|
|
}
|
|
|
|
- (NSDictionary *)constantsToExport
|
|
{
|
|
return @{ @"locale": [self getCurrentLocale] };
|
|
}
|
|
@end
|