Skip to content

Commit

Permalink
reset to prev locale after parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Siavash Mollayi committed Nov 6, 2021
1 parent 6ee8412 commit 988b2ae
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lingua_franca/lang/parse_az.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from typing import List
from datetime import datetime, timedelta
import locale
locale.setlocale(locale.LC_TIME, "az_AZ")

from dateutil.relativedelta import relativedelta

from lingua_franca.time import now_local
Expand All @@ -32,7 +32,7 @@

import re
import json
from lingua_franca.internal import resolve_resource_file
from lingua_franca.internal import get_default_lang, resolve_resource_file

def _remove_ak():
pass
Expand Down Expand Up @@ -1104,7 +1104,9 @@ def date_found():
# perform date manipulation

extractedDate = anchorDate.replace(microsecond=0)

if get_default_lang() == "az":
prev_locale = locale.getlocale()
locale.setlocale(locale.LC_TIME, "az_AZ")
if datestr != "":
# date included an explicit date, e.g. "june 5" or "june 2, 2017"
try:
Expand Down Expand Up @@ -1172,6 +1174,9 @@ def date_found():

resultStr = " ".join(words)
resultStr = ' '.join(resultStr.split())
if get_default_lang() == "az":
prev_locale = locale.getlocale()
locale.setlocale(locale.LC_TIME, prev_locale)
return [extractedDate, resultStr]


Expand Down

0 comments on commit 988b2ae

Please sign in to comment.