More localization of recipe search and view

This commit is contained in:
MaxJa4 2022-02-28 21:19:00 +01:00
parent b393d026f7
commit 1e3a6fadf0
6 changed files with 17 additions and 5 deletions

View File

@ -3,6 +3,7 @@ import re
from html import unescape from html import unescape
from unicodedata import decomposition from unicodedata import decomposition
from django.utils.translation import gettext as _
from django.utils.dateparse import parse_duration from django.utils.dateparse import parse_duration
from isodate import parse_duration as iso_parse_duration from isodate import parse_duration as iso_parse_duration
from isodate.isoerror import ISO8601Error from isodate.isoerror import ISO8601Error
@ -147,7 +148,7 @@ def get_from_scraper(scrape, request):
if scrape.url: if scrape.url:
recipe_json['url'] = 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 return recipe_json

View File

@ -4,6 +4,7 @@ from zipfile import ZipFile
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from django.utils.translation import gettext as _
from cookbook.helper.ingredient_parser import IngredientParser from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.helper.recipe_html_import import get_recipe_from_source from cookbook.helper.recipe_html_import import get_recipe_from_source
from cookbook.helper.recipe_url_import import iso_duration_to_minutes, parse_servings from cookbook.helper.recipe_url_import import iso_duration_to_minutes, parse_servings
@ -60,7 +61,7 @@ class CopyMeThat(Integration):
try: try:
if file.find("a", {"id": "original_link"}).text != '': 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() step.save()
except AttributeError: except AttributeError:
pass pass

View File

@ -6,6 +6,7 @@ from zipfile import ZipFile
import requests import requests
from django.utils.translation import gettext as _
from cookbook.helper.image_processing import get_filetype from cookbook.helper.image_processing import get_filetype
from cookbook.helper.ingredient_parser import IngredientParser from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.integration.integration import Integration from cookbook.integration.integration import Integration
@ -49,7 +50,7 @@ class RecetteTek(Integration):
# Append the original import url to the step (if it exists) # Append the original import url to the step (if it exists)
try: try:
if file['url'] != '': if file['url'] != '':
step.instruction += '\n\nImported from: ' + file['url'] step.instruction += '\n\n' + _('Imported from') + ': ' + file['url']
step.save() step.save()
except Exception as e: except Exception as e:
print(recipe.name, ': failed to import source url ', str(e)) print(recipe.name, ': failed to import source url ', str(e))

View File

@ -4,6 +4,7 @@ from zipfile import ZipFile
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from django.utils.translation import gettext as _
from cookbook.helper.ingredient_parser import IngredientParser from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.helper.recipe_url_import import iso_duration_to_minutes, parse_servings from cookbook.helper.recipe_url_import import iso_duration_to_minutes, parse_servings
from cookbook.integration.integration import Integration from cookbook.integration.integration import Integration
@ -59,7 +60,7 @@ class RecipeKeeper(Integration):
step.instruction += s.text + ' \n' step.instruction += s.text + ' \n'
if file.find("span", {"itemprop": "recipeSource"}).text != '': 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() step.save()
recipe.steps.add(step) recipe.steps.add(step)

View File

@ -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.", "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: ", "MoveCategory": "Verschieben nach: ",
"mealplan_autoadd_shopping_desc": "Essensplan-Zutaten automatisch zur Einkaufsliste hinzufügen.", "mealplan_autoadd_shopping_desc": "Essensplan-Zutaten automatisch zur Einkaufsliste hinzufügen.",
"Pin": "Pin", "Pin": "Anheften",
"mark_complete": "Vollständig markieren", "mark_complete": "Vollständig markieren",
"shopping_add_onhand_desc": "Markiere Lebensmittel als \"Vorrätig\", wenn von der Einkaufsliste abgehakt wurden.", "shopping_add_onhand_desc": "Markiere Lebensmittel als \"Vorrätig\", wenn von der Einkaufsliste abgehakt wurden.",
"left_handed": "Linkshänder-Modus", "left_handed": "Linkshänder-Modus",
@ -341,4 +341,9 @@
"Keyword": "Schlüsselwort", "Keyword": "Schlüsselwort",
"Advanced": "Erweitert", "Advanced": "Erweitert",
"Substitutes": "Zusätze" "Substitutes": "Zusätze"
"parameter_count": "Parameter {count}",
"copy_to_new": "Kopiere zu neuem Rezept",
"Page": "Seite",
"Reset": "Zurücksetzen",
"search_rank": "Such-Rang"
} }

View File

@ -366,4 +366,7 @@
"User": "User", "User": "User",
"Keyword": "Keyword", "Keyword": "Keyword",
"Advanced": "Advanced" "Advanced": "Advanced"
"parameter_count": "Parameter {count}",
"Page": "Page",
"Reset": "Reset"
} }