Merge pull request #3957 from mozilla/revert-3944
Revert "Set default_locale to en-US if none is given. Fixes #3899"
This commit is contained in:
Коммит
b14eb29bcf
|
@ -513,12 +513,8 @@ class Addon(OnChangeMixin, ModelBase):
|
|||
settings.AMO_LANGUAGES +
|
||||
settings.HIDDEN_LANGUAGES) and
|
||||
data.get('default_locale') == addon.default_locale)
|
||||
|
||||
if not locale_is_set:
|
||||
if addon.type == amo.ADDON_LPAPP:
|
||||
addon.default_locale = to_language(trans_real.get_language())
|
||||
else:
|
||||
addon.default_locale = to_language(settings.LANGUAGE_CODE)
|
||||
addon.default_locale = to_language(trans_real.get_language())
|
||||
|
||||
addon.save()
|
||||
|
||||
|
|
|
@ -2187,31 +2187,16 @@ class TestAddonFromUpload(UploadTest):
|
|||
assert addon.homepage is None
|
||||
|
||||
def test_default_locale(self):
|
||||
"""Make sure `default_locale` does not follow the activated language.
|
||||
# Make sure default_locale follows the active translation.
|
||||
addon = Addon.from_upload(self.get_upload('search.xml'),
|
||||
[self.platform])
|
||||
assert addon.default_locale == 'en-US'
|
||||
|
||||
https://github.com/mozilla/addons-server/issues/3899
|
||||
"""
|
||||
# Add-on with `default_locale = "es"`
|
||||
addon = Addon.from_upload(
|
||||
self.get_upload('webextension_default_locale_es.xpi'),
|
||||
[self.platform])
|
||||
translation.activate('es')
|
||||
addon = Addon.from_upload(self.get_upload('search.xml'),
|
||||
[self.platform])
|
||||
assert addon.default_locale == 'es'
|
||||
|
||||
translation.activate('fr')
|
||||
|
||||
# Add-on without any `default_locale` information.
|
||||
addon = Addon.from_upload(
|
||||
self.get_upload('webextension_no_id.xpi'),
|
||||
[self.platform])
|
||||
assert addon.default_locale == 'en-US'
|
||||
|
||||
# Make sure this is valid for all types of add-ons not just
|
||||
# WebExtensions
|
||||
addon = Addon.from_upload(
|
||||
self.get_upload('search.xml'),
|
||||
[self.platform])
|
||||
assert addon.default_locale == 'en-US'
|
||||
|
||||
def test_is_listed(self):
|
||||
# By default, the addon is listed.
|
||||
addon = Addon.from_upload(self.get_upload('extension.xpi'),
|
||||
|
|
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче