-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Content rating #3637
base: main
Are you sure you want to change the base?
Draft: Content rating #3637
Conversation
continue | ||
c_level = AppStream.ContentRatingValue.from_string(level) | ||
rating.add_attribute(attr, c_level) | ||
description = AppStream.ContentRating.attribute_get_description(attr, c_level) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure where this gets its locale from.
backend/app/utils.py
Outdated
system = AppStream.ContentRatingSystem.from_locale(locale) | ||
rating = AppStream.ContentRating() | ||
rating.set_kind(content_rating["kind"]) | ||
details = {"attrs": []} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pylance complains here, I guess details = {}
should work fine here
@@ -394,6 +397,33 @@ def appstream2dict(appstream_url=None) -> tuple[dict[str, dict], dict[str, dict] | |||
return apps, apps_locale | |||
|
|||
|
|||
def get_content_rating_details(content_rating: dict, locale: str) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you work this into the update routine at some point already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because I wasn't sure how to. See my comment above:
libappstream also provides localized descriptions of all content ratings. I was not sure how to integrate this with flathub's approach to i18n. We could either try to hook into that. Or we could duplicate the code.
Looks promising, work should focus on the backend part for now |
AFAIKS, this is only used in the detail view
e64f45b
to
6e39838
Compare
|
Pushed something that has started to work, more problems are:
|
See #114
I worked on this during GUADEC, and I am not sure if I will be able to continue working on this any further. Unfortunately I did not get it to a usable state, but I will try to note down all interesting details so someone else can pick this up and finish the remaining bits and pieces.
gnome-software worked on this a while ago and upstreamed its logic into libappstream (see ximion/appstream@18c8b18). There are some details to this that we should consider:
Accept-Language
header, which is probably fine, but not a perfect match.violence-bloodshed
readily available. It is probably a good idea to look into what gnome-software does.