diff --git a/Telegram/SourceFiles/codegen/lang/parsed_file.cpp b/Telegram/SourceFiles/codegen/lang/parsed_file.cpp index 5ad9f61a85..a2833ff53c 100644 --- a/Telegram/SourceFiles/codegen/lang/parsed_file.cpp +++ b/Telegram/SourceFiles/codegen/lang/parsed_file.cpp @@ -78,14 +78,14 @@ QString PrepareCommandString(int index) { } // namespace -const std::array kPluralParts = { +const std::array kPluralParts = { { "zero", "one", "two", "few", "many", "other", -}; +} }; const QString kPluralTag = "count"; diff --git a/Telegram/SourceFiles/lang/lang_file_parser.cpp b/Telegram/SourceFiles/lang/lang_file_parser.cpp index c5e24e4b91..ed62ebdaef 100644 --- a/Telegram/SourceFiles/lang/lang_file_parser.cpp +++ b/Telegram/SourceFiles/lang/lang_file_parser.cpp @@ -181,7 +181,7 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela QByteArray data; int skip = 0; - auto readUtf16Stream = [relativePath, absolutePath](auto &stream) { + auto readUtf16Stream = [relativePath, absolutePath](auto &&stream) { stream.setCodec("UTF-16"); auto string = stream.readAll(); if (stream.status() != QTextStream::Ok) { diff --git a/Telegram/SourceFiles/platform/mac/specific_mac.mm b/Telegram/SourceFiles/platform/mac/specific_mac.mm index e30b80b259..541e51f757 100644 --- a/Telegram/SourceFiles/platform/mac/specific_mac.mm +++ b/Telegram/SourceFiles/platform/mac/specific_mac.mm @@ -26,9 +26,16 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "passcodewidget.h" #include "mainwindow.h" #include "history/history_location_manager.h" +#include "platform/mac/mac_utilities.h" #include +#include +#include +#include +#include +#include + namespace { QStringList _initLogs; @@ -395,12 +402,24 @@ void StartTranslucentPaint(QPainter &p, QPaintEvent *e) { } QString SystemCountry() { - QString country = objc_currentCountry(); - return country.isEmpty() ? QString::fromLatin1(DefaultCountry) : country; + NSLocale *currentLocale = [NSLocale currentLocale]; // get the current locale. + NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; + return countryCode ? NS2QString(countryCode) : QString(); } QString SystemLanguage() { - return objc_currentLang(); + if (auto currentLocale = [NSLocale currentLocale]) { // get the current locale. + if (NSString *collator = [currentLocale objectForKey:NSLocaleCollatorIdentifier]) { + return NS2QString(collator); + } + if (NSString *identifier = [currentLocale objectForKey:NSLocaleIdentifier]) { + return NS2QString(identifier); + } + if (NSString *language = [currentLocale objectForKey:NSLocaleLanguageCode]) { + return NS2QString(language); + } + } + return QString(); } } // namespace Platform diff --git a/Telegram/SourceFiles/platform/mac/specific_mac_p.h b/Telegram/SourceFiles/platform/mac/specific_mac_p.h index 838203880a..24b1531b46 100644 --- a/Telegram/SourceFiles/platform/mac/specific_mac_p.h +++ b/Telegram/SourceFiles/platform/mac/specific_mac_p.h @@ -46,8 +46,6 @@ double objc_appkitVersion(); QString objc_documentsPath(); QString objc_appDataPath(); QString objc_downloadPath(); -QString objc_currentCountry(); -QString objc_currentLang(); QByteArray objc_downloadPathBookmark(const QString &path); QByteArray objc_pathBookmark(const QString &path); void objc_downloadPathEnableAccess(const QByteArray &bookmark); diff --git a/Telegram/SourceFiles/platform/mac/specific_mac_p.mm b/Telegram/SourceFiles/platform/mac/specific_mac_p.mm index 42fd622c23..f055b923d9 100644 --- a/Telegram/SourceFiles/platform/mac/specific_mac_p.mm +++ b/Telegram/SourceFiles/platform/mac/specific_mac_p.mm @@ -542,27 +542,6 @@ QString objc_downloadPath() { return QString(); } -QString objc_currentCountry() { - NSLocale *currentLocale = [NSLocale currentLocale]; // get the current locale. - NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; - return countryCode ? NS2QString(countryCode) : QString(); -} - -QString objc_currentLang() { - if (auto currentLocale = [NSLocale currentLocale]) { // get the current locale. - if (NSString *collator = [currentLocale objectForKey:NSLocaleCollatorIdentifier]) { - return NS2QString(collator); - } - if (NSString *identifier = [currentLocale objectForKey:NSLocaleIdentifier]) { - return NS2QString(identifier); - } - if (NSString *language = [currentLocale objectForKey:NSLocaleLanguageCode]) { - return NS2QString(language); - } - } - return QString(); -} - QByteArray objc_downloadPathBookmark(const QString &path) { #ifndef OS_MAC_STORE return QByteArray();