diff --git a/.gitignore b/.gitignore index ced5f7e..5bb154a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ # cache **/__pycache__ +# translations +**.mo +**.pot + # config .vscode/ diff --git a/README.md b/README.md index 4963e96..e0f8a87 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ git clone https://github.com/partitioncloud/partitioncloud-server.git cd partitioncloud-server # Install dependencies pip install -r requirements.txt +pybabel compile -d partitioncloud/translations # Create database and folders ./make.sh init ``` @@ -66,6 +67,30 @@ Modifier le fichier de configuration créé dans `instance/` ![Recherche](https://github.com/partitioncloud/partitioncloud-server/assets/67148092/745bf3e3-37e9-40cd-80d2-14670bce1a45) +## Translations + +### Créer une nouvelle traduction + +```bash +# Extraire les données +pybabel extract -F babel.cfg -k _l -o partitioncloud/translations/messages.pot . +# Créer un nouveau fichier +pybabel init -i partitioncloud/translations/messages.pot -d partitioncloud/translations/ -l $COUNTRY_CODE +# Modifier translations/$COUNTRY_CODE/LC_MESSAGES/messages.po +# Ajouter $COUNTRY_CODE dans default_config.py: LANGUAGES +# Compiler les nouvelles translations avant de démarrer le serveur +pybabel compile -d partitioncloud/translations/ +``` + +### Mettre à jour une traduction + +```bash +# Récupérer les données les plus récentes +pybabel extract -F babel.cfg -k _l -o partitioncloud/translations/messages.pot . +# Les ajouter aux traductions +pybabel update -i partitioncloud/translations/messages.pot -d partitioncloud/translations/ +``` + ## TODO - [ ] Modifier son mot de passe - [ ] Supprimer un utilisateur diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000..97ebeb8 --- /dev/null +++ b/babel.cfg @@ -0,0 +1,2 @@ +[python: partitioncloud/**.py] +[jinja2: partitioncloud/templates/**.html] \ No newline at end of file diff --git a/default_config.py b/default_config.py index 253e482..d13ae2e 100644 --- a/default_config.py +++ b/default_config.py @@ -26,4 +26,7 @@ MAX_AGE=31 INSTANCE_PATH="instance" # Events to log -ENABLED_LOGS=["NEW_GROUPE", "NEW_ALBUM", "NEW_PARTITION", "NEW_USER", "SERVER_RESTART", "FAILED_LOGIN"] \ No newline at end of file +ENABLED_LOGS=["NEW_GROUPE", "NEW_ALBUM", "NEW_PARTITION", "NEW_USER", "SERVER_RESTART", "FAILED_LOGIN"] + +# Available languages +LANGUAGES=['en', 'fr'] \ No newline at end of file diff --git a/make.sh b/make.sh index 566b605..7f22af3 100755 --- a/make.sh +++ b/make.sh @@ -25,30 +25,50 @@ init () { echo "Utilisateur root:root ajouté" } +translations () { + # Rajouter les chaînes non traduites + pybabel extract -F babel.cfg -k _l -o partitioncloud/translations/messages.pot . + pybabel update -i partitioncloud/translations/messages.pot -d partitioncloud/translations/ + # Compiler + pybabel compile -d partitioncloud/translations/ +} + start () { + pybabel compile -d partitioncloud/translations/ flask run --port=$PORT } production () { + pybabel compile -d partitioncloud/translations/ FLASK_APP=partitioncloud /usr/bin/gunicorn \ wsgi:app \ --bind 0.0.0.0:$PORT } +load_config () { + # Load variables PORT and INSTANCE_PATH + eval $(cat $1 | grep -E "^PORT=") + eval $(cat $1 | grep -E "^INSTANCE_PATH=") +} + usage () { echo "Usage:" echo -e "\t$0 init" echo -e "\t$0 start" + echo -e "\t$0 production" + echo -e "\t$0 translations" } -if [[ $1 && $(type "$1") = *"is a"*"function"* || $(type "$1") == *"est une fonction"* ]]; then + +RESULT=$(type "$1") +if [[ $1 && $RESULT = *"is a"*"function"* || $RESULT == *"est une fonction"* ]]; then # Import config - source "default_config.py" - [[ ! -x "$INSTANCE_PATH/config.py" ]] && source "$INSTANCE_PATH/config.py" + load_config "default_config.py" + [[ ! -x "$INSTANCE_PATH/config.py" ]] && load_config "$INSTANCE_PATH/config.py" $1 ${*:2} # Call the function else usage - echo $(type "$1") + echo $RESULT exit 1 fi diff --git a/partitioncloud/__init__.py b/partitioncloud/__init__.py index dacea5f..afbf031 100644 --- a/partitioncloud/__init__.py +++ b/partitioncloud/__init__.py @@ -10,6 +10,7 @@ import importlib.util from flask import Flask, g, redirect, render_template, request, send_file, flash, session, abort from werkzeug.security import generate_password_hash +from flask_babel import Babel, _ from .modules.utils import User, Album, get_all_albums from .modules import albums, auth, partition, admin, groupe, thumbnails, logging @@ -18,6 +19,12 @@ from .modules.db import get_db app = Flask(__name__) +def get_locale(): + return request.accept_languages.best_match(app.config['LANGUAGES']) + +babel = Babel(app, locale_selector=get_locale) + + def load_config(): app.config.from_object('default_config') @@ -125,10 +132,10 @@ def add_user(): try: if album_uuid != "": user.join_album(album_uuid) - flash(f"Utilisateur {username} créé") + flash(_("Created user %(username)s", username=username)) return redirect("/albums") except LookupError: - flash(f"Cet album n'existe pas. L'utilisateur {username} a été créé") + flash(_("This album does not exists, but user %(username)s has been created", username=username)) return redirect("/albums") flash(error) diff --git a/partitioncloud/modules/albums.py b/partitioncloud/modules/albums.py index 40ca12a..7cb71a4 100644 --- a/partitioncloud/modules/albums.py +++ b/partitioncloud/modules/albums.py @@ -9,6 +9,7 @@ from typing import TypeVar from flask import (Blueprint, abort, flash, redirect, render_template, request, session, current_app) +from flask_babel import _ from .auth import login_required from .db import get_db @@ -37,7 +38,7 @@ def search_page(): Résultats de recherche """ if "query" not in request.form or request.form["query"] == "": - flash("Aucun terme de recherche spécifié.") + flash(_("Missing search query")) return redirect("/albums") query = request.form["query"] @@ -119,7 +120,7 @@ def create_album_req(): user = User(user_id=session["user_id"]) if not name or name.strip() == "": - error = "Un nom est requis. L'album n'a pas été créé" + error = _("Missing name.") if error is None: uuid = utils.create_album(name) @@ -156,10 +157,10 @@ def join_album(uuid): try: user.join_album(uuid) except LookupError: - flash("Cet album n'existe pas.") + flash(_("This album does not exist.")) return redirect(request.referrer) - flash("Album ajouté à la collection.") + flash(_("Album added to collection.")) return redirect(request.referrer) @@ -173,15 +174,15 @@ def quit_album(uuid): album = Album(uuid=uuid) users = album.get_users() if user.id not in [u["id"] for u in users]: - flash("Vous ne faites pas partie de cet album") + flash(_("You are not a member of this album")) return redirect(request.referrer) if len(users) == 1: - flash("Vous êtes seul dans cet album, le quitter entraînera sa suppression.") + flash(_("You are alone here, quitting means deleting this album.")) return redirect(f"/albums/{uuid}#delete") user.quit_album(uuid) - flash("Album quitté.") + flash(_("Album quitted.")) return redirect("/albums") @@ -200,9 +201,9 @@ def delete_album(uuid): error = None users = album.get_users() if len(users) > 1: - error = "Vous n'êtes pas seul dans cet album." + error = _("You are not alone in this album.") elif len(users) == 1 and users[0]["id"] != user.id: - error = "Vous ne possédez pas cet album." + error = _("You don't own this album.") if user.access_level == 1: error = None @@ -213,7 +214,7 @@ def delete_album(uuid): album.delete(current_app.instance_path) - flash("Album supprimé.") + flash(_("Album deleted.")) return redirect("/albums") @@ -236,15 +237,15 @@ def add_partition(album_uuid): source = "upload" # source type: upload, unknown or url if (not user.is_participant(album.uuid)) and (user.access_level != 1): - flash("Vous ne participez pas à cet album.") + flash(_("You are not a member of this album")) return redirect(request.referrer) error = None if "name" not in request.form: - error = "Un titre est requis." + error = _("Missing title") elif "file" not in request.files and "partition-uuid" not in request.form: - error = "Aucun fichier n'a été fourni." + error = _("Missing file") elif "file" not in request.files: partition_type = "uuid" search_uuid = request.form["partition-uuid"] @@ -256,7 +257,7 @@ def add_partition(album_uuid): (search_uuid,) ).fetchone() if data is None: - error = "Les résultats de la recherche ont expiré." + error = _("Search results expired") else: source = data["url"] else: @@ -322,7 +323,7 @@ def add_partition(album_uuid): "status": "ok", "uuid": partition_uuid } - flash(f"Partition {request.form['name']} ajoutée") + flash(_("Score %(partition_name)s added", partition_name=request.form['name'])) return redirect(f"/albums/{album.uuid}") @@ -336,13 +337,13 @@ def add_partition_from_search(): error = None if "album-uuid" not in request.form: - error = "Il est nécessaire de sélectionner un album." + error = _("Selecting an album is mandatory.") elif "partition-uuid" not in request.form: - error = "Il est nécessaire de sélectionner une partition." + error = _("Selecting a score is mandatory.") elif "partition-type" not in request.form: - error = "Il est nécessaire de spécifier un type de partition." + error = _("Please specify a score type.") elif (not user.is_participant(request.form["album-uuid"])) and (user.access_level != 1): - error = "Vous ne participez pas à cet album." + error = _("You are not a member of this album") if error is not None: flash(error) @@ -362,9 +363,9 @@ def add_partition_from_search(): if data is None: album.add_partition(request.form["partition-uuid"]) - flash("Partition ajoutée.") + flash(_("Score added")) else: - flash("Partition déjà dans l'album.") + flash(_("Score is already in the album.")) return redirect(f"/albums/{album.uuid}") @@ -376,5 +377,5 @@ def add_partition_from_search(): user=user ) - flash("Type de partition inconnu.") + flash(_("Unknown score type.")) return redirect("/albums") diff --git a/partitioncloud/modules/auth.py b/partitioncloud/modules/auth.py index 8d08c6e..21c5cf0 100644 --- a/partitioncloud/modules/auth.py +++ b/partitioncloud/modules/auth.py @@ -7,6 +7,7 @@ from typing import Optional from flask import (Blueprint, flash, g, redirect, render_template, request, session, url_for, current_app) +from flask_babel import _ from werkzeug.security import check_password_hash, generate_password_hash @@ -23,7 +24,7 @@ def login_required(view): @functools.wraps(view) def wrapped_view(**kwargs): if g.user is None: - flash("Vous devez être connecté pour accéder à cette page.") + flash(_("You need to login to access this resource.")) return redirect(url_for("auth.login")) return view(**kwargs) @@ -50,12 +51,12 @@ def admin_required(view): @functools.wraps(view) def wrapped_view(**kwargs): if g.user is None: - flash("Vous devez être connecté pour accéder à cette page.") + flash(_("You need to login to access this resource.")) return redirect(url_for("auth.login")) user = User(user_id=session.get("user_id")) if user.access_level != 1: - flash("Droits insuffisants.") + flash(_("Missing rights.")) return redirect("/albums") return view(**kwargs) @@ -81,9 +82,9 @@ def create_user(username: str, password: str) -> Optional[str]: """Adds a new user to the database""" error = None if not username: - error = "Un nom d'utilisateur est requis." + error = _("Missing username.") elif not password: - error = "Un mot de passe est requis." + error = _("Missing password.") try: db = get_db() @@ -96,7 +97,7 @@ def create_user(username: str, password: str) -> Optional[str]: except db.IntegrityError: # The username was already taken, which caused the # commit to fail. Show a validation error. - error = f"Le nom d'utilisateur {username} est déjà pris." + error = _("Username %(username)s is not available.", username=username) return error # may be None @@ -109,7 +110,7 @@ def register(): password for security. """ if current_app.config["DISABLE_REGISTER"]: - flash("L'enregistrement de nouveaux utilisateurs a été désactivé par l'administrateur.") + flash(_("New users registration is disabled by owner.")) return redirect(url_for("auth.login")) if request.method == "POST": @@ -123,7 +124,7 @@ def register(): else: user = User(name=username) - flash("Utilisateur créé avec succès. Vous pouvez vous connecter.") + flash(_("Successfully created new user. You can log in.")) logging.log( [user.username, user.id, False], @@ -148,7 +149,7 @@ def login(): if (user is None) or not check_password_hash(user["password"], password): logging.log([username], logging.LogEntry.FAILED_LOGIN) - error = "Nom d'utilisateur ou mot de passe incorrect." + error = _("Incorrect username or password") if error is None: # store the user id in a new session and return to the index diff --git a/partitioncloud/modules/groupe.py b/partitioncloud/modules/groupe.py index 6991f3a..92bcd2d 100644 --- a/partitioncloud/modules/groupe.py +++ b/partitioncloud/modules/groupe.py @@ -4,6 +4,7 @@ Groupe module """ from flask import (Blueprint, abort, flash, redirect, render_template, request, session, current_app) +from flask_babel import _ from .auth import login_required from .db import get_db @@ -67,7 +68,7 @@ def create_groupe(): user = User(user_id=session["user_id"]) if not name or name.strip() == "": - error = "Un nom est requis. Le groupe n'a pas été créé" + error = _("Missing name.") if error is None: while True: @@ -116,10 +117,10 @@ def join_groupe(uuid): try: user.join_groupe(uuid) except LookupError: - flash("Ce groupe n'existe pas.") + flash(_("Unknown group.")) return redirect(f"/groupe/{uuid}") - flash("Groupe ajouté à la collection.") + flash(_("Group added to collection.")) return redirect(f"/groupe/{uuid}") @@ -130,15 +131,15 @@ def quit_groupe(uuid): groupe = Groupe(uuid=uuid) users = groupe.get_users() if user.id not in [u["id"] for u in users]: - flash("Vous ne faites pas partie de ce groupe") + flash(_("You are not a member of this group.")) return redirect(f"/groupe/{uuid}") if len(users) == 1: - flash("Vous êtes seul dans ce groupe, le quitter entraînera sa suppression.") + flash(_("You are alone here, quitting means deleting this group.")) return redirect(f"/groupe/{uuid}#delete") user.quit_groupe(groupe.uuid) - flash("Groupe quitté.") + flash(_("Group quitted.")) return redirect("/albums") @@ -151,7 +152,7 @@ def delete_groupe(uuid): error = None users = groupe.get_users() if len(users) > 1: - error = "Vous n'êtes pas seul dans ce groupe." + error = _("You are not alone in this group.") if user.access_level == 1 or user.id not in groupe.get_admins(): error = None @@ -162,7 +163,7 @@ def delete_groupe(uuid): groupe.delete(current_app.instance_path) - flash("Groupe supprimé.") + flash(_("Group deleted.")) return redirect("/albums") @@ -181,10 +182,10 @@ def create_album_req(groupe_uuid): error = None if not name or name.strip() == "": - error = "Un nom est requis. L'album n'a pas été créé" + error = _("Missing name.") if user.id not in groupe.get_admins(): - error ="Vous n'êtes pas administrateur de ce groupe" + error = _("You are not admin of this group.") if error is None: uuid = utils.create_album(name) diff --git a/partitioncloud/modules/logging.py b/partitioncloud/modules/logging.py index 472022e..162c4a5 100644 --- a/partitioncloud/modules/logging.py +++ b/partitioncloud/modules/logging.py @@ -30,7 +30,7 @@ class LogEntry(Enum): def add_entry(entry: str) -> None: - date = datetime.now().strftime("%y-%b-%Y %H:%M:%S") + date = datetime.now().strftime('%y-%b-%Y %H:%M:%S') with open(log_file, 'a', encoding="utf8") as f: f.write(f"[{date}] {entry}\n") diff --git a/partitioncloud/modules/partition.py b/partitioncloud/modules/partition.py index 700b221..d560f0c 100644 --- a/partitioncloud/modules/partition.py +++ b/partitioncloud/modules/partition.py @@ -6,6 +6,7 @@ import os from uuid import uuid4 from flask import (Blueprint, abort, send_file, render_template, request, redirect, flash, session, current_app) +from flask_babel import _ from .db import get_db from .auth import login_required, admin_required @@ -54,12 +55,12 @@ def add_attachment(uuid): user = User(user_id=session.get("user_id")) if user.id != partition.user_id and user.access_level != 1: - flash("Cette partition ne vous current_appartient pas") + flash(_("You don't own this score.")) return redirect(request.referrer) error = None # À mettre au propre if "file" not in request.files: - error = "Aucun fichier n'a été fourni." + error = _("Missing file") else: if "name" not in request.form or request.form["name"] == "": name = ".".join(request.files["file"].filename.split(".")[:-1]) @@ -67,12 +68,12 @@ def add_attachment(uuid): name = request.form["name"] if name == "": - error = "Pas de nom de fichier" + error = _("Missing filename.") else: filename = request.files["file"].filename ext = filename.split(".")[-1] if ext not in ["mid", "mp3"]: - error = "Extension de fichier non supportée" + error = _("Unsupported file type.") if error is not None: flash(error) @@ -140,7 +141,7 @@ def edit(uuid): user = User(user_id=session.get("user_id")) if user.access_level != 1 and partition.user_id != user.id: - flash("Vous n'êtes pas autorisé à modifier cette partition.") + flash(_("You are not allowed to edit this file.")) return redirect("/albums") if request.method == "GET": @@ -149,11 +150,11 @@ def edit(uuid): error = None if "name" not in request.form or request.form["name"].strip() == "": - error = "Un titre est requis." + error = _("Missing title") elif "author" not in request.form: - error = "Un nom d'auteur est requis (à minima nul)" + error = _("Missing author in request body (can be null).") elif "body" not in request.form: - error = "Des paroles sont requises (à minima nulles)" + error = _("Missing lyrics (can be null).") if error is not None: flash(error) @@ -165,7 +166,7 @@ def edit(uuid): body=request.form["body"] ) - flash(f"Partition {request.form['name']} modifiée avec succès.") + flash(_("Successfully modified %(name)s", name=request.form['name'])) return redirect("/albums") @@ -195,11 +196,11 @@ def details(uuid): error = None if "name" not in request.form or request.form["name"].strip() == "": - error = "Un titre est requis." + error = _("Missing title") elif "author" not in request.form: - error = "Un nom d'auteur est requis (à minima nul)" + error = _("Missing author in request body (can be null).") elif "body" not in request.form: - error = "Des paroles sont requises (à minima nulles)" + error = _("Missing lyrics (can be null).") if error is not None: flash(error) @@ -211,7 +212,7 @@ def details(uuid): body=request.form["body"] ) - flash(f"Partition {request.form['name']} modifiée avec succès.") + flash(_("Successfully modified %(name)s", name=request.form['name'])) return redirect("/albums") @@ -226,7 +227,7 @@ def delete(uuid): user = User(user_id=session.get("user_id")) if user.access_level != 1 and partition.user_id != user.id: - flash("Vous n'êtes pas autorisé à supprimer cette partition.") + flash(_("You are not allowed to delete this score.")) return redirect("/albums") if request.method == "GET": @@ -234,7 +235,7 @@ def delete(uuid): partition.delete(current_app.instance_path) - flash("Partition supprimée.") + flash(_("Score deleted.")) return redirect("/albums") diff --git a/partitioncloud/templates/admin/index.html b/partitioncloud/templates/admin/index.html index 6dcb070..dff4f68 100644 --- a/partitioncloud/templates/admin/index.html +++ b/partitioncloud/templates/admin/index.html @@ -2,27 +2,27 @@ {% block content %} -

