diff --git a/Post_RSS_on_SubStack.py b/Post_RSS_on_SubStack.py index b316ea3..9dd8156 100644 --- a/Post_RSS_on_SubStack.py +++ b/Post_RSS_on_SubStack.py @@ -62,12 +62,19 @@ class SubStackTask: def get_fr_date(self): - locale.setlocale(locale.LC_TIME, 'fr_FR') + # Mapping of English month names to French + months_en_to_fr = { + 'January': 'Janvier', 'February': 'Février', 'March': 'Mars', + 'April': 'Avril', 'May': 'Mai', 'June': 'Juin', + 'July': 'Juillet', 'August': 'Août', 'September': 'Septembre', + 'October': 'Octobre', 'November': 'Novembre', 'December': 'Décembre' + } today = datetime.datetime.now() - today = today.strftime("%d %B %Y") - locale.setlocale(locale.LC_TIME, 'C') - return today - + formatted_date = today.strftime("%d %B %Y") + # Replace the English month with the French month + for en, fr in months_en_to_fr.items(): + formatted_date = formatted_date.replace(en, fr) + return formatted_date async def run_daily_at_6_am(self): while True: