Skip to content

Commit

Permalink
translator quotes fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Manrique committed Dec 2, 2024
1 parent 35a90a2 commit 4ab02ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def translate_ios_infoplist_strings():
result = response.json()

translated_text = result.get("translations", [{}])[0].get("text", "").strip().rstrip('。;')
translated_text = translated_text.replace('"', '\"') # Escape quotes in translated text
translated_line = f'{key} = "{translated_text}";' # Ensure translated string is always within quotes
translated_text = translated_text.replace('"', '') # Escape quotes in translated text
translated_line = f'{key} = "{translated_text.strip()}";' # Ensure translated string is always within quotes
translated_file.write(translated_line + '\n')
print(f"{value} --> {translated_text}")
else:
Expand Down

0 comments on commit 4ab02ac

Please sign in to comment.