{% block title %}Panneau d'administration{% endblock %}

+

{% block title %}{{ _("Administration Panel") }}{% endblock %}

-
Nouvel utilisateur
+
{{ _("New user") }}
-
Voir les partitions
+
{{ _("See scores") }}
-
Voir les logs
+
{{ _("See logs") }}
- - - - + + + + diff --git a/partitioncloud/templates/admin/logs.html b/partitioncloud/templates/admin/logs.html index 308c0c3..e0b9364 100644 --- a/partitioncloud/templates/admin/logs.html +++ b/partitioncloud/templates/admin/logs.html @@ -2,7 +2,7 @@ {% extends 'base.html' %} {% block header %} -

{% block title %}Logs{% endblock %}

+

{% block title %}{{ _("Logs") }}{% endblock %}

{% endblock %} {% block content %} diff --git a/partitioncloud/templates/admin/partitions.html b/partitioncloud/templates/admin/partitions.html index 928f7b0..da4170d 100644 --- a/partitioncloud/templates/admin/partitions.html +++ b/partitioncloud/templates/admin/partitions.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block header %} -

{% block title %}Liste des partitions{% endblock %}

+

{% block title %}{{ _("Scores list") }}{% endblock %}

{% endblock %} {% block content %} @@ -28,6 +28,6 @@ {% endfor %} {% else %} -
Aucune partition disponible
+
{{ _("No available scores") }}
{% endif %} {% endblock %} \ No newline at end of file diff --git a/partitioncloud/templates/albums/add-partition.html b/partitioncloud/templates/albums/add-partition.html index 49b574f..97c672e 100644 --- a/partitioncloud/templates/albums/add-partition.html +++ b/partitioncloud/templates/albums/add-partition.html @@ -1,15 +1,7 @@ {% extends 'base.html' %} -{% block title %}Ajout de partition{% endblock %} +{% block title %}{{ _("New score") }}{% endblock %} {% block content %} -

