Skip to content

Move hardcoded text into JSON resources - #22

Merged
TolisSth merged 3 commits into
open-source-uom:mainfrom
YatesMold:json-cleanup
Sep 20, 2026
Merged

TolisSth merged 3 commits into
open-source-uom:mainfrom
YatesMold:json-cleanup

Conversation

@YatesMold

Copy link
Copy Markdown
Contributor

Summary

Moves UniDesk's user-facing text out of Python and into JSON files under
src/unidesk/resources/text_data/, loaded through a small text_data.py
module via importlib.resources. This is a pure data move: identical
behavior and rendering before and after, verified mechanically (see below).

Closes #19

What moved

File Contents
navigation.json nav button labels and footer links
pages.json the five prose page bodies, in display order
faq.json FAQ as structured {question, answer} entries
links.json the Links page (7 entries)
credits.json contributors
ui_strings.json about 20 interface strings (buttons, titles, hero text, academic-profile labels)

pages.py, credits.py, and links.py are deleted. setup.py gained a
package_data entry so the JSON actually ships in the built wheel/.deb;
previously nothing did, since package_data was never declared at all.

The FAQ is the one place the shape of the data changed: it's now structured
objects instead of one flattened string. The loader flattens it back to the
exact original string at load time, so the widget code that renders it was
never touched. The round-trip was verified programmatically, not just by eye.

What did not move

  • UNIVERSITIES in academic_institutions.py: stays in Python. Its file
    comment states it must stay in sync with UniBackpack's hardcoded C++ values.
  • The app icon: stays at the repo-root resources/. Moving it into the
    package would break PKGBUILD's install step and main.py's existing
    fallback path.

@TolisSth

Copy link
Copy Markdown
Contributor

Alright, good PR in general. A few things to check:

  • This will be need to go to JSON too, because we are not going for UniBackpack to better the quality of UniDesk.
    UNIVERSITIES = {
        "Aristotle University of Thessaloniki": ["Informatics", "Physics"],
        "University of Western Macedonia": ["Informatics", "Mechanical Engineering"],
        "University of Macedonia": ["Applied Informatics", "Economics"],
    }
    Also, UniNews which is being refactored right now is going to need that more than UniBackpack so let's do that.
  • If you want to have a module level src/unidesk/resources let's rename resources to something like assets.

@TolisSth
TolisSth merged commit 56a5651 into open-source-uom:main Sep 20, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move texx data structures to JSON

2 participants