Skip to content

Commit

Permalink
fix: translate.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sheenhx authored Sep 13, 2024
1 parent 1663298 commit f34499a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion assets/flutter_i18n/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ def translate(text, target_language):
response = model.generate_content(
[f"this is an API, please just translate the following English text to {target_language}: {text}"]
)
return response.candidates[0].text.strip()
# Extract the translated text
translated_text = response.result.candidates[0].content.parts[0].text.strip()
return translated_text

def main():
language_dict = {
Expand Down

0 comments on commit f34499a

Please sign in to comment.