mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
downcase all 'localized' key names to match the rest of index-v1
This is a little omission. keys that are used in metadata/*.yml all start with an UpperCase letter, but in fdroidserver, index-v1.json, and fdroidclient, it is all camelCase with lowercase first letter. The keys from the 'localized' section are currently never in metadata/*.yml, so these keys never get downcase. This change will break fdroidclient versions that do not also have this change, but since we're in alpha, that should be fine. If support for a 'localized' section is added to metadata/*.yml, then the keys there should probably be UpperCase CamelCase to match the other keys.
This commit is contained in:
parent
9f9f0d1a16
commit
cdef5bcd92
4 changed files with 31 additions and 30 deletions
|
@ -93,12 +93,12 @@ default_config = {
|
||||||
'keystore': 'keystore.jks',
|
'keystore': 'keystore.jks',
|
||||||
'smartcardoptions': [],
|
'smartcardoptions': [],
|
||||||
'char_limits': {
|
'char_limits': {
|
||||||
'Author': 256,
|
'author': 256,
|
||||||
'Name': 30,
|
'name': 30,
|
||||||
'Summary': 80,
|
'summary': 80,
|
||||||
'Description': 4000,
|
'description': 4000,
|
||||||
'Video': 256,
|
'video': 256,
|
||||||
'WhatsNew': 500,
|
'whatsNew': 500,
|
||||||
},
|
},
|
||||||
'keyaliases': {},
|
'keyaliases': {},
|
||||||
'repo_url': "https://MyFirstFDroidRepo.org/fdroid/repo",
|
'repo_url': "https://MyFirstFDroidRepo.org/fdroid/repo",
|
||||||
|
|
|
@ -163,13 +163,13 @@ def check_ucm_tags(app):
|
||||||
def check_char_limits(app):
|
def check_char_limits(app):
|
||||||
limits = config['char_limits']
|
limits = config['char_limits']
|
||||||
|
|
||||||
if len(app.Summary) > limits['Summary']:
|
if len(app.Summary) > limits['summary']:
|
||||||
yield "Summary of length %s is over the %i char limit" % (
|
yield "Summary of length %s is over the %i char limit" % (
|
||||||
len(app.Summary), limits['Summary'])
|
len(app.Summary), limits['summary'])
|
||||||
|
|
||||||
if len(app.Description) > limits['Description']:
|
if len(app.Description) > limits['description']:
|
||||||
yield "Description of length %s is over the %i char limit" % (
|
yield "Description of length %s is over the %i char limit" % (
|
||||||
len(app.Description), limits['Description'])
|
len(app.Description), limits['description'])
|
||||||
|
|
||||||
|
|
||||||
def check_old_links(app):
|
def check_old_links(app):
|
||||||
|
|
|
@ -575,7 +575,7 @@ def _set_localized_text_entry(app, locale, key, f):
|
||||||
|
|
||||||
|
|
||||||
def _set_author_entry(app, key, f):
|
def _set_author_entry(app, key, f):
|
||||||
limit = config['char_limits']['Author']
|
limit = config['char_limits']['author']
|
||||||
with open(f) as fp:
|
with open(f) as fp:
|
||||||
text = fp.read()[:limit]
|
text = fp.read()[:limit]
|
||||||
if len(text) > 0:
|
if len(text) > 0:
|
||||||
|
@ -612,33 +612,33 @@ def copy_triple_t_store_metadata(apps):
|
||||||
locale = segments[-2]
|
locale = segments[-2]
|
||||||
for f in files:
|
for f in files:
|
||||||
if f == 'fulldescription':
|
if f == 'fulldescription':
|
||||||
_set_localized_text_entry(app, locale, 'Description',
|
_set_localized_text_entry(app, locale, 'description',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == 'shortdescription':
|
elif f == 'shortdescription':
|
||||||
_set_localized_text_entry(app, locale, 'Summary',
|
_set_localized_text_entry(app, locale, 'summary',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == 'title':
|
elif f == 'title':
|
||||||
_set_localized_text_entry(app, locale, 'Name',
|
_set_localized_text_entry(app, locale, 'name',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == 'video':
|
elif f == 'video':
|
||||||
_set_localized_text_entry(app, locale, 'Video',
|
_set_localized_text_entry(app, locale, 'video',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == 'whatsnew':
|
elif f == 'whatsnew':
|
||||||
_set_localized_text_entry(app, segments[-1], 'WhatsNew',
|
_set_localized_text_entry(app, segments[-1], 'whatsNew',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == 'contactEmail':
|
elif f == 'contactEmail':
|
||||||
_set_author_entry(app, 'AuthorEmail', os.path.join(root, f))
|
_set_author_entry(app, 'authorEmail', os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == 'contactPhone':
|
elif f == 'contactPhone':
|
||||||
_set_author_entry(app, 'AuthorPhone', os.path.join(root, f))
|
_set_author_entry(app, 'authorPhone', os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == 'contactWebsite':
|
elif f == 'contactWebsite':
|
||||||
_set_author_entry(app, 'AuthorWebSite', os.path.join(root, f))
|
_set_author_entry(app, 'authorWebSite', os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
base, extension = common.get_extension(f)
|
base, extension = common.get_extension(f)
|
||||||
|
@ -664,7 +664,8 @@ def insert_localized_app_metadata(apps):
|
||||||
and adds them to the app metadata. The screenshots and graphic
|
and adds them to the app metadata. The screenshots and graphic
|
||||||
must be PNG or JPEG files ending with ".png", ".jpg", or ".jpeg"
|
must be PNG or JPEG files ending with ".png", ".jpg", or ".jpeg"
|
||||||
and must be in the following layout:
|
and must be in the following layout:
|
||||||
|
# TODO replace these docs with link to All_About_Descriptions_Graphics_and_Screenshots
|
||||||
|
# TODO mention that the 'localized' section is not in metadata.yml, so key names are like Java vars: camelCase with first letter lowercase.
|
||||||
repo/packageName/locale/featureGraphic.png
|
repo/packageName/locale/featureGraphic.png
|
||||||
repo/packageName/locale/phoneScreenshots/1.png
|
repo/packageName/locale/phoneScreenshots/1.png
|
||||||
repo/packageName/locale/phoneScreenshots/2.png
|
repo/packageName/locale/phoneScreenshots/2.png
|
||||||
|
@ -709,23 +710,23 @@ def insert_localized_app_metadata(apps):
|
||||||
destdir = os.path.join('repo', packageName, locale)
|
destdir = os.path.join('repo', packageName, locale)
|
||||||
for f in files:
|
for f in files:
|
||||||
if f == 'full_description.txt':
|
if f == 'full_description.txt':
|
||||||
_set_localized_text_entry(apps[packageName], locale, 'Description',
|
_set_localized_text_entry(apps[packageName], locale, 'description',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == 'short_description.txt':
|
elif f == 'short_description.txt':
|
||||||
_set_localized_text_entry(apps[packageName], locale, 'Summary',
|
_set_localized_text_entry(apps[packageName], locale, 'summary',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == 'title.txt':
|
elif f == 'title.txt':
|
||||||
_set_localized_text_entry(apps[packageName], locale, 'Name',
|
_set_localized_text_entry(apps[packageName], locale, 'name',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == 'video.txt':
|
elif f == 'video.txt':
|
||||||
_set_localized_text_entry(apps[packageName], locale, 'Video',
|
_set_localized_text_entry(apps[packageName], locale, 'video',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
elif f == str(apps[packageName]['CurrentVersionCode']) + '.txt':
|
elif f == str(apps[packageName]['CurrentVersionCode']) + '.txt':
|
||||||
_set_localized_text_entry(apps[packageName], segments[-2], 'WhatsNew',
|
_set_localized_text_entry(apps[packageName], segments[-2], 'whatsNew',
|
||||||
os.path.join(root, f))
|
os.path.join(root, f))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -52,11 +52,11 @@ class UpdateTest(unittest.TestCase):
|
||||||
self.assertEqual(1, len(app['localized']))
|
self.assertEqual(1, len(app['localized']))
|
||||||
if packageName == 'info.guardianproject.urzip':
|
if packageName == 'info.guardianproject.urzip':
|
||||||
self.assertEqual(5, len(app['localized']['en-US']))
|
self.assertEqual(5, len(app['localized']['en-US']))
|
||||||
self.assertEqual('full description\n', app['localized']['en-US']['Description'])
|
self.assertEqual('full description\n', app['localized']['en-US']['description'])
|
||||||
self.assertEqual('title\n', app['localized']['en-US']['Name'])
|
self.assertEqual('title\n', app['localized']['en-US']['name'])
|
||||||
self.assertEqual('short description\n', app['localized']['en-US']['Summary'])
|
self.assertEqual('short description\n', app['localized']['en-US']['summary'])
|
||||||
self.assertEqual('video\n', app['localized']['en-US']['Video'])
|
self.assertEqual('video\n', app['localized']['en-US']['video'])
|
||||||
self.assertEqual('100\n', app['localized']['en-US']['WhatsNew'])
|
self.assertEqual('100\n', app['localized']['en-US']['whatsNew'])
|
||||||
elif packageName == 'org.videolan.vlc':
|
elif packageName == 'org.videolan.vlc':
|
||||||
self.assertEqual('icon.png', app['localized']['en-US']['icon'])
|
self.assertEqual('icon.png', app['localized']['en-US']['icon'])
|
||||||
self.assertEqual(9, len(app['localized']['en-US']['phoneScreenshots']))
|
self.assertEqual(9, len(app['localized']['en-US']['phoneScreenshots']))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue