# Question about conventions of using I18n

**URL:** <https://www.ruby-forum.com/t/question-about-conventions-of-using-i18n/209231>\
**Category:** Rails I18n\
**Created:** [July 8, 2011, 7:54pm UTC](https://www.ruby-forum.com/t/question-about-conventions-of-using-i18n/209231 "2011-07-08T19:54:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [July 8, 2011, 7:54pm UTC](https://www.ruby-forum.com/t/question-about-conventions-of-using-i18n/209231/1 "2011-07-08T19:54:15Z")

</div>

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,  
  
  
Yo Momma.

…

Would it be better to do:

\<%= t(‘footer.thanks’) %\>  
  
  
\<%= t(‘footer.signature’) %\>

footer:  
thanks:  
Thanks,  
signature:  
Yo Momma.

or something like:

\<%= raw t(‘footer.closing’) %\>

footer:  
closing:  
Thanks,  
  
  
Yo Momma.

?

-patrick

---

<div class="post-metadata">

**Author:** ![patrick99e99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/858c86/32.png) [@patrick99e99](https://www.ruby-forum.com/u/patrick99e99)\
**Post date:** [July 8, 2011, 8:52pm UTC](https://www.ruby-forum.com/t/question-about-conventions-of-using-i18n/209231/2 "2011-07-08T20:52:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![patrick99e99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/858c86/32.png) [@patrick99e99](https://www.ruby-forum.com/u/patrick99e99)\
**Post date:** [July 8, 2011, 9:02pm UTC](https://www.ruby-forum.com/t/question-about-conventions-of-using-i18n/209231/3 "2011-07-08T21:02:06Z")

</div>

Agreed. If possible, you could use something like Markdown so the  
translator gets something closer to plain text. Though   
 specifically  
is a bit of a mess with standard Markdown.

Sent from my iPad

---

<div class="post-metadata">

**Author:** ![patrick99e99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/858c86/32.png) [@patrick99e99](https://www.ruby-forum.com/u/patrick99e99)\
**Post date:** [July 8, 2011, 9:19pm UTC](https://www.ruby-forum.com/t/question-about-conventions-of-using-i18n/209231/4 "2011-07-08T21:19:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![patrick99e99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/858c86/32.png) [@patrick99e99](https://www.ruby-forum.com/u/patrick99e99)\
**Post date:** [July 9, 2011, 12:04am UTC](https://www.ruby-forum.com/t/question-about-conventions-of-using-i18n/209231/5 "2011-07-09T00:04:26Z")

</div>

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("  
") %\>

% email.text.plain  
\<%= t(‘footer.closing’).join("\r\n") %\>
