chromium/components/translate/core/browser/translate_language_list.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/translate/core/browser/translate_language_list.h"

#include <stddef.h>

#include <iterator>
#include <optional>
#include <string_view>

#include "base/check.h"
#include "base/debug/dump_without_crashing.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/lazy_instance.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "components/language/core/browser/accept_languages_service.h"
#include "components/language/core/common/locale_util.h"
#include "components/translate/core/browser/translate_browser_metrics.h"
#include "components/translate/core/browser/translate_download_manager.h"
#include "components/translate/core/browser/translate_event_details.h"
#include "components/translate/core/browser/translate_url_fetcher.h"
#include "components/translate/core/browser/translate_url_util.h"
#include "components/translate/core/common/translate_util.h"
#include "net/base/url_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"

namespace translate {

namespace {

// The default list of languages the Google translation server supports.
// We use this list until we receive the list that the server exposes.
// This list must be sorted in alphabetical order and contain no duplicates.
const char* const kDefaultSupportedLanguages[] =;

// The default list of languages the Partial Translation service supports.
// This list must be sorted in alphabetical order and contain no duplicates.
// This list is identical to above except that it excludes
// {ilo lus mni-Mtei gom doi bm ckb}.
const char* const kDefaultSupportedPartialTranslateLanguages[] =;

// Constant URL string to fetch server supporting language list.
const char kLanguageListFetchPath[] =;

// Represent if the language list updater is disabled.
bool update_is_disabled =;

// Retry parameter for fetching.
const int kMaxRetryOn5xx =;

}  // namespace

const char TranslateLanguageList::kTargetLanguagesKey[] =;

TranslateLanguageList::TranslateLanguageList()
    :{}

TranslateLanguageList::~TranslateLanguageList() {}

void TranslateLanguageList::GetSupportedLanguages(
    bool translate_allowed,
    std::vector<std::string>* languages) {}

// static
void TranslateLanguageList::GetSupportedPartialTranslateLanguages(
    std::vector<std::string>* languages) {}

std::string TranslateLanguageList::GetLanguageCode(std::string_view language) {}

bool TranslateLanguageList::IsSupportedLanguage(std::string_view language) {}

// static
bool TranslateLanguageList::IsSupportedPartialTranslateLanguage(
    std::string_view language) {}

// static
GURL TranslateLanguageList::TranslateLanguageUrl() {}

void TranslateLanguageList::RequestLanguageList() {}

void TranslateLanguageList::SetResourceRequestsAllowed(bool allowed) {}

base::CallbackListSubscription TranslateLanguageList::RegisterEventCallback(
    const EventCallback& callback) {}

bool TranslateLanguageList::HasOngoingLanguageListLoadingForTesting() {}

GURL TranslateLanguageList::LanguageFetchURLForTesting() {}

// static
void TranslateLanguageList::DisableUpdate() {}

void TranslateLanguageList::OnLanguageListFetchComplete(
    bool success,
    const std::string& data) {}

void TranslateLanguageList::NotifyEvent(int line, std::string message) {}

bool TranslateLanguageList::SetSupportedLanguages(
    std::string_view language_list) {}

}  // namespace translate