Skip to content

Commit

Permalink
Remove locale dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jacrasmussen committed Feb 8, 2025
1 parent e71a238 commit 4bb903f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions recipe_scrapers/spisbedre.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import locale

from ._abstract import AbstractScraper
from ._grouping_utils import IngredientGroup
Expand All @@ -13,8 +12,6 @@ def __init__(self, *args, **kwargs):
self.soup.find("div", id="app").attrs["data-page"]
)["props"]["recipe"]

locale.setlocale(locale.LC_NUMERIC, "da_DK")

@classmethod
def host(cls):
return "spisbedre.dk"
Expand Down Expand Up @@ -92,10 +89,12 @@ def unit_label(amount, inflection, texts):
total_amount = round(amount * servings, 2)
# Formatting amount using same logic as the website
formatted_amount = (
f"{total_amount:n}".replace("0,25", "¼")
str(total_amount)
.replace(".", ",")
.replace(",0", "")
.replace("0,25", "¼")
.replace("0,5", "½")
.replace("0,75", "¾")
.replace(",00", "")
.replace(",25", "¼")
.replace(",5", "½")
.replace(",75", "¾")
Expand Down

0 comments on commit 4bb903f

Please sign in to comment.