From 4dcf1136492370dd6367763166beed55af146904 Mon Sep 17 00:00:00 2001 From: Flare Starfall Date: Mon, 9 Mar 2026 01:31:17 +0100 Subject: [PATCH] Fix CRLF on script and continue working on translations --- VERSION.md | 1 + app.py | 9 ++++++--- babel.cfg | 4 ++-- babel.fish | 25 ++++++++++++++++++++++--- starfall/web/blueprints/main.py | 2 +- web/templates/404.jinja | 15 --------------- web/templates/errors/not_found.jinja | 14 ++++++++++++++ 7 files changed, 46 insertions(+), 24 deletions(-) create mode 100644 VERSION.md delete mode 100644 web/templates/404.jinja create mode 100644 web/templates/errors/not_found.jinja diff --git a/VERSION.md b/VERSION.md new file mode 100644 index 0000000..3c5942d --- /dev/null +++ b/VERSION.md @@ -0,0 +1 @@ +0.1.0-alpha.2 \ No newline at end of file diff --git a/app.py b/app.py index 467e9e7..3ad1ecf 100644 --- a/app.py +++ b/app.py @@ -11,8 +11,6 @@ from starfall.log import Log from starfall.types import SnapshotQueue from starfall.web import WebUI -CURRENT_VERSION = "0.1.0-alpha.2" - @final class Application: @@ -30,7 +28,7 @@ class Application: "OS Type: %s\nWorking Directory: %s\nApplication version: %s", os.name, os.path.realpath(os.curdir), - CURRENT_VERSION, + self.version(), ) self.config = Config("config.toml", "config-sample.toml") @@ -49,6 +47,11 @@ class Application: self.app = WebUI() + def version(self): + with open("VERSION.md", "r") as file: + version = file.readline() + return version + def run(self): """ Starts all threads and monitors their active state. diff --git a/babel.cfg b/babel.cfg index c064df6..238c801 100644 --- a/babel.cfg +++ b/babel.cfg @@ -1,5 +1,5 @@ [jinja2: **/templates/**.jinja] -extensions=webassets.ext.jinja2.AssetsExtension silent=false -[python: **.py] \ No newline at end of file +[python: **.py] +silent=false \ No newline at end of file diff --git a/babel.fish b/babel.fish index 06cf841..1ab2d45 100755 --- a/babel.fish +++ b/babel.fish @@ -30,9 +30,9 @@ function compile_pot echo "Compiling POT file..." set_color normal - set -l version "$(cat VERSION.md)" + set -l tl_version "$(cat VERSION.md)" command pybabel extract -F babel.cfg -k lazy_gettext -o messages.pot --add-location full \ - --project Starfall --version "$version" \ + --project Starfall --version "$tl_version" \ --copyright-holder "Flare Starfall" --msgid-bugs-address "flare@theflare.at" . if test -d translations @@ -92,7 +92,26 @@ function compile_po echo end -source .venv/bin/activate.fish +if test -f .venv/bin7activate.fish + source .venv/bin/activate.fish +end + +if test -f .venv/Scripts/activate.fish + source .venv/Scripts/activate.fish +end + +set_color brgreen +echo -n "pybabel version >>> " +set_color normal +command pybabel --version + +if test $status -ne 0 + set_color brred + echo "Could not read pybabel - Please check venv" + set_color normal + return 1 +end + while true display_help read -p "set_color green; echo -n \"Please enter operation >>> \"; set_color normal" -n 1 -l confirm diff --git a/starfall/web/blueprints/main.py b/starfall/web/blueprints/main.py index fb58cab..fef6009 100644 --- a/starfall/web/blueprints/main.py +++ b/starfall/web/blueprints/main.py @@ -24,7 +24,7 @@ class MainBlueprint(BaseBlueprint): def not_found(self, e: Any): self.error: Any = e return render_template( - "404.jinja", + "errors/not_found.jinja", bp=self, lang=get_locale(), ), 404 diff --git a/web/templates/404.jinja b/web/templates/404.jinja deleted file mode 100644 index 7693ca7..0000000 --- a/web/templates/404.jinja +++ /dev/null @@ -1,15 +0,0 @@ -{%extends 'base.jinja'%} - -{%block title%}404{%endblock%} - -{%block body%} -
-
-

404 (Not Found)

-
-

The location you navigated to doesn't exist.

-

Go back to the start and try again?

-
-
-
-{%endblock%} \ No newline at end of file diff --git a/web/templates/errors/not_found.jinja b/web/templates/errors/not_found.jinja new file mode 100644 index 0000000..6ea119a --- /dev/null +++ b/web/templates/errors/not_found.jinja @@ -0,0 +1,14 @@ +{%extends 'base.jinja'%} + +{%block title%}404{%endblock%} + +{%block body%} +
+
+

{{_('error.404.title')}}

+
+

{{_('error.404.body')}}

+
+
+
+{%endblock%} \ No newline at end of file