appcenter icon indicating copy to clipboard operation
appcenter copied to clipboard

Update Flathub search URL to new format with locale support

Open srueegger opened this issue 1 month ago • 3 comments

The Flathub website has been redesigned with a new URL structure for search. This updates the dynamic search link to use the new format: https://flathub.org/{locale}/apps/search?q={query}

The system locale is automatically detected and the language code is extracted (e.g., "de" from "de_DE.UTF-8") to provide localized search results. Falls back to "en" if locale cannot be determined.

srueegger avatar Nov 20 '25 16:11 srueegger

What if we do when the system locale isn't available on Flathub website? 🤔

ryonakano avatar Nov 21 '25 03:11 ryonakano

@ryonakano That's a good question that I hadn't thought of. Currently, you also get an Error 404 if the language is not available on Flathub.

I see two possible solutions:

  1. Here is a list of all available languages: https://flathub.org/en/languages

We can create a config file with the languages and use an if query to check whether the OS language matches one of the languages – if so, everything is fine; if not, simply fall back to English. The disadvantage of this solution is that we will have to keep updating this config file.

  1. We send a quick request to the URL using curl. If we receive a 404 status code, we use EN as a fallback. The disadvantage of this solution is that we establish a connection to Flathub from the computer without the user being aware of it.

Do you see any other options, and which solution would you prefer?

srueegger avatar Nov 26 '25 06:11 srueegger

We could open a feature request to the flathub website to handle this for us :man_shrugging:

tintou avatar Nov 26 '25 08:11 tintou