Skip to content

Commit 00e5af1

Browse files
committed
fix: upd
1 parent 2f9ed63 commit 00e5af1

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/lingodotdev/engine.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -350,17 +350,11 @@ def wrapped_progress_callback(progress: int, source_chunk: Dict[str, str], proce
350350
wrapped_progress_callback
351351
)
352352

353-
result = []
354-
for key, value in localized.items():
355-
if key.startswith('chat_'):
356-
index = int(key.split('_')[1])
357-
if index < len(chat):
358-
result.append({
359-
'name': chat[index]['name'],
360-
'text': value
361-
})
353+
# The API returns the localized chat in the same structure
354+
if 'chat' in localized and isinstance(localized['chat'], list):
355+
return localized['chat']
362356

363-
return result
357+
return []
364358

365359
def recognize_locale(self, text: str) -> str:
366360
"""

tests/test_engine.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,10 @@ def test_batch_localize_text_missing_target_locales(self):
229229
def test_localize_chat(self, mock_localize_raw):
230230
"""Test chat localization"""
231231
mock_localize_raw.return_value = {
232-
"chat_0": "hola",
233-
"chat_1": "adiós"
232+
"chat": [
233+
{"name": "Alice", "text": "hola"},
234+
{"name": "Bob", "text": "adiós"}
235+
]
234236
}
235237

236238
chat = [

0 commit comments

Comments
 (0)