Ajouter une partition à {{ album.name }}

- - -
-
-
- - - + {% include 'components/add_partition.html' %} {% endblock %} \ No newline at end of file diff --git a/partitioncloud/templates/albums/album.html b/partitioncloud/templates/albums/album.html index df5a6b0..7461ed6 100644 --- a/partitioncloud/templates/albums/album.html +++ b/partitioncloud/templates/albums/album.html @@ -5,22 +5,15 @@ {% block dialogs %} -

Ajouter une partition à {{ album.name }}

-
-
-
-
-
- - + {% include 'components/add_partition.html' %} Close
-

Supprimer l'album

- Êtes vous sûr de vouloir supprimer cet album ? +

{{ _("Delete l'album") }}

+ {{ _("Do you really want to delete this album?") }}

- + Close
@@ -38,7 +31,7 @@ {% block content %}

- {% if groupe %}{{ groupe.name}} / + {% if groupe %}{{ groupe.name }} / {% endif %} {{ album.name }}

@@ -55,16 +48,16 @@ + @@ -98,6 +91,6 @@ {% else %}
-
Aucune partition disponible
+
{{ _("No available scores") }}
{% endif %} {% endblock %} diff --git a/partitioncloud/templates/albums/delete-album.html b/partitioncloud/templates/albums/delete-album.html index 83b22d5..211e35b 100644 --- a/partitioncloud/templates/albums/delete-album.html +++ b/partitioncloud/templates/albums/delete-album.html @@ -1,14 +1,14 @@ {% extends 'base.html' %} -{% block title %}Supprimer {{ album.name }}{% endblock %} +{% block title %}{{ _("Delete %(name)s", name=album.name) }}{% endblock %} {% block content %} -Êtes vous sûr de vouloir supprimer cet album ? +{{ _("Do you really want to delete this album?") }}
- + - + {% endblock %} \ No newline at end of file diff --git a/partitioncloud/templates/albums/index.html b/partitioncloud/templates/albums/index.html index faf3661..3f45655 100644 --- a/partitioncloud/templates/albums/index.html +++ b/partitioncloud/templates/albums/index.html @@ -1,10 +1,13 @@ {% extends 'base.html' %} -{% block title %}Home{% endblock %} +{% block title %}{{ _("Home") }}{% endblock %} {% block content %}
-Bonjour {{ user.username }} !
-Aucun album sélectionné +{% set user_name %} +{{ user.username }} +{% endset %} +{{ _("Hi %(user_name)s !", user_name=user_name) }}
+{{ _("No album selected") }}
{% endblock %} \ No newline at end of file diff --git a/partitioncloud/templates/albums/search.html b/partitioncloud/templates/albums/search.html index cb50a0c..537df1e 100644 --- a/partitioncloud/templates/albums/search.html +++ b/partitioncloud/templates/albums/search.html @@ -2,9 +2,9 @@ {% block content %} -

{% block title %}Résultats de la recherche "{{ query }}"{% endblock %}

+

{% block title %}{{ _('Search results for "%(query)s"', query=query)}}{% endblock %}

{% if partitions|length != 0 %} -

Résultats dans la bibliothèque locale

+

{{ _("Results in current database") }}

{% for partition in partitions %}
@@ -35,14 +35,14 @@ - +
{% endfor %}
{% endif %} {% if google_results|length != 0 %} -

Résultats de la recherche en ligne

+

{{ _("Online search results") }}

{% for partition in google_results %}
@@ -67,13 +67,13 @@ - +
{% endfor %}
{% endif %} {% if google_results|length == 0 and partitions|length == 0 %} -Aucun résultat. Essayez d'augmenter le nombre de recherches en ligne ou d'affiner votre recherche. +{{ _("No results available. Try to tweak your query or increase the amount of online searches.") }} {% endif %} {% endblock %} \ No newline at end of file diff --git a/partitioncloud/templates/auth/login.html b/partitioncloud/templates/auth/login.html index 9051e1d..b80991e 100644 --- a/partitioncloud/templates/auth/login.html +++ b/partitioncloud/templates/auth/login.html @@ -2,11 +2,11 @@ {% block content %} -

{% block title %}Connexion{% endblock %}

+

{% block title %}{{ _("Log in") }}{% endblock %}

-
-
- +
+
+ {% endblock %} \ No newline at end of file diff --git a/partitioncloud/templates/auth/register.html b/partitioncloud/templates/auth/register.html index 779c4d6..da8d138 100644 --- a/partitioncloud/templates/auth/register.html +++ b/partitioncloud/templates/auth/register.html @@ -2,21 +2,21 @@ {% block content %} -

{% block title %}Créer un compte{% endblock %}

+

{% block title %}{{ _("Create account") }}{% endblock %}

{% if g.user.access_level == 1 %} -
+

{% endif %} -
-
- +
+
+ {% endblock %} \ No newline at end of file diff --git a/partitioncloud/templates/base.html b/partitioncloud/templates/base.html index 7e92392..3f3a208 100644 --- a/partitioncloud/templates/base.html +++ b/partitioncloud/templates/base.html @@ -20,21 +20,21 @@ {% block dialogs %}{% endblock %} {% if g.user %} -

Créer un nouvel album

+

{{ _("New Album") }}

-
- +
+

- Je souhaite créer plusieurs albums et pouvoir tous les partager avec un seul lien. Créer un groupe. + {{ _("I want to create a collection of albums.") }} {{ _("Create group") }}. Close
-

Créer un nouveau groupe

+

{{ _("Create new group") }}

-
- +
+ Close
@@ -58,9 +58,9 @@ diff --git a/partitioncloud/templates/components/add_partition.html b/partitioncloud/templates/components/add_partition.html new file mode 100644 index 0000000..71567e8 --- /dev/null +++ b/partitioncloud/templates/components/add_partition.html @@ -0,0 +1,13 @@ +

{{ _("Add a score to %(name)s", name=album.name) }}

+ +
+
+
+
+ {% if partition_uuid %} + + {% else %} +
+ {% endif %} + + \ No newline at end of file diff --git a/partitioncloud/templates/groupe/index.html b/partitioncloud/templates/groupe/index.html index e308a53..1d42f26 100644 --- a/partitioncloud/templates/groupe/index.html +++ b/partitioncloud/templates/groupe/index.html @@ -5,20 +5,19 @@ {% block dialogs %} -

Créer un nouvel album dans le groupe {{ groupe.name }}

+

{{ _("Add an album to group %(name)s", name=groupe.name) }}

-
- +
+ Close
-

Supprimer le groupe

- Êtes vous sûr de vouloir supprimer ce groupe ? Cela supprimera les albums - sous-jacents et leurs partitions si personne ne les a rejoints (indépendamment du groupe). +

