Update language pack API.
GitOrigin-RevId: 252723bc424afb8e0eb3c1647198e302b23e10db
This commit is contained in:
parent
20d1e6902d
commit
ad26781fbc
@ -1703,16 +1703,16 @@ chatEvents events:vector<chatEvent> = ChatEvents;
|
||||
chatEventLogFilters message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool = ChatEventLogFilters;
|
||||
|
||||
|
||||
//@class LanguagePackStringValue @description Represents a value of language pack string
|
||||
//@class LanguagePackStringValue @description Represents the value of a string in a language pack
|
||||
|
||||
//@description An ordinary language pack string @value String value
|
||||
languagePackStringValueOrdinary value:string = LanguagePackStringValue;
|
||||
|
||||
//@description A language pack string, which has different forms based on some quantity @zero_value Value for zero objects @one_value Value for one object @two_value Value for two objects
|
||||
//@description A language pack string which has different forms based on the number of some object it mentions @zero_value Value for zero objects @one_value Value for one object @two_value Value for two objects
|
||||
//@few_value Value for few objects @many_value Value for many objects @other_value Default value
|
||||
languagePackStringValuePluralized zero_value:string one_value:string two_value:string few_value:string many_value:string other_value:string = LanguagePackStringValue;
|
||||
|
||||
//@description A deleted language pack string, the value should be taken from a built-in english language pack
|
||||
//@description A deleted language pack string, the value should be taken from the built-in english language pack
|
||||
languagePackStringValueDeleted = LanguagePackStringValue;
|
||||
|
||||
|
||||
@ -1722,11 +1722,11 @@ languagePackString key:string value:LanguagePackStringValue = LanguagePackString
|
||||
//@description Contains a list of language pack strings @strings A list of language pack strings
|
||||
languagePackStrings strings:vector<languagePackString> = LanguagePackStrings;
|
||||
|
||||
//@description Contains information about a language @code Language code @name Language name @native_name Language native name @local_string_count Total number of locally available non-deleted strings from the language
|
||||
languageInfo code:string name:string native_name:string local_string_count:int32 = LanguageInfo;
|
||||
//@description Contains information about a language pack @id Unique language pack identifier @name Language name @native_name Name of the language in that language @local_string_count Total number of non-deleted strings from the language pack available locally
|
||||
languagePackInfo id:string name:string native_name:string local_string_count:int32 = LanguagePackInfo;
|
||||
|
||||
//@description Contains information about a language pack @languages List of available languages
|
||||
languagePack languages:vector<languageInfo> = LanguagePack;
|
||||
//@description Contains information about the current localization target @language_packs List of available language packs for this application
|
||||
localizationTargetInfo language_packs:vector<languagePackInfo> = LocalizationTargetInfo;
|
||||
|
||||
|
||||
//@class DeviceToken @description Represents a data needed to subscribe for push notifications. To use specific push notification service, you must specify the correct application platform and upload valid server authentication data at https://my.telegram.org
|
||||
@ -2270,8 +2270,8 @@ updateFavoriteStickers sticker_ids:vector<int32> = Update;
|
||||
//@description The list of saved animations was updated @animation_ids The new list of file identifiers of saved animations
|
||||
updateSavedAnimations animation_ids:vector<int32> = Update;
|
||||
|
||||
//@description Some language pack strings was updated @language_pack Changed language pack @language_code Code of the language, which was updated @strings List of changed language pack strings
|
||||
updateLanguagePackStrings language_pack:string language_code:string strings:vector<languagePackString> = Update;
|
||||
//@description Some language pack strings have been updated @localization_target Localization target to which the language pack belongs @language_pack_id Identifier of the updated language pack @strings List of changed language pack strings
|
||||
updateLanguagePackStrings localization_target:string language_pack_id:string strings:vector<languagePackString> = Update;
|
||||
|
||||
//@description The connection state has changed @state The new connection state
|
||||
updateConnectionState state:ConnectionState = Update;
|
||||
@ -2648,8 +2648,9 @@ getFileExtension mime_type:string = Text;
|
||||
//@description Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. This is an offline method. Can be called before authorization. Can be called synchronously @file_name File name or path to the file
|
||||
cleanFileName file_name:string = Text;
|
||||
|
||||
//@description Returns a string stored in a local database from specified language pack and language by its key. Returns a 404 error if the string is not found. This is an offline method. Can be called before authorization. Can be called synchronously @language_database_path Path to a language database in which strings are stored @language_pack Language pack of string to return @language_code Language code of string to return @key Language pack key of string to return
|
||||
getLanguagePackString language_database_path:string language_pack:string language_code:string key:string = LanguagePackStringValue;
|
||||
//@description Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. This is an offline method. Can be called before authorization. Can be called synchronously
|
||||
//@language_pack_database_path Path to the language pack database in which strings are stored @localization_target Localization target to which the language pack belongs @language_pack_id Language pack identifier @key Language pack key of the string to be returned
|
||||
getLanguagePackString language_pack_database_path:string localization_target:string language_pack_id:string key:string = LanguagePackStringValue;
|
||||
|
||||
|
||||
//@description Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires @bot_user_id The identifier of the target bot
|
||||
@ -3130,23 +3131,23 @@ getSupportUser = User;
|
||||
getWallpapers = Wallpapers;
|
||||
|
||||
|
||||
//@description Returns information about the used language pack
|
||||
getLanguagePackInfo = LanguagePack;
|
||||
//@description Returns information about the current localization target
|
||||
getLocalizationTargetInfo = LocalizationTargetInfo;
|
||||
|
||||
//@description Returns strings from a language in the used language pack by their keys @language_code Language code of strings to return @keys Language pack keys of strings to return; may be empty to get all available strings
|
||||
getLanguagePackStrings language_code:string keys:vector<string> = LanguagePackStrings;
|
||||
//@description Returns strings from a language pack in the current localization target by their keys @language_pack_id Language pack identifier of the strings to be returned @keys Language pack keys of the strings to be returned; leave empty to request all available strings
|
||||
getLanguagePackStrings language_pack_id:string keys:vector<string> = LanguagePackStrings;
|
||||
|
||||
//@description Adds or changes a custom language to the used language pack @info Information about the language. Language code must start with 'X', consist only of English letters, digits and hyphens and be not longer than 64 characters @strings New language pack strings
|
||||
setCustomLanguage info:languageInfo strings:vector<languagePackString> = Ok;
|
||||
//@description Adds or changes a custom language pack to the current localization target @info Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters @strings Strings of the new language pack
|
||||
setCustomLanguagePack info:languagePackInfo strings:vector<languagePackString> = Ok;
|
||||
|
||||
//@description Edits informatioan about a custom language @info New information about the custom language
|
||||
editCustomLanguageInfo info:languageInfo = Ok;
|
||||
//@description Edits information about a custom language pack in the current localization target @info New information about the custom language pack
|
||||
editCustomLanguagePackInfo info:languagePackInfo = Ok;
|
||||
|
||||
//@description Sets new value for a string in a custom language in the used language pack @language_code The code of previously added custom language, must start with 'X' @new_string New language pack string
|
||||
setCustomLanguageString language_code:string new_string:languagePackString = Ok;
|
||||
//@description Adds, edits or deletes a string in a custom language pack @language_pack_id Identifier of a previously added custom language pack in the current localization target @new_string New language pack string
|
||||
setCustomLanguagePackString language_pack_id:string new_string:languagePackString = Ok;
|
||||
|
||||
//@description Deletes all information about a language in the used language pack. Currently used language can't be deleted @language_code Language code of a language to delete
|
||||
deleteLanguage language_code:string = Ok;
|
||||
//@description Deletes all information about a language pack in the current localization target. The language pack that is currently in use can't be deleted @language_pack_id Identifier of the language pack to delete
|
||||
deleteLanguagePack language_pack_id:string = Ok;
|
||||
|
||||
|
||||
//@description Registers the currently used device for receiving push notifications @device_token Device token @other_user_ids List of at most 100 user identifiers of other users currently using the client
|
||||
|
Binary file not shown.
@ -804,16 +804,16 @@ void ConfigManager::process_config(tl_object_ptr<telegram_api::config> config) {
|
||||
if (is_from_main_dc) {
|
||||
shared_config.set_option_integer("webfile_dc_id", config->webfile_dc_id_);
|
||||
if ((config->flags_ & telegram_api::config::TMP_SESSIONS_MASK) != 0) {
|
||||
G()->shared_config().set_option_integer("session_count", config->tmp_sessions_);
|
||||
shared_config.set_option_integer("session_count", config->tmp_sessions_);
|
||||
} else {
|
||||
G()->shared_config().set_option_empty("session_count");
|
||||
shared_config.set_option_empty("session_count");
|
||||
}
|
||||
if ((config->flags_ & telegram_api::config::SUGGESTED_LANG_CODE_MASK) != 0) {
|
||||
G()->shared_config().set_option_string("suggested_language_code", config->suggested_lang_code_);
|
||||
G()->shared_config().set_option_integer("language_pack_version", config->lang_pack_version_);
|
||||
shared_config.set_option_string("suggested_language_pack_id", config->suggested_lang_code_);
|
||||
shared_config.set_option_integer("language_pack_version", config->lang_pack_version_);
|
||||
} else {
|
||||
G()->shared_config().set_option_empty("suggested_language_code");
|
||||
G()->shared_config().set_option_empty("language_pack_version");
|
||||
shared_config.set_option_empty("suggested_language_pack_id");
|
||||
shared_config.set_option_empty("language_pack_version");
|
||||
}
|
||||
}
|
||||
|
||||
@ -853,6 +853,7 @@ void ConfigManager::process_config(tl_object_ptr<telegram_api::config> config) {
|
||||
}
|
||||
|
||||
// delete outdated options
|
||||
shared_config.set_option_empty("suggested_language_code");
|
||||
shared_config.set_option_empty("chat_big_size");
|
||||
shared_config.set_option_empty("group_size_max");
|
||||
shared_config.set_option_empty("saved_gifs_limit");
|
||||
|
@ -130,7 +130,7 @@ static int32 load_database_language_key_count(SqliteKeyValue *kv) {
|
||||
for (auto &str : kv->get_all()) {
|
||||
key_count += str.first[0] != '!' && (str.second[0] == '1' || str.second[0] == '2');
|
||||
}
|
||||
LOG(INFO) << "Set language key count in database to " << key_count;
|
||||
LOG(INFO) << "Set language pack key count in database to " << key_count;
|
||||
kv->set("!key_count", to_string(key_count));
|
||||
return key_count;
|
||||
}
|
||||
@ -148,7 +148,7 @@ LanguagePackManager::LanguageDatabase *LanguagePackManager::add_language_databas
|
||||
if (!path.empty()) {
|
||||
auto r_database = open_database(path);
|
||||
if (r_database.is_error()) {
|
||||
LOG(ERROR) << "Can't open language database " << path << ": " << r_database.error();
|
||||
LOG(ERROR) << "Can't open language pack database " << path << ": " << r_database.error();
|
||||
return add_language_database(string());
|
||||
}
|
||||
|
||||
@ -164,20 +164,20 @@ LanguagePackManager::LanguageDatabase *LanguagePackManager::add_language_databas
|
||||
void LanguagePackManager::start_up() {
|
||||
std::lock_guard<std::mutex> lock(language_database_mutex_);
|
||||
manager_count_++;
|
||||
language_pack_ = G()->shared_config().get_option_string("language_pack");
|
||||
language_code_ = G()->shared_config().get_option_string("language_code");
|
||||
language_pack_ = G()->shared_config().get_option_string("localization_target");
|
||||
language_code_ = G()->shared_config().get_option_string("language_pack_id");
|
||||
CHECK(check_language_pack_name(language_pack_));
|
||||
CHECK(check_language_code_name(language_code_));
|
||||
|
||||
database_ = add_language_database(G()->shared_config().get_option_string("language_database_path"));
|
||||
database_ = add_language_database(G()->shared_config().get_option_string("language_pack_database_path"));
|
||||
if (!language_pack_.empty() && !language_code_.empty()) {
|
||||
auto language = add_language(database_, language_pack_, language_code_);
|
||||
if (!is_custom_language_code(language_code_) && language->version_ == -1) {
|
||||
get_language_pack_strings(language_code_, vector<string>(), Auto());
|
||||
}
|
||||
|
||||
LOG(INFO) << "Use language pack \"" << language_pack_ << "\" with language \"" << language_code_ << "\" of version "
|
||||
<< language->version_.load() << " with database \"" << database_->path_ << '"';
|
||||
LOG(INFO) << "Use localization target \"" << language_pack_ << "\" with language pack \"" << language_code_
|
||||
<< "\" of version " << language->version_.load() << " with database \"" << database_->path_ << '"';
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,14 +185,14 @@ void LanguagePackManager::tear_down() {
|
||||
std::lock_guard<std::mutex> lock(language_database_mutex_);
|
||||
manager_count_--;
|
||||
if (manager_count_ == 0) {
|
||||
// can't clear language packs, because the may be accessed later using synchronous requests
|
||||
// can't clear language packs, because they may be accessed later using synchronous requests
|
||||
// LOG(INFO) << "Clear language packs";
|
||||
// language_databases_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void LanguagePackManager::on_language_pack_changed() {
|
||||
auto new_language_pack = G()->shared_config().get_option_string("language_pack");
|
||||
auto new_language_pack = G()->shared_config().get_option_string("localization_target");
|
||||
if (new_language_pack == language_pack_) {
|
||||
return;
|
||||
}
|
||||
@ -203,7 +203,7 @@ void LanguagePackManager::on_language_pack_changed() {
|
||||
}
|
||||
|
||||
void LanguagePackManager::on_language_code_changed() {
|
||||
auto new_language_code = G()->shared_config().get_option_string("language_code");
|
||||
auto new_language_code = G()->shared_config().get_option_string("language_pack_id");
|
||||
if (new_language_code == language_code_) {
|
||||
return;
|
||||
}
|
||||
@ -248,7 +248,7 @@ void LanguagePackManager::on_language_pack_version_changed(int32 new_version) {
|
||||
}
|
||||
|
||||
auto result = r_result.move_as_ok();
|
||||
LOG(INFO) << "Receive language pack difference for language " << result->lang_code_ << " from version "
|
||||
LOG(INFO) << "Receive language pack difference for language pack " << result->lang_code_ << " from version "
|
||||
<< result->from_version_ << " with version " << result->version_ << " of size "
|
||||
<< result->strings_.size();
|
||||
LOG_IF(ERROR, result->lang_code_ != language_code)
|
||||
@ -264,30 +264,31 @@ void LanguagePackManager::on_language_pack_version_changed(int32 new_version) {
|
||||
}
|
||||
|
||||
void LanguagePackManager::on_update_language_pack(tl_object_ptr<telegram_api::langPackDifference> difference) {
|
||||
LOG(INFO) << "Receive update language pack difference for language " << difference->lang_code_ << " from version "
|
||||
<< difference->from_version_ << " with version " << difference->version_ << " of size "
|
||||
LOG(INFO) << "Receive update language pack difference for language pack " << difference->lang_code_
|
||||
<< " from version " << difference->from_version_ << " with version " << difference->version_ << " of size "
|
||||
<< difference->strings_.size();
|
||||
if (language_pack_.empty()) {
|
||||
LOG(WARNING) << "Ignore difference for language " << difference->lang_code_ << ", because language pack was unset";
|
||||
LOG(WARNING) << "Ignore difference for language pack " << difference->lang_code_
|
||||
<< ", because used language pack was unset";
|
||||
return;
|
||||
}
|
||||
if (difference->lang_code_ != language_code_) {
|
||||
LOG(WARNING) << "Ignore difference for language " << difference->lang_code_;
|
||||
LOG(WARNING) << "Ignore difference for language pack " << difference->lang_code_;
|
||||
return;
|
||||
}
|
||||
if (is_custom_language_code(difference->lang_code_) || difference->lang_code_.empty()) {
|
||||
LOG(ERROR) << "Ignore difference for language " << difference->lang_code_;
|
||||
LOG(ERROR) << "Ignore difference for language pack " << difference->lang_code_;
|
||||
return;
|
||||
}
|
||||
|
||||
Language *language = get_language(database_, language_pack_, language_code_);
|
||||
int32 version = language == nullptr ? static_cast<int32>(-1) : language->version_.load();
|
||||
if (difference->version_ <= version) {
|
||||
LOG(INFO) << "Skip applying already applied updates";
|
||||
LOG(INFO) << "Skip applying already applied language pack updates";
|
||||
return;
|
||||
}
|
||||
if (version == -1 || version < difference->from_version_) {
|
||||
LOG(INFO) << "Can't apply difference";
|
||||
LOG(INFO) << "Can't apply language pack difference";
|
||||
return on_language_pack_version_changed(difference->version_);
|
||||
}
|
||||
|
||||
@ -421,17 +422,17 @@ bool LanguagePackManager::load_language_strings(LanguageDatabase *database, Lang
|
||||
std::lock_guard<std::mutex> database_lock(database->mutex_);
|
||||
std::lock_guard<std::mutex> language_lock(language->mutex_);
|
||||
if (language->is_full_) {
|
||||
LOG(DEBUG) << "The language is full in memory";
|
||||
LOG(DEBUG) << "The language pack is already full in memory";
|
||||
return true;
|
||||
}
|
||||
if (language->kv_.empty()) {
|
||||
LOG(DEBUG) << "The language has no database";
|
||||
LOG(DEBUG) << "The language pack has no database";
|
||||
return false;
|
||||
}
|
||||
LOG(DEBUG) << "Begin to load a language from database";
|
||||
LOG(DEBUG) << "Begin to load a language pack from database";
|
||||
if (keys.empty()) {
|
||||
if (language->version_ == -1 && language->was_loaded_full_) {
|
||||
LOG(DEBUG) << "The language has already been loaded";
|
||||
LOG(DEBUG) << "The language pack has already been loaded";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -548,9 +549,9 @@ td_api::object_ptr<td_api::languagePackStrings> LanguagePackManager::get_languag
|
||||
return td_api::make_object<td_api::languagePackStrings>(std::move(strings));
|
||||
}
|
||||
|
||||
void LanguagePackManager::get_languages(Promise<td_api::object_ptr<td_api::languagePack>> promise) {
|
||||
void LanguagePackManager::get_languages(Promise<td_api::object_ptr<td_api::localizationTargetInfo>> promise) {
|
||||
if (language_pack_.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Option \"language_pack\" needs to be set first"));
|
||||
return promise.set_error(Status::Error(400, "Option \"localization_target\" needs to be set first"));
|
||||
}
|
||||
|
||||
auto request_promise = PromiseCreator::lambda([actor_id = actor_id(this), language_pack = language_pack_,
|
||||
@ -569,8 +570,8 @@ void LanguagePackManager::get_languages(Promise<td_api::object_ptr<td_api::langu
|
||||
|
||||
void LanguagePackManager::on_get_languages(vector<tl_object_ptr<telegram_api::langPackLanguage>> languages,
|
||||
string language_pack,
|
||||
Promise<td_api::object_ptr<td_api::languagePack>> promise) {
|
||||
auto results = make_tl_object<td_api::languagePack>();
|
||||
Promise<td_api::object_ptr<td_api::localizationTargetInfo>> promise) {
|
||||
auto results = td_api::make_object<td_api::localizationTargetInfo>();
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> packs_lock(database_->mutex_);
|
||||
@ -578,24 +579,24 @@ void LanguagePackManager::on_get_languages(vector<tl_object_ptr<telegram_api::la
|
||||
if (pack_it != database_->language_packs_.end()) {
|
||||
LanguagePack *pack = pack_it->second.get();
|
||||
for (auto &info : pack->language_infos_) {
|
||||
results->languages_.push_back(
|
||||
make_tl_object<td_api::languageInfo>(info.first, info.second.name, info.second.native_name, 0));
|
||||
results->language_packs_.push_back(
|
||||
make_tl_object<td_api::languagePackInfo>(info.first, info.second.name, info.second.native_name, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &language : languages) {
|
||||
results->languages_.push_back(
|
||||
make_tl_object<td_api::languageInfo>(language->lang_code_, language->name_, language->native_name_, 0));
|
||||
results->language_packs_.push_back(
|
||||
make_tl_object<td_api::languagePackInfo>(language->lang_code_, language->name_, language->native_name_, 0));
|
||||
}
|
||||
|
||||
for (auto &language_info : results->languages_) {
|
||||
if (!check_language_code_name(language_info->code_)) {
|
||||
LOG(ERROR) << "Receive unsupported language code " << language_info->code_ << " from server";
|
||||
for (auto &language_info : results->language_packs_) {
|
||||
if (!check_language_code_name(language_info->id_)) {
|
||||
LOG(ERROR) << "Receive unsupported language pack ID " << language_info->id_ << " from server";
|
||||
continue;
|
||||
}
|
||||
|
||||
auto language = add_language(database_, language_pack, language_info->code_);
|
||||
auto language = add_language(database_, language_pack, language_info->id_);
|
||||
language_info->local_string_count_ = language->key_count_;
|
||||
}
|
||||
|
||||
@ -605,10 +606,10 @@ void LanguagePackManager::on_get_languages(vector<tl_object_ptr<telegram_api::la
|
||||
void LanguagePackManager::get_language_pack_strings(string language_code, vector<string> keys,
|
||||
Promise<td_api::object_ptr<td_api::languagePackStrings>> promise) {
|
||||
if (!check_language_code_name(language_code) || language_code.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Language code is invalid"));
|
||||
return promise.set_error(Status::Error(400, "Language pack ID is invalid"));
|
||||
}
|
||||
if (language_pack_.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Option \"language_pack\" needs to be set first"));
|
||||
return promise.set_error(Status::Error(400, "Option \"localization_target\" needs to be set first"));
|
||||
}
|
||||
for (auto &key : keys) {
|
||||
if (!is_valid_key(key)) {
|
||||
@ -651,12 +652,11 @@ void LanguagePackManager::get_language_pack_strings(string language_code, vector
|
||||
}
|
||||
|
||||
auto result = r_result.move_as_ok();
|
||||
LOG(INFO) << "Receive language pack for language " << result->lang_code_ << " from version "
|
||||
<< result->from_version_ << " with version " << result->version_ << " of size "
|
||||
<< result->strings_.size();
|
||||
LOG(INFO) << "Receive language pack " << result->lang_code_ << " from version " << result->from_version_
|
||||
<< " with version " << result->version_ << " of size " << result->strings_.size();
|
||||
LOG_IF(ERROR, result->lang_code_ != language_code)
|
||||
<< "Receive strings for " << result->lang_code_ << " instead of " << language_code;
|
||||
LOG_IF(ERROR, result->from_version_ != 0) << "Receive lang pack from version " << result->from_version_;
|
||||
LOG_IF(ERROR, result->from_version_ != 0) << "Receive language pack from version " << result->from_version_;
|
||||
send_closure(actor_id, &LanguagePackManager::on_get_language_pack_strings, std::move(language_pack),
|
||||
std::move(language_code), result->version_, false, vector<string>(), std::move(result->strings_),
|
||||
std::move(promise));
|
||||
@ -731,10 +731,10 @@ void LanguagePackManager::on_get_all_language_pack_strings(
|
||||
for (auto &promise : promises) {
|
||||
if (promise) {
|
||||
if (left_non_empty_promise_count == 1) {
|
||||
LOG(INFO) << "Set last non-empty promise";
|
||||
LOG(DEBUG) << "Set last non-empty promise";
|
||||
promise.set_value(std::move(strings));
|
||||
} else {
|
||||
LOG(INFO) << "Set non-empty promise";
|
||||
LOG(DEBUG) << "Set non-empty promise";
|
||||
vector<td_api::object_ptr<td_api::languagePackString>> strings_copy;
|
||||
for (auto &result : strings->strings_) {
|
||||
CHECK(result != nullptr);
|
||||
@ -745,7 +745,7 @@ void LanguagePackManager::on_get_all_language_pack_strings(
|
||||
}
|
||||
left_non_empty_promise_count--;
|
||||
} else {
|
||||
LOG(INFO) << "Set empty promise";
|
||||
LOG(DEBUG) << "Set empty promise";
|
||||
promise.set_value(nullptr);
|
||||
}
|
||||
}
|
||||
@ -757,10 +757,10 @@ td_api::object_ptr<td_api::Object> LanguagePackManager::get_language_pack_string
|
||||
const string &language_code,
|
||||
const string &key) {
|
||||
if (!check_language_pack_name(language_pack) || language_pack.empty()) {
|
||||
return td_api::make_object<td_api::error>(400, "Language pack is invalid");
|
||||
return td_api::make_object<td_api::error>(400, "Localization target is invalid");
|
||||
}
|
||||
if (!check_language_code_name(language_code) || language_code.empty()) {
|
||||
return td_api::make_object<td_api::error>(400, "Language code is invalid");
|
||||
return td_api::make_object<td_api::error>(400, "Language pack ID is invalid");
|
||||
}
|
||||
if (!is_valid_key(key)) {
|
||||
return td_api::make_object<td_api::error>(400, "Key is invalid");
|
||||
@ -795,7 +795,7 @@ bool LanguagePackManager::is_valid_key(Slice key) {
|
||||
|
||||
void LanguagePackManager::save_strings_to_database(SqliteKeyValue *kv, int32 new_version, bool new_is_full,
|
||||
int32 new_key_count, vector<std::pair<string, string>> strings) {
|
||||
LOG(DEBUG) << "Save to database a language with new version " << new_version << " and " << strings.size()
|
||||
LOG(DEBUG) << "Save to database a language pack with new version " << new_version << " and " << strings.size()
|
||||
<< " new strings";
|
||||
if (new_version == -1 && strings.empty()) {
|
||||
return;
|
||||
@ -809,7 +809,7 @@ void LanguagePackManager::save_strings_to_database(SqliteKeyValue *kv, int32 new
|
||||
}
|
||||
auto old_version = load_database_language_version(kv);
|
||||
if (old_version > new_version || (old_version == new_version && strings.empty())) {
|
||||
LOG(DEBUG) << "Language version doesn't increased from " << old_version;
|
||||
LOG(DEBUG) << "Language pack version doesn't increased from " << old_version;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -825,14 +825,14 @@ void LanguagePackManager::save_strings_to_database(SqliteKeyValue *kv, int32 new
|
||||
} else {
|
||||
kv->set(str.first, str.second);
|
||||
}
|
||||
LOG(DEBUG) << "Save language string with key " << str.first << " to database";
|
||||
LOG(DEBUG) << "Save language pack string with key " << str.first << " to database";
|
||||
}
|
||||
if (old_version != new_version) {
|
||||
LOG(DEBUG) << "Set language version in database to " << new_version;
|
||||
LOG(DEBUG) << "Set language pack version in database to " << new_version;
|
||||
kv->set("!version", to_string(new_version));
|
||||
}
|
||||
if (new_key_count != -1) {
|
||||
LOG(DEBUG) << "Set language key count in database to " << new_key_count;
|
||||
LOG(DEBUG) << "Set language pack key count in database to " << new_key_count;
|
||||
kv->set("!key_count", to_string(new_key_count));
|
||||
}
|
||||
kv->commit_transaction().ensure();
|
||||
@ -860,7 +860,7 @@ void LanguagePackManager::on_get_language_pack_strings(
|
||||
if (language->version_ < version || !keys.empty()) {
|
||||
vector<td_api::object_ptr<td_api::languagePackString>> strings;
|
||||
if (language->version_ < version && !(is_diff && language->version_ == -1)) {
|
||||
LOG(INFO) << "Set language " << language_code << " version to " << version;
|
||||
LOG(INFO) << "Set language pack " << language_code << " version to " << version;
|
||||
language->version_ = version;
|
||||
new_database_version = version;
|
||||
is_version_changed = true;
|
||||
@ -996,7 +996,7 @@ void LanguagePackManager::on_failed_get_difference(string language_pack, string
|
||||
Result<tl_object_ptr<telegram_api::LangPackString>> LanguagePackManager::convert_to_telegram_api(
|
||||
tl_object_ptr<td_api::languagePackString> &&str) {
|
||||
if (str == nullptr) {
|
||||
return Status::Error(400, "Language strings must not be null");
|
||||
return Status::Error(400, "Language pack strings must not be null");
|
||||
}
|
||||
|
||||
string key = std::move(str->key_);
|
||||
@ -1011,7 +1011,7 @@ Result<tl_object_ptr<telegram_api::LangPackString>> LanguagePackManager::convert
|
||||
case td_api::languagePackStringValueOrdinary::ID: {
|
||||
auto value = static_cast<td_api::languagePackStringValueOrdinary *>(str->value_.get());
|
||||
if (!clean_input_string(value->value_)) {
|
||||
return Status::Error(400, "Strings must be encoded in UTF-8");
|
||||
return Status::Error(400, "Language pack string value must be encoded in UTF-8");
|
||||
}
|
||||
return make_tl_object<telegram_api::langPackString>(std::move(key), std::move(value->value_));
|
||||
}
|
||||
@ -1020,7 +1020,7 @@ Result<tl_object_ptr<telegram_api::LangPackString>> LanguagePackManager::convert
|
||||
if (!clean_input_string(value->zero_value_) || !clean_input_string(value->one_value_) ||
|
||||
!clean_input_string(value->two_value_) || !clean_input_string(value->few_value_) ||
|
||||
!clean_input_string(value->many_value_) || !clean_input_string(value->other_value_)) {
|
||||
return Status::Error(400, "Strings must be encoded in UTF-8");
|
||||
return Status::Error(400, "Language pack string value must be encoded in UTF-8");
|
||||
}
|
||||
return make_tl_object<telegram_api::langPackStringPluralized>(
|
||||
31, std::move(key), std::move(value->zero_value_), std::move(value->one_value_), std::move(value->two_value_),
|
||||
@ -1039,13 +1039,13 @@ void LanguagePackManager::set_custom_language(string language_code, string langu
|
||||
vector<tl_object_ptr<td_api::languagePackString>> strings,
|
||||
Promise<Unit> &&promise) {
|
||||
if (language_pack_.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Option \"language_pack\" needs to be set first"));
|
||||
return promise.set_error(Status::Error(400, "Option \"localization_target\" needs to be set first"));
|
||||
}
|
||||
if (!check_language_code_name(language_code)) {
|
||||
return promise.set_error(Status::Error(400, "Language code name must contain only letters and hyphen"));
|
||||
return promise.set_error(Status::Error(400, "Language pack ID must contain only letters, digits and hyphen"));
|
||||
}
|
||||
if (!is_custom_language_code(language_code)) {
|
||||
return promise.set_error(Status::Error(400, "Custom language code must begin with 'X'"));
|
||||
return promise.set_error(Status::Error(400, "Custom language pack ID must begin with 'X'"));
|
||||
}
|
||||
|
||||
vector<tl_object_ptr<telegram_api::LangPackString>> server_strings;
|
||||
@ -1078,13 +1078,13 @@ void LanguagePackManager::set_custom_language(string language_code, string langu
|
||||
void LanguagePackManager::edit_custom_language_info(string language_code, string language_name,
|
||||
string language_native_name, Promise<Unit> &&promise) {
|
||||
if (language_pack_.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Option \"language_pack\" needs to be set first"));
|
||||
return promise.set_error(Status::Error(400, "Option \"localization_target\" needs to be set first"));
|
||||
}
|
||||
if (!check_language_code_name(language_code)) {
|
||||
return promise.set_error(Status::Error(400, "Language code name must contain only letters and hyphen"));
|
||||
return promise.set_error(Status::Error(400, "Language pack ID must contain only letters, digits and hyphen"));
|
||||
}
|
||||
if (!is_custom_language_code(language_code)) {
|
||||
return promise.set_error(Status::Error(400, "Custom language code must begin with 'X'"));
|
||||
return promise.set_error(Status::Error(400, "Custom language pack ID must begin with 'X'"));
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> packs_lock(database_->mutex_);
|
||||
@ -1109,20 +1109,20 @@ void LanguagePackManager::set_custom_language_string(string language_code,
|
||||
tl_object_ptr<td_api::languagePackString> str,
|
||||
Promise<Unit> &&promise) {
|
||||
if (language_pack_.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Option \"language_pack\" needs to be set first"));
|
||||
return promise.set_error(Status::Error(400, "Option \"localization_target\" needs to be set first"));
|
||||
}
|
||||
if (!check_language_code_name(language_code)) {
|
||||
return promise.set_error(Status::Error(400, "Language code name must contain only letters and hyphen"));
|
||||
return promise.set_error(Status::Error(400, "Language pack ID must contain only letters, digits and hyphen"));
|
||||
}
|
||||
if (!is_custom_language_code(language_code)) {
|
||||
return promise.set_error(Status::Error(400, "Custom language code must begin with 'X'"));
|
||||
return promise.set_error(Status::Error(400, "Custom language pack ID must begin with 'X'"));
|
||||
}
|
||||
|
||||
if (get_language(database_, language_pack_, language_code) == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Custom language not found"));
|
||||
return promise.set_error(Status::Error(400, "Custom language pack not found"));
|
||||
}
|
||||
if (str == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Language strings must not be null"));
|
||||
return promise.set_error(Status::Error(400, "Language pack strings must not be null"));
|
||||
}
|
||||
|
||||
vector<string> keys{str->key_};
|
||||
@ -1142,16 +1142,16 @@ void LanguagePackManager::set_custom_language_string(string language_code,
|
||||
|
||||
void LanguagePackManager::delete_language(string language_code, Promise<Unit> &&promise) {
|
||||
if (language_pack_.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Option \"language_pack\" needs to be set first"));
|
||||
return promise.set_error(Status::Error(400, "Option \"localization_target\" needs to be set first"));
|
||||
}
|
||||
if (!check_language_code_name(language_code)) {
|
||||
return promise.set_error(Status::Error(400, "Language code name is invalid"));
|
||||
return promise.set_error(Status::Error(400, "Language pack ID is invalid"));
|
||||
}
|
||||
if (language_code.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Language code name is empty"));
|
||||
return promise.set_error(Status::Error(400, "Language pack ID is empty"));
|
||||
}
|
||||
if (language_code_ == language_code) {
|
||||
return promise.set_error(Status::Error(400, "Currently used language can't be deleted"));
|
||||
return promise.set_error(Status::Error(400, "Currently used language pack can't be deleted"));
|
||||
}
|
||||
|
||||
auto status = do_delete_language(language_code);
|
||||
@ -1175,7 +1175,7 @@ Status LanguagePackManager::do_delete_language(string language_code) {
|
||||
CHECK(code_it != pack->languages_.end());
|
||||
auto language = code_it->second.get();
|
||||
if (language->has_get_difference_query_) {
|
||||
return Status::Error(400, "Language can't be deleted now, try again later");
|
||||
return Status::Error(400, "Language pack can't be deleted now, try again later");
|
||||
}
|
||||
if (!language->kv_.empty()) {
|
||||
language->kv_.drop().ignore();
|
||||
|
@ -48,7 +48,7 @@ class LanguagePackManager : public NetQueryCallback {
|
||||
|
||||
void on_language_pack_version_changed(int32 new_version);
|
||||
|
||||
void get_languages(Promise<td_api::object_ptr<td_api::languagePack>> promise);
|
||||
void get_languages(Promise<td_api::object_ptr<td_api::localizationTargetInfo>> promise);
|
||||
|
||||
void get_language_pack_strings(string language_code, vector<string> keys,
|
||||
Promise<td_api::object_ptr<td_api::languagePackStrings>> promise);
|
||||
@ -147,7 +147,7 @@ class LanguagePackManager : public NetQueryCallback {
|
||||
void on_failed_get_difference(string language_pack, string language_code);
|
||||
|
||||
void on_get_languages(vector<tl_object_ptr<telegram_api::langPackLanguage>> languages, string language_pack,
|
||||
Promise<td_api::object_ptr<td_api::languagePack>> promise);
|
||||
Promise<td_api::object_ptr<td_api::localizationTargetInfo>> promise);
|
||||
|
||||
Status do_delete_language(string language_code);
|
||||
|
||||
|
@ -3265,12 +3265,12 @@ bool Td::is_preinitialization_request(int32 id) {
|
||||
bool Td::is_preauthentication_request(int32 id) {
|
||||
switch (id) {
|
||||
case td_api::processDcUpdate::ID:
|
||||
case td_api::getLanguagePackInfo::ID:
|
||||
case td_api::getLocalizationTargetInfo::ID:
|
||||
case td_api::getLanguagePackStrings::ID:
|
||||
case td_api::setCustomLanguage::ID:
|
||||
case td_api::editCustomLanguageInfo::ID:
|
||||
case td_api::setCustomLanguageString::ID:
|
||||
case td_api::deleteLanguage::ID:
|
||||
case td_api::setCustomLanguagePack::ID:
|
||||
case td_api::editCustomLanguagePackInfo::ID:
|
||||
case td_api::setCustomLanguagePackString::ID:
|
||||
case td_api::deleteLanguagePack::ID:
|
||||
case td_api::getOption::ID:
|
||||
case td_api::setOption::ID:
|
||||
case td_api::setNetworkType::ID:
|
||||
@ -3541,12 +3541,12 @@ void Td::on_config_option_updated(const string &name) {
|
||||
if (G()->mtproto_header().set_is_emulator(G()->shared_config().get_option_boolean(name))) {
|
||||
G()->net_query_dispatcher().update_mtproto_header();
|
||||
}
|
||||
} else if (name == "language_pack") {
|
||||
} else if (name == "localization_target") {
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::on_language_pack_changed);
|
||||
if (G()->mtproto_header().set_language_pack(G()->shared_config().get_option_string(name))) {
|
||||
G()->net_query_dispatcher().update_mtproto_header();
|
||||
}
|
||||
} else if (name == "language_code") {
|
||||
} else if (name == "language_pack_id") {
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::on_language_code_changed);
|
||||
if (G()->mtproto_header().set_language_code(G()->shared_config().get_option_string(name))) {
|
||||
G()->net_query_dispatcher().update_mtproto_header();
|
||||
@ -4020,6 +4020,21 @@ Status Td::init(DbKey key) {
|
||||
config_manager_ = create_actor<ConfigManager>("ConfigManager", create_reference());
|
||||
G()->set_config_manager(config_manager_.get());
|
||||
|
||||
if (G()->shared_config().have_option("language_database_path")) {
|
||||
G()->shared_config().set_option_string("language_pack_database_path",
|
||||
G()->shared_config().get_option_string("language_database_path"));
|
||||
G()->shared_config().set_option_empty("language_database_path");
|
||||
}
|
||||
if (G()->shared_config().have_option("language_pack")) {
|
||||
G()->shared_config().set_option_string("localization_target",
|
||||
G()->shared_config().get_option_string("language_pack"));
|
||||
G()->shared_config().set_option_empty("language_pack");
|
||||
}
|
||||
if (G()->shared_config().have_option("language_code")) {
|
||||
G()->shared_config().set_option_string("language_pack_id", G()->shared_config().get_option_string("language_code"));
|
||||
G()->shared_config().set_option_empty("language_code");
|
||||
}
|
||||
|
||||
complete_pending_preauthentication_requests([](int32 id) {
|
||||
switch (id) {
|
||||
case td_api::getOption::ID:
|
||||
@ -4030,8 +4045,8 @@ Status Td::init(DbKey key) {
|
||||
}
|
||||
});
|
||||
|
||||
options_.language_pack = G()->shared_config().get_option_string("language_pack");
|
||||
options_.language_code = G()->shared_config().get_option_string("language_code");
|
||||
options_.language_pack = G()->shared_config().get_option_string("localization_target");
|
||||
options_.language_code = G()->shared_config().get_option_string("language_pack_id");
|
||||
options_.is_emulator = G()->shared_config().get_option_boolean("is_emulator");
|
||||
// options_.proxy = Proxy();
|
||||
G()->set_mtproto_header(std::make_unique<MtprotoHeader>(options_));
|
||||
@ -6024,7 +6039,7 @@ void Td::on_request(uint64 id, const td_api::getMapThumbnailFile &request) {
|
||||
}
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getLanguagePackInfo &request) {
|
||||
void Td::on_request(uint64 id, const td_api::getLocalizationTargetInfo &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::get_languages, std::move(promise));
|
||||
@ -6032,55 +6047,55 @@ void Td::on_request(uint64 id, const td_api::getLanguagePackInfo &request) {
|
||||
|
||||
void Td::on_request(uint64 id, td_api::getLanguagePackStrings &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.language_code_);
|
||||
CLEAN_INPUT_STRING(request.language_pack_id_);
|
||||
for (auto &key : request.keys_) {
|
||||
CLEAN_INPUT_STRING(key);
|
||||
}
|
||||
CREATE_REQUEST_PROMISE();
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::get_language_pack_strings,
|
||||
std::move(request.language_code_), std::move(request.keys_), std::move(promise));
|
||||
std::move(request.language_pack_id_), std::move(request.keys_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::setCustomLanguage &request) {
|
||||
void Td::on_request(uint64 id, td_api::setCustomLanguagePack &request) {
|
||||
CHECK_IS_USER();
|
||||
if (request.info_ == nullptr) {
|
||||
return send_error_raw(id, 400, "Language info must not be empty");
|
||||
return send_error_raw(id, 400, "Language pack info must not be empty");
|
||||
}
|
||||
CLEAN_INPUT_STRING(request.info_->code_);
|
||||
CLEAN_INPUT_STRING(request.info_->id_);
|
||||
CLEAN_INPUT_STRING(request.info_->name_);
|
||||
CLEAN_INPUT_STRING(request.info_->native_name_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::set_custom_language, std::move(request.info_->code_),
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::set_custom_language, std::move(request.info_->id_),
|
||||
std::move(request.info_->name_), std::move(request.info_->native_name_), std::move(request.strings_),
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::editCustomLanguageInfo &request) {
|
||||
void Td::on_request(uint64 id, td_api::editCustomLanguagePackInfo &request) {
|
||||
CHECK_IS_USER();
|
||||
if (request.info_ == nullptr) {
|
||||
return send_error_raw(id, 400, "Language info must not be empty");
|
||||
return send_error_raw(id, 400, "Language pack info must not be empty");
|
||||
}
|
||||
CLEAN_INPUT_STRING(request.info_->code_);
|
||||
CLEAN_INPUT_STRING(request.info_->id_);
|
||||
CLEAN_INPUT_STRING(request.info_->name_);
|
||||
CLEAN_INPUT_STRING(request.info_->native_name_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::edit_custom_language_info, std::move(request.info_->code_),
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::edit_custom_language_info, std::move(request.info_->id_),
|
||||
std::move(request.info_->name_), std::move(request.info_->native_name_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::setCustomLanguageString &request) {
|
||||
void Td::on_request(uint64 id, td_api::setCustomLanguagePackString &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.language_code_);
|
||||
CLEAN_INPUT_STRING(request.language_pack_id_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::set_custom_language_string,
|
||||
std::move(request.language_code_), std::move(request.new_string_), std::move(promise));
|
||||
std::move(request.language_pack_id_), std::move(request.new_string_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::deleteLanguage &request) {
|
||||
void Td::on_request(uint64 id, td_api::deleteLanguagePack &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.language_code_);
|
||||
CLEAN_INPUT_STRING(request.language_pack_id_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::delete_language, std::move(request.language_code_),
|
||||
send_closure(language_pack_manager_, &LanguagePackManager::delete_language, std::move(request.language_pack_id_),
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
@ -6200,13 +6215,13 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if (set_string_option("language_database_path", [](Slice value) { return true; })) {
|
||||
if (set_string_option("language_pack_database_path", [](Slice value) { return true; })) {
|
||||
return;
|
||||
}
|
||||
if (set_string_option("language_pack", LanguagePackManager::check_language_pack_name)) {
|
||||
if (set_string_option("localization_target", LanguagePackManager::check_language_pack_name)) {
|
||||
return;
|
||||
}
|
||||
if (set_string_option("language_code", LanguagePackManager::check_language_code_name)) {
|
||||
if (set_string_option("language_pack_id", LanguagePackManager::check_language_code_name)) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -6778,8 +6793,8 @@ td_api::object_ptr<td_api::Object> Td::do_static_request(const td_api::cleanFile
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::Object> Td::do_static_request(const td_api::getLanguagePackString &request) {
|
||||
return LanguagePackManager::get_language_pack_string(request.language_database_path_, request.language_pack_,
|
||||
request.language_code_, request.key_);
|
||||
return LanguagePackManager::get_language_pack_string(
|
||||
request.language_pack_database_path_, request.localization_target_, request.language_pack_id_, request.key_);
|
||||
}
|
||||
|
||||
// test
|
||||
|
@ -763,17 +763,17 @@ class Td final : public NetQueryCallback {
|
||||
|
||||
void on_request(uint64 id, const td_api::getMapThumbnailFile &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::getLanguagePackInfo &request);
|
||||
void on_request(uint64 id, const td_api::getLocalizationTargetInfo &request);
|
||||
|
||||
void on_request(uint64 id, td_api::getLanguagePackStrings &request);
|
||||
|
||||
void on_request(uint64 id, td_api::setCustomLanguage &request);
|
||||
void on_request(uint64 id, td_api::setCustomLanguagePack &request);
|
||||
|
||||
void on_request(uint64 id, td_api::editCustomLanguageInfo &request);
|
||||
void on_request(uint64 id, td_api::editCustomLanguagePackInfo &request);
|
||||
|
||||
void on_request(uint64 id, td_api::setCustomLanguageString &request);
|
||||
void on_request(uint64 id, td_api::setCustomLanguagePackString &request);
|
||||
|
||||
void on_request(uint64 id, td_api::deleteLanguage &request);
|
||||
void on_request(uint64 id, td_api::deleteLanguagePack &request);
|
||||
|
||||
void on_request(uint64 id, td_api::getOption &request);
|
||||
|
||||
|
@ -1750,8 +1750,8 @@ class CliClient final : public Actor {
|
||||
|
||||
std::tie(chat_id, message_id) = split(args);
|
||||
send_request(make_tl_object<td_api::deleteChatReplyMarkup>(as_chat_id(chat_id), as_message_id(message_id)));
|
||||
} else if (op == "glpi") {
|
||||
send_request(make_tl_object<td_api::getLanguagePackInfo>());
|
||||
} else if (op == "glti") {
|
||||
send_request(make_tl_object<td_api::getLocalizationTargetInfo>());
|
||||
} else if (op == "glps") {
|
||||
string language_code;
|
||||
string keys;
|
||||
@ -1769,7 +1769,7 @@ class CliClient final : public Actor {
|
||||
std::tie(language_code, key) = split(args);
|
||||
send_request(
|
||||
make_tl_object<td_api::getLanguagePackString>(language_database_path, language_pack, language_code, key));
|
||||
} else if (op == "scl") {
|
||||
} else if (op == "sclp") {
|
||||
string language_code;
|
||||
string name;
|
||||
string native_name;
|
||||
@ -1788,9 +1788,9 @@ class CliClient final : public Actor {
|
||||
strings.push_back(make_tl_object<td_api::languagePackString>(
|
||||
"DELETED", make_tl_object<td_api::languagePackStringValueDeleted>()));
|
||||
|
||||
send_request(make_tl_object<td_api::setCustomLanguage>(
|
||||
make_tl_object<td_api::languageInfo>(language_code, name, native_name, 3), std::move(strings)));
|
||||
} else if (op == "ecli") {
|
||||
send_request(make_tl_object<td_api::setCustomLanguagePack>(
|
||||
make_tl_object<td_api::languagePackInfo>(language_code, name, native_name, 3), std::move(strings)));
|
||||
} else if (op == "eclpi") {
|
||||
string language_code;
|
||||
string name;
|
||||
string native_name;
|
||||
@ -1798,9 +1798,9 @@ class CliClient final : public Actor {
|
||||
std::tie(language_code, args) = split(args);
|
||||
std::tie(name, native_name) = split(args);
|
||||
|
||||
send_request(make_tl_object<td_api::editCustomLanguageInfo>(
|
||||
make_tl_object<td_api::languageInfo>(language_code, name, native_name, 3)));
|
||||
} else if (op == "sclsv" || op == "sclsp" || op == "sclsd") {
|
||||
send_request(make_tl_object<td_api::editCustomLanguagePackInfo>(
|
||||
make_tl_object<td_api::languagePackInfo>(language_code, name, native_name, 3)));
|
||||
} else if (op == "sclpsv" || op == "sclpsp" || op == "sclpsd") {
|
||||
string language_code;
|
||||
string key;
|
||||
string value;
|
||||
@ -1818,9 +1818,9 @@ class CliClient final : public Actor {
|
||||
str->value_ = make_tl_object<td_api::languagePackStringValueDeleted>();
|
||||
}
|
||||
|
||||
send_request(make_tl_object<td_api::setCustomLanguageString>(language_code, std::move(str)));
|
||||
} else if (op == "dl") {
|
||||
send_request(make_tl_object<td_api::deleteLanguage>(args));
|
||||
send_request(make_tl_object<td_api::setCustomLanguagePackString>(language_code, std::move(str)));
|
||||
} else if (op == "dlp") {
|
||||
send_request(make_tl_object<td_api::deleteLanguagePack>(args));
|
||||
} else if (op == "go") {
|
||||
send_request(make_tl_object<td_api::getOption>(args));
|
||||
} else if (op == "sob") {
|
||||
|
Loading…
Reference in New Issue
Block a user