From 1e3a6fadf0ec1e67489c85f5560b2b4026686026 Mon Sep 17 00:00:00 2001 From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com> Date: Mon, 28 Feb 2022 21:19:00 +0100 Subject: [PATCH] More localization of recipe search and view --- cookbook/helper/recipe_url_import.py | 3 ++- cookbook/integration/copymethat.py | 3 ++- cookbook/integration/recettetek.py | 3 ++- cookbook/integration/recipekeeper.py | 3 ++- vue/src/locales/de.json | 7 ++++++- vue/src/locales/en.json | 3 +++ 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index 65e579675..19c55b83c 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -3,6 +3,7 @@ import re from html import unescape from unicodedata import decomposition +from django.utils.translation import gettext as _ from django.utils.dateparse import parse_duration from isodate import parse_duration as iso_parse_duration from isodate.isoerror import ISO8601Error @@ -147,7 +148,7 @@ def get_from_scraper(scrape, request): if scrape.url: recipe_json['url'] = scrape.url - recipe_json['recipeInstructions'] += "\n\nImported from " + scrape.url + recipe_json['recipeInstructions'] += "\n\n" + _("Imported from") + ": " + scrape.url return recipe_json diff --git a/cookbook/integration/copymethat.py b/cookbook/integration/copymethat.py index 3bb9cd5ce..c961a51a5 100644 --- a/cookbook/integration/copymethat.py +++ b/cookbook/integration/copymethat.py @@ -4,6 +4,7 @@ from zipfile import ZipFile from bs4 import BeautifulSoup +from django.utils.translation import gettext as _ from cookbook.helper.ingredient_parser import IngredientParser from cookbook.helper.recipe_html_import import get_recipe_from_source from cookbook.helper.recipe_url_import import iso_duration_to_minutes, parse_servings @@ -60,7 +61,7 @@ class CopyMeThat(Integration): try: if file.find("a", {"id": "original_link"}).text != '': - step.instruction += "\n\nImported from: " + file.find("a", {"id": "original_link"}).text + step.instruction += "\n\n" + _("Imported from") + ": " + file.find("a", {"id": "original_link"}).text step.save() except AttributeError: pass diff --git a/cookbook/integration/recettetek.py b/cookbook/integration/recettetek.py index 5bc171e0e..7eb93a8e9 100644 --- a/cookbook/integration/recettetek.py +++ b/cookbook/integration/recettetek.py @@ -6,6 +6,7 @@ from zipfile import ZipFile import requests +from django.utils.translation import gettext as _ from cookbook.helper.image_processing import get_filetype from cookbook.helper.ingredient_parser import IngredientParser from cookbook.integration.integration import Integration @@ -49,7 +50,7 @@ class RecetteTek(Integration): # Append the original import url to the step (if it exists) try: if file['url'] != '': - step.instruction += '\n\nImported from: ' + file['url'] + step.instruction += '\n\n' + _('Imported from') + ': ' + file['url'] step.save() except Exception as e: print(recipe.name, ': failed to import source url ', str(e)) diff --git a/cookbook/integration/recipekeeper.py b/cookbook/integration/recipekeeper.py index 59a04098a..31cc326f9 100644 --- a/cookbook/integration/recipekeeper.py +++ b/cookbook/integration/recipekeeper.py @@ -4,6 +4,7 @@ from zipfile import ZipFile from bs4 import BeautifulSoup +from django.utils.translation import gettext as _ from cookbook.helper.ingredient_parser import IngredientParser from cookbook.helper.recipe_url_import import iso_duration_to_minutes, parse_servings from cookbook.integration.integration import Integration @@ -59,7 +60,7 @@ class RecipeKeeper(Integration): step.instruction += s.text + ' \n' if file.find("span", {"itemprop": "recipeSource"}).text != '': - step.instruction += "\n\nImported from: " + file.find("span", {"itemprop": "recipeSource"}).text + step.instruction += "\n\n" + _("Imported from") + ": " + file.find("span", {"itemprop": "recipeSource"}).text step.save() recipe.steps.add(step) diff --git a/vue/src/locales/de.json b/vue/src/locales/de.json index bac9e12fd..16b8f69c4 100644 --- a/vue/src/locales/de.json +++ b/vue/src/locales/de.json @@ -249,7 +249,7 @@ "shopping_auto_sync_desc": "Bei 0 wird Auto-Sync deaktiviert. Beim Betrachten einer Einkaufsliste wird die Liste alle gesetzten Sekunden aktualisiert, um mögliche Änderungen anderer zu zeigen. Nützlich, wenn mehrere Personen einkaufen und mobile Daten nutzen.", "MoveCategory": "Verschieben nach: ", "mealplan_autoadd_shopping_desc": "Essensplan-Zutaten automatisch zur Einkaufsliste hinzufügen.", - "Pin": "Pin", + "Pin": "Anheften", "mark_complete": "Vollständig markieren", "shopping_add_onhand_desc": "Markiere Lebensmittel als \"Vorrätig\", wenn von der Einkaufsliste abgehakt wurden.", "left_handed": "Linkshänder-Modus", @@ -341,4 +341,9 @@ "Keyword": "Schlüsselwort", "Advanced": "Erweitert", "Substitutes": "Zusätze" + "parameter_count": "Parameter {count}", + "copy_to_new": "Kopiere zu neuem Rezept", + "Page": "Seite", + "Reset": "Zurücksetzen", + "search_rank": "Such-Rang" } diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index 195d8e6fb..69c96f32c 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -366,4 +366,7 @@ "User": "User", "Keyword": "Keyword", "Advanced": "Advanced" + "parameter_count": "Parameter {count}", + "Page": "Page", + "Reset": "Reset" }