forked from organicmaps/organicmaps
[ios] Correct ugc review locale.
This commit is contained in:
parent
2bd5b1e410
commit
e7d26e1957
2 changed files with 11 additions and 12 deletions
|
@ -3,10 +3,10 @@
|
|||
#import <CoreTelephony/CTCarrier.h>
|
||||
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
|
||||
#import <sys/utsname.h>
|
||||
#import "LocaleTranslator.h"
|
||||
#import "MWMCommon.h"
|
||||
#import "SwiftBridge.h"
|
||||
|
||||
#include "platform/preferred_languages.hpp"
|
||||
#include "platform/settings.hpp"
|
||||
|
||||
extern string const kCountryCodeKey = "CountryCode";
|
||||
|
@ -207,18 +207,18 @@ NSDictionary * const kDeviceNamesWithMetalDriver = @{
|
|||
|
||||
- (NSString *)twoLetterInputLanguage
|
||||
{
|
||||
return @(locale_translator::bcp47ToTwineLanguage(self.inputLanguage).c_str());
|
||||
return @(languages::Normalize(self.inputLanguage.UTF8String).c_str());
|
||||
}
|
||||
|
||||
- (NSString *)languageId
|
||||
{
|
||||
NSArray * languages = NSLocale.preferredLanguages;
|
||||
return languages.count == 0 ? nil : languages[0];
|
||||
return NSLocale.preferredLanguages.firstObject;
|
||||
}
|
||||
|
||||
- (NSString *)twoLetterLanguageId
|
||||
{
|
||||
return @(locale_translator::bcp47ToTwineLanguage(self.languageId).c_str());
|
||||
auto languageId = self.languageId;
|
||||
return languageId ? @(languages::Normalize(languageId.UTF8String).c_str()) : @"en";
|
||||
}
|
||||
|
||||
- (NSDate *)buildDate
|
||||
|
|
|
@ -702,15 +702,14 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS";
|
|||
- (void)setUGCUpdateFrom:(MWMUGCReviewModel *)reviewModel
|
||||
{
|
||||
using namespace ugc;
|
||||
|
||||
auto appInfo = AppInfo.sharedInfo;
|
||||
auto const locale =
|
||||
static_cast<uint8_t>(StringUtf8Multilang::GetLangIndex(languages::GetCurrentNorm()));
|
||||
static_cast<uint8_t>(StringUtf8Multilang::GetLangIndex(appInfo.twoLetterLanguageId.UTF8String));
|
||||
std::vector<uint8_t> keyboardLanguages;
|
||||
{
|
||||
// TODO: Set the list of used keyboard languages (not only the recent one).
|
||||
auto lastInputLanguage = [[AppInfo sharedInfo] twoLetterInputLanguage];
|
||||
keyboardLanguages.push_back(StringUtf8Multilang::GetLangIndex(lastInputLanguage.UTF8String));
|
||||
}
|
||||
// TODO: Set the list of used keyboard languages (not only the recent one).
|
||||
auto lastInputLanguage = appInfo.twoLetterInputLanguage;
|
||||
keyboardLanguages.emplace_back(StringUtf8Multilang::GetLangIndex(lastInputLanguage.UTF8String));
|
||||
|
||||
KeyboardText t{reviewModel.text.UTF8String, locale, keyboardLanguages};
|
||||
Ratings r;
|
||||
for (MWMUGCRatingStars * star in reviewModel.ratings)
|
||||
|
|
Loading…
Add table
Reference in a new issue