Add default locale for generated categories

The client expects at least a name to be set.

Regression of 2c566cf6.
This commit is contained in:
Jochen Sprickerhof 2023-09-10 10:05:15 +02:00 committed by Hans-Christoph Steiner
parent b5724f507b
commit 521ff4fe17
4 changed files with 20 additions and 8 deletions

View File

@ -746,7 +746,7 @@ def make_v2(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_
# include definitions for "auto-defined" categories, e.g. just used in app metadata
for category in sorted(categories_used_by_apps):
if category not in output['repo'][CATEGORIES_CONFIG_NAME]:
output['repo'][CATEGORIES_CONFIG_NAME][category] = dict()
output['repo'][CATEGORIES_CONFIG_NAME][category] = {"name": {DEFAULT_LOCALE: category}}
# do not include defined categories if no apps use them
for category in list(output['repo'].get(CATEGORIES_CONFIG_NAME, list())):
if category not in categories_used_by_apps:

View File

@ -3,7 +3,7 @@
"version": 20002,
"index": {
"name": "/index-v2.json",
"sha256": "5e3c0eaafd99d3518da2bb2bc7565b2ebcb17775a2f4ccc33b7336901ec71a6f",
"sha256": "72146bc3bbbfd49c4e23435ca8ba13d58673a83fa4634f7ce2ea465616860293",
"size": 53283,
"numPackages": 10
},

View File

@ -534,9 +534,21 @@
"en-US": "System"
}
},
"1": {},
"2.0": {},
"tests": {}
"1": {
"name": {
"en-US": "1"
}
},
"2.0": {
"name": {
"en-US": "2.0"
}
},
"tests": {
"name": {
"en-US": "tests"
}
}
},
"requests": {
"install": [

View File

@ -1842,7 +1842,7 @@ class UpdateTest(unittest.TestCase):
with open('repo/index-v2.json') as fp:
index = json.load(fp)
self.assertEqual(
{'Time': dict()},
{'Time': {'name': {'en-US': 'Time'}}},
index['repo'][CATEGORIES_CONFIG_NAME],
)
@ -1867,7 +1867,7 @@ class UpdateTest(unittest.TestCase):
with open('repo/index-v2.json') as fp:
index = json.load(fp)
self.assertEqual(
{'bar': dict(), 'foo': dict()},
{'bar': {'name': {'en-US': 'bar'}}, 'foo': {'name': {'en-US': 'foo'}}},
index['repo'][CATEGORIES_CONFIG_NAME],
)
@ -1894,7 +1894,7 @@ class UpdateTest(unittest.TestCase):
with open('repo/index-v2.json') as fp:
index = json.load(fp)
self.assertEqual(
{'System': {'name': {'en-US': 'System Apps'}}, 'Time': dict()},
{'System': {'name': {'en-US': 'System Apps'}}, 'Time': {'name': {'en-US': 'Time'}}},
index['repo'][CATEGORIES_CONFIG_NAME],
)