Hi everyone,
I'm a bit curious on what the conventions of internationalizing a
project is...
1) So let's say you want to internationalize some html email text...
And there's something like this:
Thanks,
<br />
Yo Momma.
...
Would it be better to do:
<%= t('footer.thanks') %>
<br />
<%= t('footer.signature') %>
footer:
thanks:
Thanks,
signature:
Yo Momma.
or something like:
<%= raw t('footer.closing') %>
footer:
closing:
Thanks,
<br />
Yo Momma.
?
-patrick
on 2011-07-08 19:54
on 2011-07-08 20:52
For large chunks of text I'd generally prefer the single key as it makes it easier for a translator to see the full context of the mail. In general you should avoid concatenating translations together as it's easy to run into situations where it just won't work. I think written Chinese goes top to bottom, right to left so if that is the same in email then your template that puts the signature at the bottom could never be translated correctly. (I have no idea if that's actually the case for Chinese but does demonstrate what could go wrong.) As developers it's easy to think "I could DRY this up with one key for the signature used everywhere" but it doesn't always make sense when translated. HTH, Chris
on 2011-07-08 21:02
Agreed. If possible, you could use something like Markdown so the translator gets something closer to plain text. Though <br> specifically is a bit of a mess with standard Markdown. Sent from my iPad
on 2011-07-08 21:19
Turns out *I* can't read, Chinese is top to bottom. In my defence it's late on Friday and my brain isn't going full speed :) My point about being careful about concatenation still stands though! Chris
on 2011-07-09 00:04
well, now that thinking about this, it probably makes more sense to
do:
footer:
closing:
- Thanks,
- Yo Momma.
# email.html.erb
<%= t('footer.closing').join("<br />") %>
% email.text.plain
<%= t('footer.closing').join("\r\n") %>
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.