{{ _("Delete group") }}

+ {{ _("Do you really want to delete this group and the albums it contains?") }}

- + Close
@@ -44,14 +43,14 @@ + @@ -71,6 +70,11 @@ {% else %}
-
Aucun album disponible. En créer un
+{% set create %} + {{ _("Create one") }} +{% endset %} +
+ {{ _("No available album. %(create)s", create=create) }} +
{% endif %} {% endblock %} \ No newline at end of file diff --git a/partitioncloud/templates/partition/attachments.html b/partitioncloud/templates/partition/attachments.html index f2fd448..a2ff5e9 100644 --- a/partitioncloud/templates/partition/attachments.html +++ b/partitioncloud/templates/partition/attachments.html @@ -2,15 +2,15 @@ {% extends 'base.html' %} -{% block title %}Attachments de {{ partition.name }}{% endblock %} +{% block title %}{{ _("Attachments of %(name)s", name=partition.name) }}{% endblock %} {% block dialogs %} -

Ajouter un attachment à {{ partition.name }}

+

{{ _("Add an attachment to %(name)s", name=partition.name) }}

-
+

- + Close
@@ -19,8 +19,8 @@ {% block content %}

- Impossible d'afficher le pdf dans ce navigateur. - Il est conseillé d'utiliser Firefox sur Android. + {{ _("No pdf viewer available in this browser. + You can use Firefox on Android.") }}

@@ -43,7 +43,7 @@ src="/partition/attachment/{{ attachment.uuid }}.mid" sound-font visualizer="#midi-visualizer" data-js-focus-visible> - +
{% endif %} @@ -57,7 +57,7 @@
{% if user %}
- +
{% endif %} {% endblock %} diff --git a/partitioncloud/templates/partition/delete.html b/partitioncloud/templates/partition/delete.html index 1d3af3f..868cae3 100644 --- a/partitioncloud/templates/partition/delete.html +++ b/partitioncloud/templates/partition/delete.html @@ -1,16 +1,16 @@ {% extends 'base.html' %} {% block header %} -

{% block title %}Supprimer {{ partition.name }}{% endblock %}

+

{% block title %}{{ _("Delete %(name)s", name=partition.name) }}{% endblock %}

{% endblock %} {% block content %} -Êtes vous sûr de vouloir supprimer cette partition ? +{{ _("Do you really want to delete this score?") }} - + - + {% endblock %} \ No newline at end of file diff --git a/partitioncloud/templates/partition/details.html b/partitioncloud/templates/partition/details.html index 863fcc1..f637f52 100644 --- a/partitioncloud/templates/partition/details.html +++ b/partitioncloud/templates/partition/details.html @@ -1,15 +1,15 @@ {% extends 'base.html' %} {% block content %} -

{% block title %}Détails "{{ partition.name }}"{% endblock %}

-
+

{% block title %}{{ _('Details of "%(name)s"', name=partition.name)}}{% endblock %}

+
UtilisateurAlbumsPartitionsPrivilèges{{ _("User") }}{{ _("Albums") }}{{ _("Scores") }}{{ _("Admin privileges") }}
🎵 {{ attachment.name }}
- + - - + + - - + + - - + + - - {% set _ = partition.load_attachments() %} + + {{ partition.load_attachments() }}
- Responsable de l'ajout + {{ _("Added by") }} {% if user is not none %} @@ -20,13 +20,13 @@ {% else %} - inconnu + {{ _("Unknown") }} {% endif %}
- Type d'ajout + {{ _("Type") }} {% if partition.source == "unknown" or partition.source == "upload" %} @@ -38,7 +38,7 @@
- Albums + {{ _("Albums") }}
    @@ -49,40 +49,41 @@
Fichier{{ _("File") }}
Titre
{{ _("Title") }}
Auteur
{{ _("Author") }}
Paroles
{{ _("Lyrics") }}
Pièces jointes{{ _("Attachments") }} {% if partition.attachments %} - Oui, {{ partition.attachments | length }} + {% set number=partition.attachments | length %} + {{ _("Yes, %(number)s", number=number) }} {% else %} - En rajouter + {{ _("Add one") }} {% endif %}
- + - + {% endblock %} \ No newline at end of file diff --git a/partitioncloud/templates/partition/edit.html b/partitioncloud/templates/partition/edit.html index b5ad78a..b5179a6 100644 --- a/partitioncloud/templates/partition/edit.html +++ b/partitioncloud/templates/partition/edit.html @@ -3,14 +3,14 @@ {% block content %} -

{% block title %}Modifier "{{ partition.name }}"{% endblock %}

+

{% block title %}{{ _("Modify \"%(name)s\"", name=partition.name) }}{% endblock %}


