• chromium 语言栏


    因为语言栏的,我们只打算保留中英日

    所以对于参数--lang

    我们也需要做处理

    找到处理的位置

    对其进行处理

    C:feikuachromiumsrcasei18n tl.cc

    void SetICUDefaultLocale(const std::string& locale_string) {
    #if defined(OS_IOS)
      static base::debug::CrashKeyString* crash_key_locale =
          base::debug::AllocateCrashKeyString("icu_locale_input",
                                              base::debug::CrashKeySize::Size256);
      base::debug::SetCrashKeyString(crash_key_locale, locale_string);
    #endif
      icu::Locale locale(ICULocaleName(locale_string).c_str());
      UErrorCode error_code = U_ZERO_ERROR;
      const char* lang = locale.getLanguage();
      if (lang != nullptr && *lang != '' && CheckLang(lang)) {
        icu::Locale::setDefault(locale, error_code);
      } else {
        LOG(ERROR) << "Failed to set the ICU default locale to " << locale_string
                   << ". Falling back to en-US.";
        icu::Locale::setDefault(icu::Locale::getUS(), error_code);
      }
      g_icu_text_direction = UNKNOWN_DIRECTION;
    }
    
    bool CheckLang(const char* lang){
      if (!std::strcmp("ja",lang))
          return true;
      if (!std::strcmp("zh", lang))
          return true;
      if (!std::strcmp("en", lang))
        return true; 
      return false;
    }

    c:feikuachromiumsrcasei18n tl.h

    BASE_I18N_EXPORT bool CheckLang(const char* lang);

    但是一直会出现

    "Only clang-cl is supported on Windows, see https://crbug.com/988071"  

    这是因为对VC++编译器的支持已经被删除,在这种情况下,在构建Chromium时,需要按照这个步骤

    gn args outDefault

    在该文件中指定is_clang布尔值true并保存:

    is_clang=true

    然后!

    比如参数指定JA

     

    又或者指定其他的比如nl什么的,会默认成en-US

    完事了,对于参数

    但是.......添加语言栏那边

    本打算处理中间位置

    也完事了

    发现,处理这个东西,还是得源头处理

    一顿找

    找到一个敏感词

    kAcceptLanguageList

    有戏,一顿注释.........

    所以前面都是为了啥

  • 相关阅读:
    python学习之路基础篇(第八篇)
    python学习之路基础篇(第七篇)
    python学习之路基础篇(第六篇)
    python学习之路基础篇(第五篇)
    python学习之路基础篇(第四篇)
    目标检测——IoU 计算
    MXNet 中的 hybird_forward 的一个使用技巧
    Anchor 的两种编程实现
    我的目标检测笔记
    动手创建 SSD 目标检测框架
  • 原文地址:https://www.cnblogs.com/Galesaur-wcy/p/14837351.html
Copyright © 2020-2023  润新知