Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Translate removes newlines #566

Closed
davidwessman opened this issue May 8, 2024 · 2 comments · Fixed by #567
Closed

Google Translate removes newlines #566

davidwessman opened this issue May 8, 2024 · 2 comments · Fixed by #567

Comments

@davidwessman
Copy link
Collaborator

I'm using the pipe-operator, and the multi-lines are also concatenated into a single one (without space: …</p><p>…) on the target locale when I run e.g. i18n-tasks translate-missing.

[Edited] Example:

# config/locales/en.yml
en:
  intro_html: |
    <p>Hello</p>
    <p>World</p>
# Translate with Google
i18n-tasks translate-missing -l fr
# config/locales/fr.yml
fr:
  intro_html: "<p>Bonjour</p><p>Monde</p>"

(with i18n-tasks 1.0.12)

Originally posted by @otagi in #383 (comment)

davidwessman added a commit that referenced this issue May 9, 2024
- Line breaks are not kept when translating html content via Google Translate
- Therefore we transform `\n` into a placeholder and then back after
  translating
- Fixes #566
glebm pushed a commit that referenced this issue May 10, 2024
- Line breaks are not kept when translating html content via Google Translate
- Therefore we transform `\n` into a placeholder and then back after
  translating
- Fixes #566
@davidwessman
Copy link
Collaborator Author

@otagi This should help with the errors you had while translating

@otagi
Copy link

otagi commented May 10, 2024

Fantastic! Thanks a lot. I'll try it ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants