Skip to content

Commit 3b0af80

Browse files
committed
fix: selector and lang
1 parent dfcf0bb commit 3b0af80

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

deepl/deepl.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ async def __translate(self, script: str) -> str:
168168
)
169169

170170
await page.fill(
171-
"div[aria-labelledby=translation-source-heading]",
171+
"[data-testid=translator-source-input] div[role=textbox]",
172172
script,
173173
)
174174

@@ -213,13 +213,8 @@ async def __translate(self, script: str) -> str:
213213
msg = "Unable to get translated text"
214214
raise DeepLCLIPageLoadError(msg) from e
215215

216-
input_textbox = page.get_by_role("region", name="Source text").locator(
217-
"d-textarea",
218-
)
219-
output_textbox = page.get_by_role(
220-
"region",
221-
name="Translation results",
222-
).locator("d-textarea")
216+
input_textbox = page.locator("[data-testid=translator-source-input]")
217+
output_textbox = page.locator("[data-testid=translator-target-input]")
223218

224219
self.translated_fr_lang = str(
225220
await input_textbox.get_attribute("lang"),

deepl/languages.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,15 @@
119119
}
120120

121121
TO_LANGS: Final[set[str]] = FR_LANGS | {
122-
"en-gb",
123-
"en-us",
122+
"de-CH",
123+
"en-GB",
124+
"en-US",
124125
"es-419",
125-
"pt-br",
126-
"pt-pt",
127-
"zh-hans",
128-
"zh-hant",
126+
"fr-CA",
127+
"pt-BR",
128+
"pt-PT",
129+
"zh-Hans",
130+
"zh-Hant",
129131
} - {
130132
"auto",
131133
"en",

0 commit comments

Comments
 (0)