- + @@ -18,7 +18,7 @@ {% if partition.source != "unknown" and partition.source != "upload" %} {% endif %} - - + + - - + + - - + + - - {% set _ = partition.load_attachments() %} + + {{ partition.load_attachments() }}
Fichier{{ _("File") }}
- Source + {{ _("Source") }} {{ partition.source.split("/")[2] }} @@ -26,34 +26,35 @@
Titre
{{ _("Title") }}
Auteur
{{ _("Author") }}
Paroles
{{ _("Lyrics") }}
Pièces jointes{{ _("Attachments") }} {% if partition.attachments %} - Oui, {{ partition.attachments | length }} + {% set number=partition.attachments | length %} + {{ _("Yes, %(number)s", number=number) }} {% else %} - En rajouter + {{ _("Add one") }} {% endif %}
- +
- + {% endblock %} \ No newline at end of file diff --git a/partitioncloud/translations/en/LC_MESSAGES/messages.po b/partitioncloud/translations/en/LC_MESSAGES/messages.po new file mode 100644 index 0000000..9a433a1 --- /dev/null +++ b/partitioncloud/translations/en/LC_MESSAGES/messages.po @@ -0,0 +1,599 @@ +# English translations for PROJECT. +# Copyright (C) 2024 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2024. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2024-01-25 16:19+0100\n" +"PO-Revision-Date: 2024-01-22 15:38+0100\n" +"Last-Translator: FULL NAME \n" +"Language: en\n" +"Language-Team: en \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.14.0\n" + +#: partitioncloud/__init__.py:135 +#, python-format +msgid "Created user %(username)s" +msgstr "Created user %(username)s" + +#: partitioncloud/__init__.py:138 +#, python-format +msgid "This album does not exists, but user %(username)s has been created" +msgstr "This album does not exists, but user %(username)s has been created" + +#: partitioncloud/modules/albums.py:41 +msgid "Missing search query" +msgstr "Missing search query" + +#: partitioncloud/modules/albums.py:123 partitioncloud/modules/groupe.py:71 +#: partitioncloud/modules/groupe.py:185 +msgid "Missing name." +msgstr "Missing name." + +#: partitioncloud/modules/albums.py:160 +msgid "This album does not exist." +msgstr "This album does not exist." + +#: partitioncloud/modules/albums.py:163 +msgid "Album added to collection." +msgstr "Album added to collection." + +#: partitioncloud/modules/albums.py:177 partitioncloud/modules/albums.py:240 +#: partitioncloud/modules/albums.py:346 +msgid "You are not a member of this album" +msgstr "You are not a member of this album" + +#: partitioncloud/modules/albums.py:181 +msgid "You are alone here, quitting means deleting this album." +msgstr "You are alone here, quitting means deleting this album." + +#: partitioncloud/modules/albums.py:185 +msgid "Album quitted." +msgstr "Album quitted." + +#: partitioncloud/modules/albums.py:204 +msgid "You are not alone in this album." +msgstr "You are not alone in this album." + +#: partitioncloud/modules/albums.py:206 +msgid "You don't own this album." +msgstr "You don't own this album." + +#: partitioncloud/modules/albums.py:217 +msgid "Album deleted." +msgstr "Album deleted." + +#: partitioncloud/modules/albums.py:246 partitioncloud/modules/partition.py:153 +#: partitioncloud/modules/partition.py:199 +msgid "Missing title" +msgstr "Missing title" + +#: partitioncloud/modules/albums.py:248 partitioncloud/modules/partition.py:63 +msgid "Missing file" +msgstr "Missing file" + +#: partitioncloud/modules/albums.py:260 +msgid "Search results expired" +msgstr "Search results expired" + +#: partitioncloud/modules/albums.py:326 +#, python-format +msgid "Score %(partition_name)s added" +msgstr "Score %(partition_name)s added" + +#: partitioncloud/modules/albums.py:340 +msgid "Selecting an album is mandatory." +msgstr "Selecting an album is mandatory." + +#: partitioncloud/modules/albums.py:342 +msgid "Selecting a score is mandatory." +msgstr "Selecting a score is mandatory." + +#: partitioncloud/modules/albums.py:344 +msgid "Please specify a score type." +msgstr "Please specify a score type." + +#: partitioncloud/modules/albums.py:366 +msgid "Score added" +msgstr "Score added" + +#: partitioncloud/modules/albums.py:368 +msgid "Score is already in the album." +msgstr "Score is already in the album." + +#: partitioncloud/modules/albums.py:380 +msgid "Unknown score type." +msgstr "Unknown score type." + +#: partitioncloud/modules/auth.py:27 partitioncloud/modules/auth.py:54 +msgid "You need to login to access this resource." +msgstr "You need to login to access this resource." + +#: partitioncloud/modules/auth.py:59 +msgid "Missing rights." +msgstr "Missing rights." + +#: partitioncloud/modules/auth.py:85 +msgid "Missing username." +msgstr "Missing username." + +#: partitioncloud/modules/auth.py:87 +msgid "Missing password." +msgstr "Missing password." + +#: partitioncloud/modules/auth.py:100 +#, python-format +msgid "Username %(username)s is not available." +msgstr "Username %(username)s is not available." + +#: partitioncloud/modules/auth.py:113 +msgid "New users registration is disabled by owner." +msgstr "New users registration is disabled by owner." + +#: partitioncloud/modules/auth.py:127 +msgid "Successfully created new user. You can log in." +msgstr "Successfully created new user. You can log in." + +#: partitioncloud/modules/auth.py:152 +msgid "Incorrect username or password" +msgstr "Incorrect username or password" + +#: partitioncloud/modules/groupe.py:120 +msgid "Unknown group." +msgstr "Unknown group." + +#: partitioncloud/modules/groupe.py:123 +msgid "Group added to collection." +msgstr "Group added to collection." + +#: partitioncloud/modules/groupe.py:134 +msgid "You are not a member of this group." +msgstr "You are not a member of this group." + +#: partitioncloud/modules/groupe.py:138 +msgid "You are alone here, quitting means deleting this group." +msgstr "You are alone here, quitting means deleting this group." + +#: partitioncloud/modules/groupe.py:142 +msgid "Group quitted." +msgstr "Group quitted." + +#: partitioncloud/modules/groupe.py:155 +msgid "You are not alone in this group." +msgstr "You are not alone in this group." + +#: partitioncloud/modules/groupe.py:166 +msgid "Group deleted." +msgstr "Group deleted." + +#: partitioncloud/modules/groupe.py:188 +msgid "You are not admin of this group." +msgstr "You are not admin of this group." + +#: partitioncloud/modules/partition.py:58 +msgid "You don't own this score." +msgstr "You don't own this score." + +#: partitioncloud/modules/partition.py:71 +msgid "Missing filename." +msgstr "Missing filename." + +#: partitioncloud/modules/partition.py:76 +msgid "Unsupported file type." +msgstr "Unsupported file type." + +#: partitioncloud/modules/partition.py:144 +msgid "You are not allowed to edit this file." +msgstr "You are not allowed to edit this file." + +#: partitioncloud/modules/partition.py:155 +#: partitioncloud/modules/partition.py:201 +msgid "Missing author in request body (can be null)." +msgstr "Missing author in request body (can be null)." + +#: partitioncloud/modules/partition.py:157 +#: partitioncloud/modules/partition.py:203 +msgid "Missing lyrics (can be null)." +msgstr "Missing lyrics (can be null)." + +#: partitioncloud/modules/partition.py:169 +#: partitioncloud/modules/partition.py:215 +#, python-format +msgid "Successfully modified %(name)s" +msgstr "Successfully modified %(name)s" + +#: partitioncloud/modules/partition.py:230 +msgid "You are not allowed to delete this score." +msgstr "You are not allowed to delete this score." + +#: partitioncloud/modules/partition.py:238 +msgid "Score deleted." +msgstr "Score deleted." + +#: partitioncloud/templates/base.html:23 +msgid "New Album" +msgstr "New Album" + +#: partitioncloud/templates/base.html:25 partitioncloud/templates/base.html:36 +#: partitioncloud/templates/groupe/index.html:10 +#: partitioncloud/templates/partition/attachments.html:11 +msgid "Name" +msgstr "Name" + +#: partitioncloud/templates/base.html:26 partitioncloud/templates/base.html:37 +msgid "Create" +msgstr "Create" + +#: partitioncloud/templates/base.html:30 +msgid "I want to create a collection of albums." +msgstr "I want to create a collection of albums." + +#: partitioncloud/templates/base.html:30 +msgid "Create group" +msgstr "Create group" + +#: partitioncloud/templates/base.html:34 +msgid "Create new group" +msgstr "Create new group" + +#: partitioncloud/templates/base.html:61 +msgid "Search" +msgstr "Search" + +#: partitioncloud/templates/base.html:63 +msgid "Number of online searches" +msgstr "Number of online searches" + +#: partitioncloud/templates/admin/index.html:23 +#: partitioncloud/templates/base.html:71 +#: partitioncloud/templates/partition/details.html:41 +msgid "Albums" +msgstr "Albums" + +#: partitioncloud/templates/base.html:75 +msgid "New album" +msgstr "New album" + +#: partitioncloud/templates/base.html:92 +msgid "No albums" +msgstr "No albums" + +#: partitioncloud/templates/base.html:111 +msgid "No album available" +msgstr "No album available" + +#: partitioncloud/templates/base.html:125 +msgid "Log in to see your albums" +msgstr "Log in to see your albums" + +#: partitioncloud/templates/base.html:139 +msgid "Log out" +msgstr "Log out" + +#: partitioncloud/templates/base.html:154 +msgid "Admin Panel" +msgstr "Admin Panel" + +#: partitioncloud/templates/auth/register.html:5 +#: partitioncloud/templates/auth/register.html:20 +#: partitioncloud/templates/base.html:166 +msgid "Create account" +msgstr "Create account" + +#: partitioncloud/templates/auth/login.html:5 +#: partitioncloud/templates/auth/login.html:10 +#: partitioncloud/templates/base.html:168 +msgid "Log in" +msgstr "Log in" + +#: partitioncloud/templates/admin/index.html:5 +msgid "Administration Panel" +msgstr "Administration Panel" + +#: partitioncloud/templates/admin/index.html:9 +msgid "New user" +msgstr "New user" + +#: partitioncloud/templates/admin/index.html:12 +msgid "See scores" +msgstr "See scores" + +#: partitioncloud/templates/admin/index.html:15 +msgid "See logs" +msgstr "See logs" + +#: partitioncloud/templates/admin/index.html:22 +msgid "User" +msgstr "User" + +#: partitioncloud/templates/admin/index.html:24 +msgid "Scores" +msgstr "Scores" + +#: partitioncloud/templates/admin/index.html:25 +msgid "Admin privileges" +msgstr "Admin privileges" + +#: partitioncloud/templates/admin/logs.html:5 +msgid "Logs" +msgstr "Logs" + +#: partitioncloud/templates/admin/partitions.html:4 +msgid "Scores list" +msgstr "Scores list" + +#: partitioncloud/templates/admin/partitions.html:31 +#: partitioncloud/templates/albums/album.html:94 +msgid "No available scores" +msgstr "No available scores" + +#: partitioncloud/templates/albums/add-partition.html:3 +msgid "New score" +msgstr "New score" + +#: partitioncloud/templates/albums/album.html:12 +msgid "Delete l'album" +msgstr "Delete album" + +#: partitioncloud/templates/albums/album.html:13 +#: partitioncloud/templates/albums/delete-album.html:6 +msgid "Do you really want to delete this album?" +msgstr "Do you really want to delete this album?" + +#: partitioncloud/templates/albums/album.html:16 +#: partitioncloud/templates/albums/album.html:60 +#: partitioncloud/templates/albums/delete-album.html:8 +#: partitioncloud/templates/groupe/index.html:20 +#: partitioncloud/templates/groupe/index.html:53 +#: partitioncloud/templates/partition/delete.html:10 +#: partitioncloud/templates/partition/details.html:86 +#: partitioncloud/templates/partition/edit.html:57 +msgid "Delete" +msgstr "Delete" + +#: partitioncloud/templates/albums/album.html:51 +msgid "Add a score" +msgstr "Add a score" + +#: partitioncloud/templates/albums/album.html:54 +#: partitioncloud/templates/groupe/index.html:46 +msgid "Join" +msgstr "Join" + +#: partitioncloud/templates/albums/album.html:56 +#: partitioncloud/templates/groupe/index.html:48 +msgid "Quit" +msgstr "Quit" + +#: partitioncloud/templates/albums/album.html:58 +#: partitioncloud/templates/groupe/index.html:50 +msgid "Share" +msgstr "Share" + +#: partitioncloud/templates/albums/delete-album.html:3 +#: partitioncloud/templates/partition/delete.html:4 +#, python-format +msgid "Delete %(name)s" +msgstr "Delete %(name)s" + +#: partitioncloud/templates/albums/delete-album.html:11 +#: partitioncloud/templates/partition/delete.html:13 +msgid "Cancel" +msgstr "Cancel" + +#: partitioncloud/templates/albums/index.html:3 +msgid "Home" +msgstr "Home" + +#: partitioncloud/templates/albums/index.html:10 +#, python-format +msgid "Hi %(user_name)s !" +msgstr "Hi %(user_name)s !" + +#: partitioncloud/templates/albums/index.html:11 +msgid "No album selected" +msgstr "No album selected" + +#: partitioncloud/templates/albums/search.html:5 +#, python-format +msgid "Search results for \"%(query)s\"" +msgstr "Search results for \"%(query)s\"" + +#: partitioncloud/templates/albums/search.html:7 +msgid "Results in current database" +msgstr "Results in current database" + +#: partitioncloud/templates/albums/search.html:38 +#: partitioncloud/templates/albums/search.html:70 +msgid "Add to album" +msgstr "Add to album" + +#: partitioncloud/templates/albums/search.html:45 +msgid "Online search results" +msgstr "" + +#: partitioncloud/templates/albums/search.html:77 +msgid "" +"No results available. Try to tweak your query or increase the amount of " +"online searches." +msgstr "" +"No results available. Try to tweak your query or increase the amount of " +"online searches." + +#: partitioncloud/templates/auth/login.html:8 +#: partitioncloud/templates/auth/register.html:18 +msgid "Username" +msgstr "Username" + +#: partitioncloud/templates/auth/login.html:9 +#: partitioncloud/templates/auth/register.html:19 +msgid "Password" +msgstr "Password" + +#: partitioncloud/templates/auth/register.html:10 +msgid "Add to album:" +msgstr "Add to album:" + +#: partitioncloud/templates/auth/register.html:12 +msgid "None" +msgstr "None" + +#: partitioncloud/templates/components/add_partition.html:1 +#, python-format +msgid "Add a score to %(name)s" +msgstr "Add a score to %(name)s" + +#: partitioncloud/templates/components/add_partition.html:4 +msgid "title" +msgstr "title" + +#: partitioncloud/templates/components/add_partition.html:5 +msgid "author" +msgstr "author" + +#: partitioncloud/templates/components/add_partition.html:6 +msgid "lyrics" +msgstr "lyrics" + +#: partitioncloud/templates/components/add_partition.html:10 +#: partitioncloud/templates/groupe/index.html:11 +#: partitioncloud/templates/partition/attachments.html:13 +msgid "Add" +msgstr "Add" + +#: partitioncloud/templates/groupe/index.html:8 +#, python-format +msgid "Add an album to group %(name)s" +msgstr "Add an album to group %(name)s" + +#: partitioncloud/templates/groupe/index.html:16 +msgid "Delete group" +msgstr "Delete group" + +#: partitioncloud/templates/groupe/index.html:17 +msgid "Do you really want to delete this group and the albums it contains?" +msgstr "Do you really want to delete this group and the albums it contains?" + +#: partitioncloud/templates/groupe/index.html:52 +msgid "Add an album" +msgstr "Add an album" + +#: partitioncloud/templates/groupe/index.html:74 +msgid "Create one" +msgstr "Create one" + +#: partitioncloud/templates/groupe/index.html:77 +#, python-format +msgid "No available album. %(create)s" +msgstr "No available album. %(create)s" + +#: partitioncloud/templates/partition/attachments.html:5 +#, python-format +msgid "Attachments of %(name)s" +msgstr "Attachments of %(name)s" + +#: partitioncloud/templates/partition/attachments.html:9 +#, python-format +msgid "Add an attachment to %(name)s" +msgstr "Add an attachment to %(name)s" + +#: partitioncloud/templates/partition/attachments.html:22 +msgid "" +"No pdf viewer available in this browser.\n" +" You can use Firefox on Android." +msgstr "" +"No pdf viewer available in this browser.\n" +" You can use Firefox on Android." + +#: partitioncloud/templates/partition/attachments.html:46 +msgid "JavaScript is mandatory to read MIDI files" +msgstr "JavaScript is mandatory to read MIDI files" + +#: partitioncloud/templates/partition/attachments.html:60 +msgid "Add an attachment" +msgstr "Add an attachment" + +#: partitioncloud/templates/partition/delete.html:8 +msgid "Do you really want to delete this score?" +msgstr "Do you really want to delete this score?" + +#: partitioncloud/templates/partition/details.html:4 +#, python-format +msgid "Details of \"%(name)s\"" +msgstr "Details of \"%(name)s\"" + +#: partitioncloud/templates/partition/details.html:12 +msgid "Added by" +msgstr "Added by" + +#: partitioncloud/templates/partition/details.html:23 +msgid "Unknown" +msgstr "Unknown" + +#: partitioncloud/templates/partition/details.html:29 +msgid "Type" +msgstr "Type" + +#: partitioncloud/templates/partition/details.html:52 +#: partitioncloud/templates/partition/edit.html:13 +msgid "File" +msgstr "File" + +#: partitioncloud/templates/partition/details.html:58 +#: partitioncloud/templates/partition/details.html:59 +#: partitioncloud/templates/partition/edit.html:29 +#: partitioncloud/templates/partition/edit.html:30 +msgid "Title" +msgstr "Title" + +#: partitioncloud/templates/partition/details.html:62 +#: partitioncloud/templates/partition/details.html:63 +#: partitioncloud/templates/partition/edit.html:33 +#: partitioncloud/templates/partition/edit.html:34 +msgid "Author" +msgstr "Author" + +#: partitioncloud/templates/partition/details.html:66 +#: partitioncloud/templates/partition/details.html:67 +#: partitioncloud/templates/partition/edit.html:37 +#: partitioncloud/templates/partition/edit.html:38 +msgid "Lyrics" +msgstr "Lyrics" + +#: partitioncloud/templates/partition/details.html:70 +#: partitioncloud/templates/partition/edit.html:41 +msgid "Attachments" +msgstr "Attachments" + +#: partitioncloud/templates/partition/details.html:75 +#: partitioncloud/templates/partition/edit.html:46 +#, python-format +msgid "Yes, %(number)s" +msgstr "Yes, %(number)s" + +#: partitioncloud/templates/partition/details.html:77 +#: partitioncloud/templates/partition/edit.html:48 +msgid "Add one" +msgstr "Add one" + +#: partitioncloud/templates/partition/details.html:83 +#: partitioncloud/templates/partition/edit.html:54 +msgid "Update" +msgstr "Update" + +#: partitioncloud/templates/partition/edit.html:6 +#, python-format +msgid "Modify \"%(name)s\"" +msgstr "Modify \"%(name)s\"" + +#: partitioncloud/templates/partition/edit.html:21 +msgid "Source" +msgstr "Source" + diff --git a/partitioncloud/translations/fr/LC_MESSAGES/messages.po b/partitioncloud/translations/fr/LC_MESSAGES/messages.po new file mode 100644 index 0000000..f820305 --- /dev/null +++ b/partitioncloud/translations/fr/LC_MESSAGES/messages.po @@ -0,0 +1,606 @@ +# French translations for PROJECT. +# Copyright (C) 2024 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2024. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2024-01-25 16:19+0100\n" +"PO-Revision-Date: 2024-01-22 15:24+0100\n" +"Last-Translator: FULL NAME \n" +"Language: fr\n" +"Language-Team: fr \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.14.0\n" + +#: partitioncloud/__init__.py:135 +#, python-format +msgid "Created user %(username)s" +msgstr "Utilisateur %(username)s créé" + +#: partitioncloud/__init__.py:138 +#, python-format +msgid "This album does not exists, but user %(username)s has been created" +msgstr "Cet album n'existe pas. L'utilisateur %(username)s a été créé" + +#: partitioncloud/modules/albums.py:41 +msgid "Missing search query" +msgstr "Aucun terme de recherche spécifié." + +#: partitioncloud/modules/albums.py:123 partitioncloud/modules/groupe.py:71 +#: partitioncloud/modules/groupe.py:185 +msgid "Missing name." +msgstr "Un nom est requis." + +#: partitioncloud/modules/albums.py:160 +msgid "This album does not exist." +msgstr "Cet album n'existe pas." + +#: partitioncloud/modules/albums.py:163 +msgid "Album added to collection." +msgstr "Album ajouté à la collection." + +#: partitioncloud/modules/albums.py:177 partitioncloud/modules/albums.py:240 +#: partitioncloud/modules/albums.py:346 +msgid "You are not a member of this album" +msgstr "Vous ne faites pas partie de cet album" + +#: partitioncloud/modules/albums.py:181 +msgid "You are alone here, quitting means deleting this album." +msgstr "Vous êtes seul dans cet album, le quitter entraînera sa suppression." + +#: partitioncloud/modules/albums.py:185 +msgid "Album quitted." +msgstr "Album quitté." + +#: partitioncloud/modules/albums.py:204 +msgid "You are not alone in this album." +msgstr "Vous n'êtes pas seul dans cet album." + +#: partitioncloud/modules/albums.py:206 +msgid "You don't own this album." +msgstr "Vous ne possédez pas cet album." + +#: partitioncloud/modules/albums.py:217 +msgid "Album deleted." +msgstr "Album supprimé." + +#: partitioncloud/modules/albums.py:246 partitioncloud/modules/partition.py:153 +#: partitioncloud/modules/partition.py:199 +msgid "Missing title" +msgstr "Un titre est requis." + +#: partitioncloud/modules/albums.py:248 partitioncloud/modules/partition.py:63 +msgid "Missing file" +msgstr "Aucun fichier n'a été fourni." + +#: partitioncloud/modules/albums.py:260 +msgid "Search results expired" +msgstr "Les résultats de la recherche ont expiré." + +#: partitioncloud/modules/albums.py:326 +#, python-format +msgid "Score %(partition_name)s added" +msgstr "Partition %(partition_name)s ajoutée" + +#: partitioncloud/modules/albums.py:340 +msgid "Selecting an album is mandatory." +msgstr "Il est nécessaire de sélectionner un album." + +#: partitioncloud/modules/albums.py:342 +msgid "Selecting a score is mandatory." +msgstr "Il est nécessaire de sélectionner une partition." + +#: partitioncloud/modules/albums.py:344 +msgid "Please specify a score type." +msgstr "Il est nécessaire de spécifier un type de partition." + +#: partitioncloud/modules/albums.py:366 +msgid "Score added" +msgstr "Partition ajoutée." + +#: partitioncloud/modules/albums.py:368 +msgid "Score is already in the album." +msgstr "Partition déjà dans l'album." + +#: partitioncloud/modules/albums.py:380 +msgid "Unknown score type." +msgstr "Type de partition inconnu." + +#: partitioncloud/modules/auth.py:27 partitioncloud/modules/auth.py:54 +msgid "You need to login to access this resource." +msgstr "Vous devez être connecté pour accéder à cette page." + +#: partitioncloud/modules/auth.py:59 +msgid "Missing rights." +msgstr "Droits insuffisants." + +#: partitioncloud/modules/auth.py:85 +msgid "Missing username." +msgstr "Un nom d'utilisateur est requis." + +#: partitioncloud/modules/auth.py:87 +msgid "Missing password." +msgstr "Un mot de passe est requis." + +#: partitioncloud/modules/auth.py:100 +#, python-format +msgid "Username %(username)s is not available." +msgstr "Le nom d'utilisateur %(username)s est déjà pris." + +#: partitioncloud/modules/auth.py:113 +msgid "New users registration is disabled by owner." +msgstr "" +"L'enregistrement de nouveaux utilisateurs a été désactivé par " +"l'administrateur." + +#: partitioncloud/modules/auth.py:127 +msgid "Successfully created new user. You can log in." +msgstr "Utilisateur créé avec succès. Vous pouvez vous connecter." + +#: partitioncloud/modules/auth.py:152 +msgid "Incorrect username or password" +msgstr "Nom d'utilisateur ou mot de passe incorrect." + +#: partitioncloud/modules/groupe.py:120 +msgid "Unknown group." +msgstr "Ce groupe n'existe pas." + +#: partitioncloud/modules/groupe.py:123 +msgid "Group added to collection." +msgstr "Groupe ajouté à la collection." + +#: partitioncloud/modules/groupe.py:134 +msgid "You are not a member of this group." +msgstr "Vous ne faites pas partie de ce groupe" + +#: partitioncloud/modules/groupe.py:138 +msgid "You are alone here, quitting means deleting this group." +msgstr "Vous êtes seul dans ce groupe, le quitter entraînera sa suppression." + +#: partitioncloud/modules/groupe.py:142 +msgid "Group quitted." +msgstr "Groupe quitté." + +#: partitioncloud/modules/groupe.py:155 +msgid "You are not alone in this group." +msgstr "Vous n'êtes pas seul dans ce groupe." + +#: partitioncloud/modules/groupe.py:166 +msgid "Group deleted." +msgstr "Groupe supprimé." + +#: partitioncloud/modules/groupe.py:188 +msgid "You are not admin of this group." +msgstr "Vous n'êtes pas administrateur de ce groupe" + +#: partitioncloud/modules/partition.py:58 +msgid "You don't own this score." +msgstr "Cette partition ne vous appartient pas" + +#: partitioncloud/modules/partition.py:71 +msgid "Missing filename." +msgstr "Pas de nom de fichier" + +#: partitioncloud/modules/partition.py:76 +msgid "Unsupported file type." +msgstr "Extension de fichier non supportée" + +#: partitioncloud/modules/partition.py:144 +msgid "You are not allowed to edit this file." +msgstr "Vous n'êtes pas autorisé à modifier cette partition." + +#: partitioncloud/modules/partition.py:155 +#: partitioncloud/modules/partition.py:201 +msgid "Missing author in request body (can be null)." +msgstr "Un nom d'auteur est requis (à minima nul)" + +#: partitioncloud/modules/partition.py:157 +#: partitioncloud/modules/partition.py:203 +msgid "Missing lyrics (can be null)." +msgstr "Des paroles sont requises (à minima nulles)" + +#: partitioncloud/modules/partition.py:169 +#: partitioncloud/modules/partition.py:215 +#, python-format +msgid "Successfully modified %(name)s" +msgstr "Partition %(name)s modifiée avec succès." + +#: partitioncloud/modules/partition.py:230 +msgid "You are not allowed to delete this score." +msgstr "Vous n'êtes pas autorisé à supprimer cette partition." + +#: partitioncloud/modules/partition.py:238 +msgid "Score deleted." +msgstr "Partition supprimée." + +#: partitioncloud/templates/base.html:23 +msgid "New Album" +msgstr "Créer un nouvel album" + +#: partitioncloud/templates/base.html:25 partitioncloud/templates/base.html:36 +#: partitioncloud/templates/groupe/index.html:10 +#: partitioncloud/templates/partition/attachments.html:11 +msgid "Name" +msgstr "Nom" + +#: partitioncloud/templates/base.html:26 partitioncloud/templates/base.html:37 +msgid "Create" +msgstr "Créer" + +#: partitioncloud/templates/base.html:30 +msgid "I want to create a collection of albums." +msgstr "" +"Je souhaite créer plusieurs albums et pouvoir tous les partager avec un " +"seul lien." + +#: partitioncloud/templates/base.html:30 +msgid "Create group" +msgstr "Créer un groupe" + +#: partitioncloud/templates/base.html:34 +msgid "Create new group" +msgstr "Créer un nouveau groupe" + +#: partitioncloud/templates/base.html:61 +msgid "Search" +msgstr "Rechercher" + +#: partitioncloud/templates/base.html:63 +msgid "Number of online searches" +msgstr "Nombre de recherches en ligne" + +#: partitioncloud/templates/admin/index.html:23 +#: partitioncloud/templates/base.html:71 +#: partitioncloud/templates/partition/details.html:41 +msgid "Albums" +msgstr "Albums" + +#: partitioncloud/templates/base.html:75 +msgid "New album" +msgstr "Créer un album" + +#: partitioncloud/templates/base.html:92 +msgid "No albums" +msgstr "Aucun album disponible" + +#: partitioncloud/templates/base.html:111 +msgid "No album available" +msgstr "Aucun album disponible" + +#: partitioncloud/templates/base.html:125 +msgid "Log in to see your albums" +msgstr "Connectez vous pour avoir accès à vos albums" + +#: partitioncloud/templates/base.html:139 +msgid "Log out" +msgstr "Déconnexion" + +#: partitioncloud/templates/base.html:154 +msgid "Admin Panel" +msgstr "Panneau admin" + +#: partitioncloud/templates/auth/register.html:5 +#: partitioncloud/templates/auth/register.html:20 +#: partitioncloud/templates/base.html:166 +msgid "Create account" +msgstr "Créer un compte" + +#: partitioncloud/templates/auth/login.html:5 +#: partitioncloud/templates/auth/login.html:10 +#: partitioncloud/templates/base.html:168 +msgid "Log in" +msgstr "Se connecter" + +#: partitioncloud/templates/admin/index.html:5 +msgid "Administration Panel" +msgstr "Panneau d'administration" + +#: partitioncloud/templates/admin/index.html:9 +msgid "New user" +msgstr "Nouvel utilisateur" + +#: partitioncloud/templates/admin/index.html:12 +msgid "See scores" +msgstr "Voir les partitions" + +#: partitioncloud/templates/admin/index.html:15 +msgid "See logs" +msgstr "Voir les logs" + +#: partitioncloud/templates/admin/index.html:22 +msgid "User" +msgstr "Utilisateur" + +#: partitioncloud/templates/admin/index.html:24 +msgid "Scores" +msgstr "Partitions" + +#: partitioncloud/templates/admin/index.html:25 +msgid "Admin privileges" +msgstr "Privilèges" + +#: partitioncloud/templates/admin/logs.html:5 +msgid "Logs" +msgstr "Logs" + +#: partitioncloud/templates/admin/partitions.html:4 +msgid "Scores list" +msgstr "Liste des partitions" + +#: partitioncloud/templates/admin/partitions.html:31 +#: partitioncloud/templates/albums/album.html:94 +msgid "No available scores" +msgstr "Aucune partition disponible" + +#: partitioncloud/templates/albums/add-partition.html:3 +msgid "New score" +msgstr "Ajout de partition" + +#: partitioncloud/templates/albums/album.html:12 +msgid "Delete l'album" +msgstr "Supprimer l'album" + +#: partitioncloud/templates/albums/album.html:13 +#: partitioncloud/templates/albums/delete-album.html:6 +msgid "Do you really want to delete this album?" +msgstr "Êtes vous sûr de vouloir supprimer cet album ?" + +#: partitioncloud/templates/albums/album.html:16 +#: partitioncloud/templates/albums/album.html:60 +#: partitioncloud/templates/albums/delete-album.html:8 +#: partitioncloud/templates/groupe/index.html:20 +#: partitioncloud/templates/groupe/index.html:53 +#: partitioncloud/templates/partition/delete.html:10 +#: partitioncloud/templates/partition/details.html:86 +#: partitioncloud/templates/partition/edit.html:57 +msgid "Delete" +msgstr "Supprimer" + +#: partitioncloud/templates/albums/album.html:51 +msgid "Add a score" +msgstr "Ajouter une partition" + +#: partitioncloud/templates/albums/album.html:54 +#: partitioncloud/templates/groupe/index.html:46 +msgid "Join" +msgstr "Rejoindre" + +#: partitioncloud/templates/albums/album.html:56 +#: partitioncloud/templates/groupe/index.html:48 +msgid "Quit" +msgstr "Quitter" + +#: partitioncloud/templates/albums/album.html:58 +#: partitioncloud/templates/groupe/index.html:50 +msgid "Share" +msgstr "Partager" + +#: partitioncloud/templates/albums/delete-album.html:3 +#: partitioncloud/templates/partition/delete.html:4 +#, python-format +msgid "Delete %(name)s" +msgstr "Supprimer %(name)s" + +#: partitioncloud/templates/albums/delete-album.html:11 +#: partitioncloud/templates/partition/delete.html:13 +msgid "Cancel" +msgstr "Annuler" + +#: partitioncloud/templates/albums/index.html:3 +msgid "Home" +msgstr "Accueil" + +#: partitioncloud/templates/albums/index.html:10 +#, python-format +msgid "Hi %(user_name)s !" +msgstr "Bonjour %(user_name)s !" + +#: partitioncloud/templates/albums/index.html:11 +msgid "No album selected" +msgstr "Aucun album sélectionné" + +#: partitioncloud/templates/albums/search.html:5 +#, python-format +msgid "Search results for \"%(query)s\"" +msgstr "Résultats de la recherche pour \"%(query)s\"" + +#: partitioncloud/templates/albums/search.html:7 +msgid "Results in current database" +msgstr "Résultats dans la recherche locale" + +#: partitioncloud/templates/albums/search.html:38 +#: partitioncloud/templates/albums/search.html:70 +msgid "Add to album" +msgstr "Ajouter à un album" + +#: partitioncloud/templates/albums/search.html:45 +msgid "Online search results" +msgstr "Résultats de la recherche en ligne" + +#: partitioncloud/templates/albums/search.html:77 +msgid "" +"No results available. Try to tweak your query or increase the amount of " +"online searches." +msgstr "" +"Aucun résultat disponible. Essayez d'affiner votre recherche ou " +"d'augmenter le nombre de résultats en ligne" + +#: partitioncloud/templates/auth/login.html:8 +#: partitioncloud/templates/auth/register.html:18 +msgid "Username" +msgstr "Nom d'utilisateur" + +#: partitioncloud/templates/auth/login.html:9 +#: partitioncloud/templates/auth/register.html:19 +msgid "Password" +msgstr "Mot de passe" + +#: partitioncloud/templates/auth/register.html:10 +msgid "Add to album:" +msgstr "Ajouter à un album:" + +#: partitioncloud/templates/auth/register.html:12 +msgid "None" +msgstr "Aucun" + +#: partitioncloud/templates/components/add_partition.html:1 +#, python-format +msgid "Add a score to %(name)s" +msgstr "Ajouter une partition à %(name)s" + +#: partitioncloud/templates/components/add_partition.html:4 +msgid "title" +msgstr "titre" + +#: partitioncloud/templates/components/add_partition.html:5 +msgid "author" +msgstr "auteur" + +#: partitioncloud/templates/components/add_partition.html:6 +msgid "lyrics" +msgstr "paroles" + +#: partitioncloud/templates/components/add_partition.html:10 +#: partitioncloud/templates/groupe/index.html:11 +#: partitioncloud/templates/partition/attachments.html:13 +msgid "Add" +msgstr "Ajouter" + +#: partitioncloud/templates/groupe/index.html:8 +#, python-format +msgid "Add an album to group %(name)s" +msgstr "Ajouter un album au groupe %(name)s" + +#: partitioncloud/templates/groupe/index.html:16 +msgid "Delete group" +msgstr "Supprimer le groupe" + +#: partitioncloud/templates/groupe/index.html:17 +msgid "Do you really want to delete this group and the albums it contains?" +msgstr "" +"Êtes vous sûr de vouloir supprimer ce groupe ? Cela supprimera les albums" +" sous-jacents et leurs partitions si personne ne les a rejoints " +"(indépendamment du groupe)." + +#: partitioncloud/templates/groupe/index.html:52 +msgid "Add an album" +msgstr "Ajouter un album" + +#: partitioncloud/templates/groupe/index.html:74 +msgid "Create one" +msgstr "En créer un" + +#: partitioncloud/templates/groupe/index.html:77 +#, python-format +msgid "No available album. %(create)s" +msgstr "Aucun album disponible. %(create)s" + +#: partitioncloud/templates/partition/attachments.html:5 +#, python-format +msgid "Attachments of %(name)s" +msgstr "Attachments de %(name)s" + +#: partitioncloud/templates/partition/attachments.html:9 +#, python-format +msgid "Add an attachment to %(name)s" +msgstr "Ajouter un attachment à %(name)s" + +#: partitioncloud/templates/partition/attachments.html:22 +msgid "" +"No pdf viewer available in this browser.\n" +" You can use Firefox on Android." +msgstr "" +"Impossible d'afficher le pdf dans ce navigateur.\n" +" Il est conseillé d'utiliser Firefox sur Android." + +#: partitioncloud/templates/partition/attachments.html:46 +msgid "JavaScript is mandatory to read MIDI files" +msgstr "JavaScript est nécessaire pour lire les fichiers MIDI" + +#: partitioncloud/templates/partition/attachments.html:60 +msgid "Add an attachment" +msgstr "Ajouter un attachment" + +#: partitioncloud/templates/partition/delete.html:8 +msgid "Do you really want to delete this score?" +msgstr "Êtes vous sûr de vouloir supprimer cette partition ?" + +#: partitioncloud/templates/partition/details.html:4 +#, python-format +msgid "Details of \"%(name)s\"" +msgstr "Détails de \"%(name)s\"" + +#: partitioncloud/templates/partition/details.html:12 +msgid "Added by" +msgstr "Responsable de l'ajout" + +#: partitioncloud/templates/partition/details.html:23 +msgid "Unknown" +msgstr "Inconnu" + +#: partitioncloud/templates/partition/details.html:29 +msgid "Type" +msgstr "Type d'ajout" + +#: partitioncloud/templates/partition/details.html:52 +#: partitioncloud/templates/partition/edit.html:13 +msgid "File" +msgstr "Fichier" + +#: partitioncloud/templates/partition/details.html:58 +#: partitioncloud/templates/partition/details.html:59 +#: partitioncloud/templates/partition/edit.html:29 +#: partitioncloud/templates/partition/edit.html:30 +msgid "Title" +msgstr "Titre" + +#: partitioncloud/templates/partition/details.html:62 +#: partitioncloud/templates/partition/details.html:63 +#: partitioncloud/templates/partition/edit.html:33 +#: partitioncloud/templates/partition/edit.html:34 +msgid "Author" +msgstr "Auteur" + +#: partitioncloud/templates/partition/details.html:66 +#: partitioncloud/templates/partition/details.html:67 +#: partitioncloud/templates/partition/edit.html:37 +#: partitioncloud/templates/partition/edit.html:38 +msgid "Lyrics" +msgstr "Paroles" + +#: partitioncloud/templates/partition/details.html:70 +#: partitioncloud/templates/partition/edit.html:41 +msgid "Attachments" +msgstr "Pièces jointes" + +#: partitioncloud/templates/partition/details.html:75 +#: partitioncloud/templates/partition/edit.html:46 +#, python-format +msgid "Yes, %(number)s" +msgstr "Oui, %(number)s" + +#: partitioncloud/templates/partition/details.html:77 +#: partitioncloud/templates/partition/edit.html:48 +msgid "Add one" +msgstr "En rajouter" + +#: partitioncloud/templates/partition/details.html:83 +#: partitioncloud/templates/partition/edit.html:54 +msgid "Update" +msgstr "Mettre à jour" + +#: partitioncloud/templates/partition/edit.html:6 +#, python-format +msgid "Modify \"%(name)s\"" +msgstr "Modifier \"%(name)s\"" + +#: partitioncloud/templates/partition/edit.html:21 +msgid "Source" +msgstr "Source" + diff --git a/requirements.txt b/requirements.txt index 087e383..8a0b15a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ flask +flask-babel google colorama qrcode \ No newline at end of file diff --git a/scripts/hooks/utils.py b/scripts/hooks/utils.py index 9683c8e..c901181 100644 --- a/scripts/hooks/utils.py +++ b/scripts/hooks/utils.py @@ -1,7 +1,9 @@ import os +import sys import random import string import sqlite3 +from colorama import Fore, Style from . import config @@ -40,3 +42,29 @@ def new_uuid(): def format_uuid(uuid): """Format old uuid4 format""" return uuid.upper()[:6] + + +def install_package(package): + print(f"\nThe following python package needs to be installed: {Style.BRIGHT}{Fore.YELLOW}{package}{Style.RESET_ALL}") + print(f"1. Install with {Style.BRIGHT}pip{Style.RESET_ALL} (automatic)") + print(f"2. Install manually (other package manager)") + option = input("Select an option: ") + try: + choice = int(option) + + if choice == 1: + return_value = os.system(f"pip install {package} -qq") + if return_value == 0: + return + print(f"{Fore.RED}Installation with pip failed{Style.RESET_ALL}") + sys.exit(return_value) + + elif choice == 2: + input("Install via you preferred option, and hit [Enter] when done") + return + + except ValueError: + pass + + print(f"{Fore.RED}Please enter a valid option{Style.RESET_ALL}") + return install_package(package) \ No newline at end of file diff --git a/scripts/hooks/v1.py b/scripts/hooks/v1.py index 176b813..07776b1 100644 --- a/scripts/hooks/v1.py +++ b/scripts/hooks/v1.py @@ -54,7 +54,7 @@ def add_attachments(): def install_colorama(): - os.system("pip install colorama -qq") + utils.install_package("colorama") """ @@ -144,7 +144,7 @@ def base_url_parameter_added(): def install_qrcode(): - os.system("pip install qrcode -qq") + utils.install_package("qrcode") """ @@ -171,3 +171,12 @@ def move_thumbnails(): os.makedirs(os.path.join(config.instance, "cache", "thumbnails"), exist_ok=True) os.makedirs(os.path.join(config.instance, "cache", "search-thumbnails"), exist_ok=True) + + +""" + v1.7.* +""" + + +def install_babel(): + utils.install_package("flask-babel") \ No newline at end of file diff --git a/scripts/migration.py b/scripts/migration.py index 4434bbb..a93302c 100644 --- a/scripts/migration.py +++ b/scripts/migration.py @@ -34,7 +34,8 @@ hooks = [ ), ("v1.4.1", [("Install qrcode", v1_hooks.install_qrcode)]), ("v1.5.0", [("Move to instance directory", v1_hooks.move_instance)]), - ("v1.5.1", [("Move thumbnails", v1_hooks.move_thumbnails)]) + ("v1.5.1", [("Move thumbnails", v1_hooks.move_thumbnails)]), + ("v1.7.0", [("Install babel", v1_hooks.install_babel)]) ]