mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-06-21 13:58:40 +00:00
Change to a seperate corrections file
This commit is contained in:
@ -89,7 +89,7 @@ with open("./resources/strings/strings.xml", "r") as f:
|
|||||||
for l in languages:
|
for l in languages:
|
||||||
os.makedirs(f"./resources-{l[0]}/strings/", exist_ok=True)
|
os.makedirs(f"./resources-{l[0]}/strings/", exist_ok=True)
|
||||||
try:
|
try:
|
||||||
with open(f"./resources-{l[0]}/strings/strings.xml", "r") as r:
|
with open(f"./resources-{l[0]}/strings/corrections.xml", "r") as r:
|
||||||
curr = BeautifulSoup(r.read().replace('\r', ''), features="xml")
|
curr = BeautifulSoup(r.read().replace('\r', ''), features="xml")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
curr = BeautifulSoup("", features=["xml"])
|
curr = BeautifulSoup("", features=["xml"])
|
||||||
@ -108,9 +108,8 @@ with open("./resources/strings/strings.xml", "r") as f:
|
|||||||
if s["id"] in exceptionIds: continue
|
if s["id"] in exceptionIds: continue
|
||||||
|
|
||||||
s_curr = curr.find(name="string", attrs={ "id": s["id"] })
|
s_curr = curr.find(name="string", attrs={ "id": s["id"] })
|
||||||
if s_curr and s_curr.has_attr("corrected") and s_curr.attrs["corrected"] == "true":
|
if s_curr:
|
||||||
s.string = s_curr.string
|
s.string = s_curr.string
|
||||||
s.attrs["corrected"] = "true"
|
|
||||||
else:
|
else:
|
||||||
a = GoogleTranslator(source='en', target=l[1]).translate(s.string)
|
a = GoogleTranslator(source='en', target=l[1]).translate(s.string)
|
||||||
if s["id"] in titleIds:
|
if s["id"] in titleIds:
|
||||||
|
Reference in New Issue
Block a user