From fe175d21e8db10f5de5c06fc3ae68788009581f1 Mon Sep 17 00:00:00 2001 From: lilyhoughton Date: Fri, 3 Mar 2017 12:29:19 -0800 Subject: [PATCH] [cronet] Make getAcceptLanguages index a static table instead of the application bundle. First steps to try and decrease initialization time by putting acceptLanguages into a static table. BUG=655689 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_cronet_tester Review-Url: https://codereview.chromium.org/2665703002 Cr-Commit-Position: refs/heads/master@{#454660} --- components/cronet/ios/BUILD.gn | 78 +++---------------- components/cronet/ios/Cronet.h | 4 + components/cronet/ios/Cronet.mm | 44 +++++++---- .../Localization/am.lproj/Localizable.strings | 2 - .../Localization/ar.lproj/Localizable.strings | 2 - .../Localization/bg.lproj/Localizable.strings | 2 - .../Localization/bn.lproj/Localizable.strings | 2 - .../Localization/ca.lproj/Localizable.strings | 2 - .../Localization/cs.lproj/Localizable.strings | 2 - .../Localization/da.lproj/Localizable.strings | 2 - .../Localization/de.lproj/Localizable.strings | 2 - .../Localization/el.lproj/Localizable.strings | 2 - .../en-GB.lproj/Localizable.strings | 2 - .../Localization/en.lproj/Localizable.strings | 2 - .../es-419.lproj/Localizable.strings | 2 - .../Localization/es.lproj/Localizable.strings | 2 - .../Localization/et.lproj/Localizable.strings | 2 - .../Localization/fa.lproj/Localizable.strings | 2 - .../Localization/fi.lproj/Localizable.strings | 2 - .../fil.lproj/Localizable.strings | 2 - .../Localization/fr.lproj/Localizable.strings | 2 - .../Localization/gu.lproj/Localizable.strings | 2 - .../Localization/he.lproj/Localizable.strings | 2 - .../Localization/hi.lproj/Localizable.strings | 2 - .../Localization/hr.lproj/Localizable.strings | 2 - .../Localization/hu.lproj/Localizable.strings | 2 - .../Localization/id.lproj/Localizable.strings | 2 - .../Localization/it.lproj/Localizable.strings | 2 - .../Localization/ja.lproj/Localizable.strings | 2 - .../Localization/kn.lproj/Localizable.strings | 2 - .../Localization/ko.lproj/Localizable.strings | 2 - .../Localization/lt.lproj/Localizable.strings | 2 - .../Localization/lv.lproj/Localizable.strings | 2 - .../Localization/ml.lproj/Localizable.strings | 2 - .../Localization/mr.lproj/Localizable.strings | 2 - .../Localization/ms.lproj/Localizable.strings | 2 - .../Localization/nb.lproj/Localizable.strings | 2 - .../Localization/nl.lproj/Localizable.strings | 2 - .../Localization/pl.lproj/Localizable.strings | 2 - .../pt-BR.lproj/Localizable.strings | 2 - .../pt-PT.lproj/Localizable.strings | 2 - .../Localization/pt.lproj/Localizable.strings | 2 - .../Localization/ro.lproj/Localizable.strings | 2 - .../Localization/ru.lproj/Localizable.strings | 2 - .../Localization/sk.lproj/Localizable.strings | 2 - .../Localization/sl.lproj/Localizable.strings | 2 - .../Localization/sr.lproj/Localizable.strings | 2 - .../Localization/sv.lproj/Localizable.strings | 2 - .../Localization/sw.lproj/Localizable.strings | 2 - .../Localization/ta.lproj/Localizable.strings | 2 - .../Localization/te.lproj/Localizable.strings | 2 - .../Localization/th.lproj/Localizable.strings | 2 - .../Localization/tr.lproj/Localizable.strings | 2 - .../Localization/uk.lproj/Localizable.strings | 2 - .../Localization/vi.lproj/Localizable.strings | 2 - .../zh-Hans.lproj/Localizable.strings | 2 - .../zh-Hant.lproj/Localizable.strings | 2 - .../Localization/zh.lproj/Localizable.strings | 2 - components/cronet/ios/Resources/README | 9 --- components/cronet/ios/test/BUILD.gn | 1 + .../cronet/ios/test/cronet_acceptlang_test.mm | 57 ++++++++++++++ components/cronet/ios/test/start_cronet.mm | 1 + .../cronet/tools/generate_accept_languages.py | 45 +++++++++++ 63 files changed, 150 insertions(+), 199 deletions(-) delete mode 100644 components/cronet/ios/Resources/Localization/am.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/ar.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/bg.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/bn.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/ca.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/cs.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/da.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/de.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/el.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/en-GB.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/en.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/es-419.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/es.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/et.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/fa.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/fi.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/fil.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/fr.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/gu.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/he.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/hi.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/hr.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/hu.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/id.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/it.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/ja.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/kn.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/ko.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/lt.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/lv.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/ml.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/mr.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/ms.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/nb.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/nl.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/pl.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/pt-BR.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/pt-PT.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/pt.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/ro.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/ru.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/sk.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/sl.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/sr.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/sv.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/sw.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/ta.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/te.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/th.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/tr.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/uk.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/vi.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/zh-Hans.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/zh-Hant.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/Localization/zh.lproj/Localizable.strings delete mode 100644 components/cronet/ios/Resources/README create mode 100644 components/cronet/ios/test/cronet_acceptlang_test.mm create mode 100644 components/cronet/tools/generate_accept_languages.py diff --git a/components/cronet/ios/BUILD.gn b/components/cronet/ios/BUILD.gn index e455f652bc5715..ac1dfe06202987 100644 --- a/components/cronet/ios/BUILD.gn +++ b/components/cronet/ios/BUILD.gn @@ -33,6 +33,7 @@ process_version("cronet_version_header") { source_set("cronet_sources") { deps = [ ":cronet_version_header", + ":generate_accept_languages", "//base:base", "//components/grpc_support", "//components/metrics:metrics", @@ -70,77 +71,11 @@ tweak_info_plist("tweak_cronet_plist") { info_plist = "Info.plist" } -bundle_data("cronet_framework_resources") { - # This bundle contains "Accept-Languages" header values for known locales. - # TODO(mef): These strings should be auto-generated from chrome's .xtb - # files, not hardcoded. - sources = [ - "Resources/Localization/am.lproj", - "Resources/Localization/ar.lproj", - "Resources/Localization/bg.lproj", - "Resources/Localization/bn.lproj", - "Resources/Localization/ca.lproj", - "Resources/Localization/cs.lproj", - "Resources/Localization/da.lproj", - "Resources/Localization/de.lproj", - "Resources/Localization/el.lproj", - "Resources/Localization/en-GB.lproj", - "Resources/Localization/en.lproj", - "Resources/Localization/es-419.lproj", - "Resources/Localization/es.lproj", - "Resources/Localization/fa.lproj", - "Resources/Localization/fi.lproj", - "Resources/Localization/fil.lproj", - "Resources/Localization/fr.lproj", - "Resources/Localization/gu.lproj", - "Resources/Localization/he.lproj", - "Resources/Localization/hi.lproj", - "Resources/Localization/hr.lproj", - "Resources/Localization/hu.lproj", - "Resources/Localization/id.lproj", - "Resources/Localization/it.lproj", - "Resources/Localization/ja.lproj", - "Resources/Localization/kn.lproj", - "Resources/Localization/ko.lproj", - "Resources/Localization/lt.lproj", - "Resources/Localization/lv.lproj", - "Resources/Localization/ml.lproj", - "Resources/Localization/mr.lproj", - "Resources/Localization/ms.lproj", - "Resources/Localization/nb.lproj", - "Resources/Localization/nl.lproj", - "Resources/Localization/pl.lproj", - "Resources/Localization/pt-BR.lproj", - "Resources/Localization/pt-PT.lproj", - "Resources/Localization/pt.lproj", - "Resources/Localization/ro.lproj", - "Resources/Localization/ru.lproj", - "Resources/Localization/sk.lproj", - "Resources/Localization/sl.lproj", - "Resources/Localization/sr.lproj", - "Resources/Localization/sv.lproj", - "Resources/Localization/sw.lproj", - "Resources/Localization/ta.lproj", - "Resources/Localization/te.lproj", - "Resources/Localization/th.lproj", - "Resources/Localization/tr.lproj", - "Resources/Localization/uk.lproj", - "Resources/Localization/vi.lproj", - "Resources/Localization/zh-Hans.lproj", - "Resources/Localization/zh-Hant.lproj", - "Resources/Localization/zh.lproj", - ] - outputs = [ - "{{bundle_resources_dir}}/cronet_resources.bundle/{{source_file_part}}", - ] -} - ios_framework_bundle("cronet_framework") { output_name = "Cronet" info_plist_target = ":tweak_cronet_plist" deps = [ - ":cronet_framework_resources", ":cronet_sources", "//base", "//net:net", @@ -189,6 +124,17 @@ test("cronet_unittests") { ] } +action("generate_accept_languages") { + script = "//components/cronet/tools/generate_accept_languages.py" + args = [ + rebase_path("$target_gen_dir"), + rebase_path("//"), + ] + outputs = [ + "$target_gen_dir/accept_languages_table.h", + ] +} + if (additional_toolchains == [] || current_toolchain == default_toolchain) { _package_dir = "$root_out_dir/cronet" diff --git a/components/cronet/ios/Cronet.h b/components/cronet/ios/Cronet.h index 52f81d9f348b12..4a29721b2b39f1 100644 --- a/components/cronet/ios/Cronet.h +++ b/components/cronet/ios/Cronet.h @@ -31,6 +31,10 @@ typedef BOOL (^RequestFilterBlock)(NSURLRequest* request); GRPC_SUPPORT_EXPORT @interface Cronet : NSObject +// Sets the HTTP Accept-Language header. This method only has any effect before +// |start| is called. ++ (void)setAcceptLanguages:(NSString*)acceptLanguages; + // Sets whether HTTP/2 should be supported by CronetEngine. This method only has // any effect before |start| is called. + (void)setHttp2Enabled:(BOOL)http2Enabled; diff --git a/components/cronet/ios/Cronet.mm b/components/cronet/ios/Cronet.mm index 135398acfe05ae..d4217ab217f41b 100644 --- a/components/cronet/ios/Cronet.mm +++ b/components/cronet/ios/Cronet.mm @@ -14,6 +14,7 @@ #include "base/memory/scoped_vector.h" #include "base/strings/sys_string_conversions.h" #include "base/synchronization/lock.h" +#include "components/cronet/ios/accept_languages_table.h" #include "components/cronet/ios/cronet_environment.h" #include "components/cronet/url_request_context_config.h" #include "ios/net/crn_http_protocol_handler.h" @@ -43,6 +44,7 @@ std::unique_ptr gHttpProtocolHandlerDelegate; NSURLCache* gPreservedSharedURLCache = nil; BOOL gEnableTestCertVerifierForTesting = FALSE; +NSString* gAcceptLanguages = nil; // CertVerifier, which allows any certificates for testing. class TestCertVerifier : public net::CertVerifier { @@ -116,20 +118,34 @@ + (void)configureCronetEnvironmentForTesting: } } ++ (NSString*)getAcceptLanguagesFromPreferredLanguages: + (NSArray*)languages { + NSMutableArray* acceptLanguages = [NSMutableArray new]; + for (NSString* lang_region in languages) { + NSString* lang = [lang_region componentsSeparatedByString:@"-"][0]; + NSString* localeAcceptLangs = acceptLangs[lang_region] ?: acceptLangs[lang]; + if (localeAcceptLangs) + [acceptLanguages + addObjectsFromArray:[localeAcceptLangs + componentsSeparatedByString:@","]]; + } + + NSString* acceptLanguageString = + [[[NSOrderedSet orderedSetWithArray:acceptLanguages] array] + componentsJoinedByString:@","]; + + return [acceptLanguageString length] != 0 ? acceptLanguageString + : @"en-US,en"; +} + + (NSString*)getAcceptLanguages { - // Use the framework bundle to search for resources. - NSBundle* frameworkBundle = [NSBundle bundleForClass:self]; - NSString* bundlePath = - [frameworkBundle pathForResource:@"cronet_resources" ofType:@"bundle"]; - NSBundle* bundle = [NSBundle bundleWithPath:bundlePath]; - NSString* acceptLanguages = NSLocalizedStringWithDefaultValue( - @"IDS_ACCEPT_LANGUAGES", @"Localizable", bundle, @"en-US,en", - @"These values are copied from Chrome's .xtb files, so the same " - "values are used in the |Accept-Language| header. Key name matches " - "Chrome's."); - if (acceptLanguages == Nil) - acceptLanguages = @""; - return acceptLanguages; + return [self + getAcceptLanguagesFromPreferredLanguages:[NSLocale preferredLanguages]]; +} + ++ (void)setAcceptLanguages:(NSString*)acceptLanguages { + [self checkNotStarted]; + gAcceptLanguages = acceptLanguages; } + (void)checkNotStarted { @@ -193,7 +209,7 @@ + (void)startInternal { gChromeNet.Get().reset( new cronet::CronetEnvironment(user_agent, gUserAgentPartial)); gChromeNet.Get()->set_accept_language( - base::SysNSStringToUTF8([self getAcceptLanguages])); + base::SysNSStringToUTF8(gAcceptLanguages ?: [self getAcceptLanguages])); gChromeNet.Get()->set_http2_enabled(gHttp2Enabled); gChromeNet.Get()->set_quic_enabled(gQuicEnabled); diff --git a/components/cronet/ios/Resources/Localization/am.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/am.lproj/Localizable.strings deleted file mode 100644 index ba55b061e5e961..00000000000000 --- a/components/cronet/ios/Resources/Localization/am.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "am,en-GB,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/ar.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/ar.lproj/Localizable.strings deleted file mode 100644 index dcd3304926272c..00000000000000 --- a/components/cronet/ios/Resources/Localization/ar.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "ar,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/bg.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/bg.lproj/Localizable.strings deleted file mode 100644 index 407c27b56ff4d5..00000000000000 --- a/components/cronet/ios/Resources/Localization/bg.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "bg-BG,bg"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/bn.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/bn.lproj/Localizable.strings deleted file mode 100644 index 08a64649d24b54..00000000000000 --- a/components/cronet/ios/Resources/Localization/bn.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "bn-IN,bn,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/ca.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/ca.lproj/Localizable.strings deleted file mode 100644 index bec5e2115ffbb4..00000000000000 --- a/components/cronet/ios/Resources/Localization/ca.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "ca-ES,ca"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/cs.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/cs.lproj/Localizable.strings deleted file mode 100644 index 665a4e3a1ff185..00000000000000 --- a/components/cronet/ios/Resources/Localization/cs.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "cs-CZ,cs"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/da.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/da.lproj/Localizable.strings deleted file mode 100644 index 428e5f7c73ade3..00000000000000 --- a/components/cronet/ios/Resources/Localization/da.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "da-DK,da,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/de.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/de.lproj/Localizable.strings deleted file mode 100644 index ca69ecb4cd5f71..00000000000000 --- a/components/cronet/ios/Resources/Localization/de.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "de-DE,de,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/el.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/el.lproj/Localizable.strings deleted file mode 100644 index 450fd28705dd1c..00000000000000 --- a/components/cronet/ios/Resources/Localization/el.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "el-GR,el"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/en-GB.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/en-GB.lproj/Localizable.strings deleted file mode 100644 index 790ff2cbd70a1f..00000000000000 --- a/components/cronet/ios/Resources/Localization/en-GB.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "en-GB,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/en.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/en.lproj/Localizable.strings deleted file mode 100644 index b3798159e8d2c3..00000000000000 --- a/components/cronet/ios/Resources/Localization/en.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. DO NOT TRANSLATE. */ -"IDS_ACCEPT_LANGUAGES" = "en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/es-419.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/es-419.lproj/Localizable.strings deleted file mode 100644 index 347bc579984c5d..00000000000000 --- a/components/cronet/ios/Resources/Localization/es-419.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "es-419,es"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/es.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/es.lproj/Localizable.strings deleted file mode 100644 index 1ed553b749e436..00000000000000 --- a/components/cronet/ios/Resources/Localization/es.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "es-ES,es"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/et.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/et.lproj/Localizable.strings deleted file mode 100644 index 62607798173ba7..00000000000000 --- a/components/cronet/ios/Resources/Localization/et.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "et-EE,et,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/fa.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/fa.lproj/Localizable.strings deleted file mode 100644 index 69d343ff5de9c9..00000000000000 --- a/components/cronet/ios/Resources/Localization/fa.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "fa,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/fi.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/fi.lproj/Localizable.strings deleted file mode 100644 index 3c35a793851e78..00000000000000 --- a/components/cronet/ios/Resources/Localization/fi.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "fi-FI,fi,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/fil.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/fil.lproj/Localizable.strings deleted file mode 100644 index 6a90add5c3d88f..00000000000000 --- a/components/cronet/ios/Resources/Localization/fil.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "fil,fil-PH,tl,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/fr.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/fr.lproj/Localizable.strings deleted file mode 100644 index 1cf470056cf194..00000000000000 --- a/components/cronet/ios/Resources/Localization/fr.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "fr-FR,fr,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/gu.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/gu.lproj/Localizable.strings deleted file mode 100644 index b8439e857c8814..00000000000000 --- a/components/cronet/ios/Resources/Localization/gu.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "gu-IN,gu,hi-IN,hi,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/he.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/he.lproj/Localizable.strings deleted file mode 100644 index 23c6a0d903385b..00000000000000 --- a/components/cronet/ios/Resources/Localization/he.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "he-IL,he,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/hi.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/hi.lproj/Localizable.strings deleted file mode 100644 index 28466ff7adb378..00000000000000 --- a/components/cronet/ios/Resources/Localization/hi.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "hi-IN,hi,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/hr.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/hr.lproj/Localizable.strings deleted file mode 100644 index db8c1e6eddba89..00000000000000 --- a/components/cronet/ios/Resources/Localization/hr.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "hr-HR,hr,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/hu.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/hu.lproj/Localizable.strings deleted file mode 100644 index 3b8666781d0510..00000000000000 --- a/components/cronet/ios/Resources/Localization/hu.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "hu-HU,hu,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/id.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/id.lproj/Localizable.strings deleted file mode 100644 index 7af26cefb40d9e..00000000000000 --- a/components/cronet/ios/Resources/Localization/id.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "id-ID,id,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/it.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/it.lproj/Localizable.strings deleted file mode 100644 index fd855c0af572dc..00000000000000 --- a/components/cronet/ios/Resources/Localization/it.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "it-IT,it,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/ja.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/ja.lproj/Localizable.strings deleted file mode 100644 index 6a1779e57f33cf..00000000000000 --- a/components/cronet/ios/Resources/Localization/ja.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "ja,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/kn.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/kn.lproj/Localizable.strings deleted file mode 100644 index 167d19ca222f6f..00000000000000 --- a/components/cronet/ios/Resources/Localization/kn.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "kn-IN,kn,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/ko.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/ko.lproj/Localizable.strings deleted file mode 100644 index c5e8d4f2c6ac77..00000000000000 --- a/components/cronet/ios/Resources/Localization/ko.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "ko-KR,ko,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/lt.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/lt.lproj/Localizable.strings deleted file mode 100644 index 857146a173254b..00000000000000 --- a/components/cronet/ios/Resources/Localization/lt.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "lt,en-US,en,ru,pl"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/lv.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/lv.lproj/Localizable.strings deleted file mode 100644 index 1efd5e84e9a851..00000000000000 --- a/components/cronet/ios/Resources/Localization/lv.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "lv-LV,lv,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/ml.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/ml.lproj/Localizable.strings deleted file mode 100644 index 4382668a7d1e7c..00000000000000 --- a/components/cronet/ios/Resources/Localization/ml.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "ml-IN,ml,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/mr.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/mr.lproj/Localizable.strings deleted file mode 100644 index fbf98d7b37a49d..00000000000000 --- a/components/cronet/ios/Resources/Localization/mr.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "mr-IN,mr,hi-IN,hi,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/ms.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/ms.lproj/Localizable.strings deleted file mode 100644 index a8b6d584067709..00000000000000 --- a/components/cronet/ios/Resources/Localization/ms.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. DO NOT TRANSLATE. */ -"IDS_ACCEPT_LANGUAGES" = "ms,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/nb.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/nb.lproj/Localizable.strings deleted file mode 100644 index 4e3271b61f1d9c..00000000000000 --- a/components/cronet/ios/Resources/Localization/nb.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "nb-NO,nb,no,nn,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/nl.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/nl.lproj/Localizable.strings deleted file mode 100644 index dca54febb8b410..00000000000000 --- a/components/cronet/ios/Resources/Localization/nl.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "nl-NL,nl,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/pl.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/pl.lproj/Localizable.strings deleted file mode 100644 index f9ea84e1c3b066..00000000000000 --- a/components/cronet/ios/Resources/Localization/pl.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "pl-PL,pl,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/pt-BR.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/pt-BR.lproj/Localizable.strings deleted file mode 100644 index 8b0425040190da..00000000000000 --- a/components/cronet/ios/Resources/Localization/pt-BR.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "pt-BR,pt,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/pt-PT.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/pt-PT.lproj/Localizable.strings deleted file mode 100644 index 2e0d86c7505f8a..00000000000000 --- a/components/cronet/ios/Resources/Localization/pt-PT.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "pt-PT,pt,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/pt.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/pt.lproj/Localizable.strings deleted file mode 100644 index fb3c1ebd038096..00000000000000 --- a/components/cronet/ios/Resources/Localization/pt.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. DO NOT TRANSLATE. */ -"IDS_ACCEPT_LANGUAGES" = "pt-PT,pt,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/ro.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/ro.lproj/Localizable.strings deleted file mode 100644 index 7428ce58ec450b..00000000000000 --- a/components/cronet/ios/Resources/Localization/ro.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "ro-RO,ro,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/ru.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/ru.lproj/Localizable.strings deleted file mode 100644 index 2d5644949690a6..00000000000000 --- a/components/cronet/ios/Resources/Localization/ru.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "ru-RU,ru,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/sk.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/sk.lproj/Localizable.strings deleted file mode 100644 index 5dff353f407224..00000000000000 --- a/components/cronet/ios/Resources/Localization/sk.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "sk-SK,sk,cs,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/sl.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/sl.lproj/Localizable.strings deleted file mode 100644 index 811ab06f68b63d..00000000000000 --- a/components/cronet/ios/Resources/Localization/sl.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "sl-SI,sl,en-GB,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/sr.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/sr.lproj/Localizable.strings deleted file mode 100644 index ff18f141e98fa3..00000000000000 --- a/components/cronet/ios/Resources/Localization/sr.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "sr-RS,sr,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/sv.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/sv.lproj/Localizable.strings deleted file mode 100644 index 3daf55fcecaf5a..00000000000000 --- a/components/cronet/ios/Resources/Localization/sv.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "sv-SE,sv,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/sw.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/sw.lproj/Localizable.strings deleted file mode 100644 index ef6b4921207c10..00000000000000 --- a/components/cronet/ios/Resources/Localization/sw.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "sw,en-GB,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/ta.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/ta.lproj/Localizable.strings deleted file mode 100644 index 2bde0146b12291..00000000000000 --- a/components/cronet/ios/Resources/Localization/ta.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "ta-IN,ta,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/te.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/te.lproj/Localizable.strings deleted file mode 100644 index 38fb4a4054866c..00000000000000 --- a/components/cronet/ios/Resources/Localization/te.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "te-IN,te,hi-IN,hi,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/th.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/th.lproj/Localizable.strings deleted file mode 100644 index 464b6370802eb6..00000000000000 --- a/components/cronet/ios/Resources/Localization/th.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "th-TH,th"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/tr.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/tr.lproj/Localizable.strings deleted file mode 100644 index b5289e2a891440..00000000000000 --- a/components/cronet/ios/Resources/Localization/tr.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "tr-TR,tr,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/uk.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/uk.lproj/Localizable.strings deleted file mode 100644 index 1fe6381182ca09..00000000000000 --- a/components/cronet/ios/Resources/Localization/uk.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "uk-UA,uk,ru,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/vi.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/vi.lproj/Localizable.strings deleted file mode 100644 index 082f76daaf1c5d..00000000000000 --- a/components/cronet/ios/Resources/Localization/vi.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. */ -"IDS_ACCEPT_LANGUAGES" = "vi-VN,vi,fr-FR,fr,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/zh-Hans.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/zh-Hans.lproj/Localizable.strings deleted file mode 100644 index 0a14ff79995ccc..00000000000000 --- a/components/cronet/ios/Resources/Localization/zh-Hans.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. DO NOT TRANSLATE. */ -"IDS_ACCEPT_LANGUAGES" = "zh-CN,zh"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/zh-Hant.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/zh-Hant.lproj/Localizable.strings deleted file mode 100644 index fadad918c637a1..00000000000000 --- a/components/cronet/ios/Resources/Localization/zh-Hant.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. DO NOT TRANSLATE. */ -"IDS_ACCEPT_LANGUAGES" = "zh-TW,zh,en-US,en"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/Localization/zh.lproj/Localizable.strings b/components/cronet/ios/Resources/Localization/zh.lproj/Localizable.strings deleted file mode 100644 index 0a14ff79995ccc..00000000000000 --- a/components/cronet/ios/Resources/Localization/zh.lproj/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* These values are copied from Chrome's .xtb files, this is so the same values are used in the |Accept-Language| header. Key name matches Chrome's. DO NOT TRANSLATE. */ -"IDS_ACCEPT_LANGUAGES" = "zh-CN,zh"; \ No newline at end of file diff --git a/components/cronet/ios/Resources/README b/components/cronet/ios/Resources/README deleted file mode 100644 index 681b85356bfe9b..00000000000000 --- a/components/cronet/ios/Resources/README +++ /dev/null @@ -1,9 +0,0 @@ -This localization directory contains language strings taken from Chrome. These -language strings are taken from Chrome's *.xtb files with the key -IDS_ACCEPT_LANGUAGES. - -DO NOT translate strings with a IDS_ACCEPT_LANGUAGES key from these .strings -files in the translation console. - -On top of Chrome's language list, the following languages were added: -"pt" "ms" "zh" diff --git a/components/cronet/ios/test/BUILD.gn b/components/cronet/ios/test/BUILD.gn index db793b56b22e87..fc515a566ebbf3 100644 --- a/components/cronet/ios/test/BUILD.gn +++ b/components/cronet/ios/test/BUILD.gn @@ -8,6 +8,7 @@ import("//testing/test.gni") test("cronet_test") { testonly = true sources = [ + "cronet_acceptlang_test.mm", "cronet_http_test.mm", "cronet_netlog_test.mm", "cronet_test_runner.mm", diff --git a/components/cronet/ios/test/cronet_acceptlang_test.mm b/components/cronet/ios/test/cronet_acceptlang_test.mm new file mode 100644 index 00000000000000..d19ace698c618a --- /dev/null +++ b/components/cronet/ios/test/cronet_acceptlang_test.mm @@ -0,0 +1,57 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// These tests are somewhat dependent on the exact contents of the +// accept languages table generated at build-time. + +#import +#import + +#include "testing/gtest/include/gtest/gtest.h" + +@interface Cronet (ExposedForTesting) ++ (NSString*)getAcceptLanguagesFromPreferredLanguages: + (NSArray*)languages; +@end + +namespace cronet { + +#define EXPECT_NSEQ(a, b) EXPECT_TRUE([(a) isEqual:(b)]) + +TEST(AcceptLangTest, Region) { + NSString* acceptLangs = + [Cronet getAcceptLanguagesFromPreferredLanguages:@[ @"en-GB" ]]; + + EXPECT_NSEQ(acceptLangs, @"en-GB,en-US,en"); +} + +TEST(AcceptLangTest, Lang) { + NSString* acceptLangs = + [Cronet getAcceptLanguagesFromPreferredLanguages:@[ @"ja-JP" ]]; + + EXPECT_NSEQ(acceptLangs, @"ja,en-US,en"); +} + +TEST(AcceptLangTest, Default) { + NSString* acceptLangs = + [Cronet getAcceptLanguagesFromPreferredLanguages:@[ @"lol-LOL" ]]; + + EXPECT_NSEQ(acceptLangs, @"en-US,en"); +} + +TEST(AcceptLangTest, Append) { + NSString* acceptLangs = + [Cronet getAcceptLanguagesFromPreferredLanguages:@[ @"ja-JP", @"en-GB" ]]; + + EXPECT_NSEQ(acceptLangs, @"ja,en-US,en,en-GB"); +} + +TEST(AcceptLangTest, NoDefaultAppend) { + NSString* acceptLangs = [Cronet + getAcceptLanguagesFromPreferredLanguages:@[ @"en-GB", @"lol-LOL" ]]; + + NSLog(@"%@", acceptLangs); + EXPECT_NSEQ(acceptLangs, @"en-GB,en-US,en"); +} +} diff --git a/components/cronet/ios/test/start_cronet.mm b/components/cronet/ios/test/start_cronet.mm index 4af4d223cedff5..148fe5333f2101 100644 --- a/components/cronet/ios/test/start_cronet.mm +++ b/components/cronet/ios/test/start_cronet.mm @@ -20,6 +20,7 @@ void StartCronetIfNecessary(int port) { [Cronet setUserAgent:@"CronetTest/1.0.0.0" partial:NO]; [Cronet setHttp2Enabled:true]; [Cronet setQuicEnabled:true]; + [Cronet setAcceptLanguages:@"en-US,en"]; [Cronet setSslKeyLogFileName:@"SSLKEYLOGFILE"]; [Cronet addQuicHint:@"test.example.com" port:443 altPort:443]; [Cronet enableTestCertVerifierForTesting]; diff --git a/components/cronet/tools/generate_accept_languages.py b/components/cronet/tools/generate_accept_languages.py new file mode 100644 index 00000000000000..f192058d8d1484 --- /dev/null +++ b/components/cronet/tools/generate_accept_languages.py @@ -0,0 +1,45 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This script generates a header containing a dictionary from locales to +# accept language strings from chromium's .xtb files. It is not very +# robust at the moment, and makes some assumptions about the format of +# the files, including at least the following: +# * assumes necessary data is contained only with files of the form +# components/strings/components_locale_settings_${LANG}.xtb +# * assumes ${LANG} is identified in the lang attribute of the root +# element of the file's xml data +# * assumes that there is only one relevant element with the +# IDS_ACCEPT_LANGUAGES attribute + +import os, re, sys +from xml.etree import ElementTree + +STRINGS_DIR = sys.argv[2] + 'components/strings/' + +def extract_accept_langs(filename): + tree = ElementTree.parse(STRINGS_DIR + filename).getroot() + for child in tree: + if child.get('id') == 'IDS_ACCEPT_LANGUAGES': + return tree.get('lang'), child.text + +def gen_accept_langs_table(): + return dict(filter(None, (extract_accept_langs(filename) + for filename in os.listdir(STRINGS_DIR) + if re.match(r'components_locale_settings_\S+.xtb', filename)))) + +HEADER = "NSDictionary* acceptLangs = @{" +def LINE(locale, accept_langs): + return ' @"' + locale + '" : @"' + accept_langs + '",' +FOOTER = "};" + +def main(): + with open(sys.argv[1] + "/accept_languages_table.h", "w+") as f: + print >>f, HEADER + for (locale, accept_langs) in gen_accept_langs_table().items(): + print >>f, LINE(locale, accept_langs) + print >>f, FOOTER + +if __name__ == "__main__": + main()