New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 655689 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 3
Type: Bug



Sign in to add a comment

[Cronet] Localization of Accept-Language request header uses string resources on iOS.

Project Member Reported by mef@chromium.org, Oct 13 2016

Issue description

CrNet automatically adds Accept-Language request header based on iOS device locale. Implementation uses 54 localizable strings extracted from Chrome's xtb files: https://cs.chromium.org/chromium/src/ios/crnet/Resources/

This requires resource bundle to be included into dynamic framework and shipped with the application, which seems excessive for this simple case.


 
Owner: mef@chromium.org
Status: Assigned (was: Untriaged)

Comment 2 by mef@chromium.org, Oct 18 2016

Cc: lilyhoughton@chromium.org kapishnikov@chromium.org thakis@chromium.org sdefresne@chromium.org
I think it may make sense to generate a C++ or objC file with IDS_ACCEPT_LANGUAGES values extracted from //components/strings/component_locale_settings_*.xtb and use current [NSLocale preferredLanguages] to select appropriate value.

Does it make sense? Is there some easy way to use grit-18n toolset to generate this output, or is better to create a python script to parse xtb files (which appear to use pretty straight-forward xml format)?

Comment 3 by mef@chromium.org, Nov 14 2016

Owner: lilyhoughton@chromium.org
Another option is to use Localizable.strings file (i.e. native iOS localization support). There is already a tool and templates to generates those from .pak files.

See ios/chrome/tools/strings/generate_localizable_strings.gni and its uses.

Comment 5 by mef@chromium.org, Nov 16 2016

Yes, that's what we currently do, although not dynamically, but rather by having those strings checked in: https://cs.chromium.org/chromium/src/components/cronet/ios/Resources/Localization/

I guess my biggest concern that Cronet.framework contains 55 subdirectories with 55 Localizable.strings files that have very simple contents, for example:

/* 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";

Project Member

Comment 6 by bugdroid1@chromium.org, Mar 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fe175d21e8db10f5de5c06fc3ae68788009581f1

commit fe175d21e8db10f5de5c06fc3ae68788009581f1
Author: lilyhoughton <lilyhoughton@google.com>
Date: Fri Mar 03 20:29:19 2017

[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}

[modify] https://crrev.com/fe175d21e8db10f5de5c06fc3ae68788009581f1/components/cronet/ios/BUILD.gn
[modify] https://crrev.com/fe175d21e8db10f5de5c06fc3ae68788009581f1/components/cronet/ios/Cronet.h
[modify] https://crrev.com/fe175d21e8db10f5de5c06fc3ae68788009581f1/components/cronet/ios/Cronet.mm
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/am.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/ar.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/bg.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/bn.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/ca.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/cs.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/da.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/de.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/el.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/en-GB.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/en.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/es-419.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/es.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/et.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/fa.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/fi.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/fil.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/fr.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/gu.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/he.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/hi.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/hr.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/hu.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/id.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/it.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/ja.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/kn.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/ko.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/lt.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/lv.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/ml.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/mr.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/ms.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/nb.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/nl.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/pl.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/pt-BR.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/pt-PT.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/pt.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/ro.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/ru.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/sk.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/sl.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/sr.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/sv.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/sw.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/ta.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/te.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/th.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/tr.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/uk.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/vi.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/zh-Hans.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/zh-Hant.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/Localization/zh.lproj/Localizable.strings
[delete] https://crrev.com/1021ed20bd0720753b316270561c691e26f93cf7/components/cronet/ios/Resources/README
[modify] https://crrev.com/fe175d21e8db10f5de5c06fc3ae68788009581f1/components/cronet/ios/test/BUILD.gn
[add] https://crrev.com/fe175d21e8db10f5de5c06fc3ae68788009581f1/components/cronet/ios/test/cronet_acceptlang_test.mm
[modify] https://crrev.com/fe175d21e8db10f5de5c06fc3ae68788009581f1/components/cronet/ios/test/start_cronet.mm
[add] https://crrev.com/fe175d21e8db10f5de5c06fc3ae68788009581f1/components/cronet/tools/generate_accept_languages.py

Comment 7 by mef@chromium.org, Mar 17 2017

Status: Fixed (was: Assigned)

Sign in to add a comment