Add translation bar dropdown menu.
This commit is contained in:
@@ -21,7 +21,6 @@ namespace {
|
||||
|
||||
const auto kSerializeVersionTag = u"#new"_q;
|
||||
constexpr auto kSerializeVersion = 1;
|
||||
constexpr auto kDefaultLanguage = "en"_cs;
|
||||
constexpr auto kCloudLangPackName = "tdesktop"_cs;
|
||||
constexpr auto kCustomLanguage = "#custom"_cs;
|
||||
constexpr auto kLangValuesLimit = 20000;
|
||||
@@ -213,14 +212,6 @@ void ParseKeyValue(
|
||||
|
||||
} // namespace
|
||||
|
||||
QString DefaultLanguageId() {
|
||||
return kDefaultLanguage.utf16();
|
||||
}
|
||||
|
||||
QString LanguageIdOrDefault(const QString &id) {
|
||||
return !id.isEmpty() ? id : DefaultLanguageId();
|
||||
}
|
||||
|
||||
QString CloudLangPackName() {
|
||||
return kCloudLangPackName.utf16();
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <rpl/producer.h>
|
||||
#include "lang_auto.h"
|
||||
#include "base/const_string.h"
|
||||
#include "base/weak_ptr.h"
|
||||
|
||||
namespace Lang {
|
||||
@@ -31,8 +31,6 @@ inline bool operator!=(const Language &a, const Language &b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
QString DefaultLanguageId();
|
||||
QString LanguageIdOrDefault(const QString &id);
|
||||
QString CloudLangPackName();
|
||||
QString CustomLanguageId();
|
||||
Language DefaultLanguage();
|
||||
|
||||
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "lang/lang_keys.h"
|
||||
|
||||
#include "base/const_string.h"
|
||||
#include "lang/lang_file_parser.h"
|
||||
#include "ui/integration.h"
|
||||
|
||||
@@ -14,6 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr auto kDefaultLanguage = "en"_cs;
|
||||
|
||||
template <typename WithYear, typename WithoutYear>
|
||||
inline QString langDateMaybeWithYear(
|
||||
QDate date,
|
||||
@@ -231,3 +234,15 @@ QString langDateTimeFull(const QDateTime &date) {
|
||||
lt_time,
|
||||
QLocale().toString(date.time(), QLocale::ShortFormat));
|
||||
}
|
||||
|
||||
namespace Lang {
|
||||
|
||||
QString DefaultLanguageId() {
|
||||
return kDefaultLanguage.utf16();
|
||||
}
|
||||
|
||||
QString LanguageIdOrDefault(const QString &id) {
|
||||
return !id.isEmpty() ? id : DefaultLanguageId();
|
||||
}
|
||||
|
||||
} // namespace Lang
|
||||
|
||||
@@ -34,5 +34,7 @@ namespace Lang {
|
||||
[[nodiscard]] QString Id();
|
||||
[[nodiscard]] rpl::producer<> Updated();
|
||||
[[nodiscard]] QString GetNonDefaultValue(const QByteArray &key);
|
||||
[[nodiscard]] QString DefaultLanguageId();
|
||||
[[nodiscard]] QString LanguageIdOrDefault(const QString &id);
|
||||
|
||||
} // namespace Lang
|
||||
|
||||
Reference in New Issue
Block a user