apps: Support empty lang attribute#23079
Open
Venefilyn wants to merge 2 commits intocockpit-project:mainfrom
Open
apps: Support empty lang attribute#23079Venefilyn wants to merge 2 commits intocockpit-project:mainfrom
Venefilyn wants to merge 2 commits intocockpit-project:mainfrom
Conversation
9d00c0a to
287191b
Compare
allisonkarlitskaya
requested changes
Apr 10, 2026
Member
allisonkarlitskaya
left a comment
There was a problem hiding this comment.
I feel like the "choose the element with no language tag" should also apply to the case that lang is None? ie: we probably want to loop in that case as well now, and select the "no language" item and return it.
A comment at the bottom "in case we don't find the requested language or an element without a language tag, we use the first tag as a final fallback" might be useful.
It might also be useful to add typing here, in general because it's nice, but specifically since it would force us to reason about the possibility that xml.find() returns None...
Member
|
... also, those test fails seem possibly relevant. |
287191b to
11e59c9
Compare
When we look for a specific language for an element in AppStream, such as Summary or Description, we first try to find the requested language otherwise we fallback to the first element we found. As the first item might not be the default language in some cases we could get a format like this <summary xml:lang="fr">Gestionnaire d'abonnement dans Cockpit</summary> <summary>Subscription Manager in Cockpit</summary> <summary xml:lang="it">Gestore abbonamenti nel Cockpit</summary> <summary xml:lang="ja">Cockpit のサブスクリプションマネージャー</summary> <summary xml:lang="ka">გამოწერების მმართველი Cockpit-ში</summary> <summary xml:lang="ko">Cockpit 서브스크립션 관리자</summary> <summary xml:lang="ru">Менеджер подписок в Cockpit</summary> <summary xml:lang="zh-Hans-CN">Cockpit 中的订阅管理器</summary> In this case we'd choose the first summary found which would be French instead of English. Instead, we can first look for the language we want, and if we found an element without language attribute we use that as a fallback. If both fail we still fallback to the first element found. Signed-off-by: Freya Gustavsson <freya@venefilyn.se>
Due to frequent timeouts during testing lets increase the timeout to make sure it has time to update before the timeout. Signed-off-by: Freya Gustavsson <freya@venefilyn.se>
11e59c9 to
b1c7556
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When we look for a specific language for an element in AppStream, such
as Summary or Description, we first try to find the requested language
otherwise we fallback to the first element we found.
As the first item might not be the default language in some cases we
could get a format like this
In this case we'd choose the first summary found which would be French
instead of English.
Instead, we can first look for the language we want, and if we found an
element without language attribute we use that as a fallback. If both
fail we still fallback to the first element found.
Signed-off-by: Freya Gustavsson freya@venefilyn.se