Skip to content

Commit 17c302b

Browse files
digit-androidDavid Turner
authored andcommitted
android: Ensure all localized strings for Norwegian are used.
A few third-party packages mistakenly provide their localized strings for Norwegian with the incorrect 'no' locale tag (which represents a macro language, not a real one), instead of 'nb', the expected value. As such, these strings were omitted from the build and missing from APKs and bundles. This fixes the issue by ensuring that 'no' strings are recognized as 'nb' ones, if the package provides them. This CL thus adds 'nb' strings for the following 13 string resources in the Monochrome bundle: hats_lib_close_button_description hats_lib_default_prompt_title hats_lib_default_star_rating_bar_description hats_lib_default_thank_you hats_lib_next hats_lib_none_of_the_above hats_lib_open_text_hint hats_lib_open_text_no_pii hats_lib_prompt_no_thanks hats_lib_prompt_take_our_survey hats_lib_submit hats_lib_survey_page_number hats_lib_thank_you_followup_message + Disable pylint warnings properly now that of presubmit scripts have been fixed to parse the line-too-long directives properly [1] [1] https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1396094 BUG=920960 R=​agrieve@chromium.org,benmason@chromium.org,estevenson@chromium.org,yfriedman@chromium.org Change-Id: Ied74827c2e53c81f165b2fbcaec9f35d7e893290 Reviewed-on: https://chromium-review.googlesource.com/c/1437174 Reviewed-by: Andrew Grieve <agrieve@chromium.org> Commit-Queue: David Turner <digit@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#626341}(cherry picked from commit 1a5082d) Reviewed-on: https://chromium-review.googlesource.com/c/1446191 Reviewed-by: David Turner <digit@chromium.org> Cr-Commit-Position: refs/branch-heads/3683@{#64} Cr-Branched-From: e510299-refs/heads/master@{#625896}
1 parent de2e284 commit 17c302b

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

build/android/gyp/compile_resources.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
#
2+
# encoding: utf-8
33
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
44
# Use of this source code is governed by a BSD-style license that can be
55
# found in the LICENSE file.
@@ -276,6 +276,11 @@ def _RenameLocaleResourceDirs(resource_dirs):
276276
* Modern ISO 639-1 codes will be renamed to their obsolete variant
277277
for Indonesian, Hebrew and Yiddish (e.g. 'values-in/ -> values-id/).
278278
279+
* Norwegian macrolanguage strings will be renamed to Bokmål (main
280+
Norway language). See http://crbug.com/920960. In practice this
281+
means that 'values-no/ -> values-nb/' unless 'values-nb/' already
282+
exists.
283+
279284
* BCP 47 langauge tags will be renamed to an equivalent ISO 639-1
280285
locale qualifier if possible (e.g. 'values-b+en+US/ -> values-en-rUS').
281286
Though this is not necessary at the moment, because no third-party
@@ -305,8 +310,8 @@ def _RenameLocaleResourceDirs(resource_dirs):
305310
raise Exception('Could not substitute locale %s for %s in %s' %
306311
(locale, locale2, path))
307312
if os.path.exists(path2):
308-
# This happens sometimes, e.g. the Android support library comes
309-
# with both values-sr/ and values-b+sr+Latn/.
313+
# This happens sometimes, e.g. some libraries provide both
314+
# values-nb/ and values-no/ with the same content.
310315
continue
311316
build_utils.MakeDirectory(os.path.dirname(path2))
312317
shutil.move(path, path2)

build/android/gyp/util/resource_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
'iw': 'he',
4141
'in': 'id',
4242
'ji': 'yi',
43+
'no': 'nb', # 'no' is not a real language. http://crbug.com/920960
4344
}
4445

4546

build/android/gyp/util/resource_utils_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
'copy_to_clipboard_failure_message': 'Lõikelauale kopeerimine ebaõnnestus'
2626
}
2727

28+
# pylint: disable=line-too-long
2829
_EXPECTED_XML_1 = '''<?xml version="1.0" encoding="utf-8"?>
2930
<resources xmlns:android="http://schemas.android.com/apk/res/android">
3031
<string name="copy_to_clipboard_failure_message">"Lõikelauale kopeerimine ebaõnnestus"</string>
3132
<string name="low_memory_error">"Eelmist toimingut ei saa vähese mälu tõttu lõpetada"</string>
3233
<string name="opening_file_error">"Valit. faili avamine ebaõnnestus"</string>
3334
</resources>
3435
'''
36+
# pylint: enable=line-too-long
3537

3638
_XML_RESOURCES_PREFIX = r'''<?xml version="1.0" encoding="utf-8"?>
3739
<resources xmlns:android="http://schemas.android.com/apk/res/android">
@@ -148,6 +150,7 @@ def test_ToAndroidLocaleName(self):
148150
'he-IL': 'iw-rIL',
149151
'id': 'in',
150152
'id-BAR': 'in-rBAR',
153+
'nb': 'nb',
151154
'yi': 'ji'
152155
}
153156
for chromium_locale, android_locale in \
@@ -178,6 +181,8 @@ def test_ToChromiumLocaleName(self):
178181
'in': 'id',
179182
'in-rBAR': 'id-BAR',
180183
'id-rBAR': 'id-BAR',
184+
'nb': 'nb',
185+
'no': 'nb', # http://crbug.com/920960
181186
}
182187
for android_locale, chromium_locale in \
183188
_TEST_ANDROID_TO_CHROMIUM_LOCALE_MAP.iteritems():

0 commit comments

Comments
 (0)