%section#download
%h1= t “section.title”
.content
%p
= I18n.t “section.first_box.first”
in name.html.erb file.
But I noticed that the css formatting that would apply to the %p tag no
longer applies because of the internationalization tag I18n.t. Does
anyone
know how I can make sure that the text being translated
“section.first_box.first” will preserve it’s css formatting and not have
it
removed because of the I18n.t tag?
On Monday, September 16, 2013 12:16:45 PM UTC+1, trekr67 wrote:
But I noticed that the css formatting that would apply to the %p tag no
longer applies because of the internationalization tag I18n.t. Does anyone
know how I can make sure that the text being translated
“section.first_box.first” will preserve it’s css formatting and not have it
removed because of the I18n.t tag?
This isn’t related to the use of i18n ( as a shortcut you can use just
‘t’
in views instead of I18n.t). As it stands the indentation in your haml
file
will put the internationalized text outside of the p tag, so the css
rules
for p tags won’t be used.
But I noticed that the css formatting that would apply to the %p tag no
longer applies because of the internationalization tag I18n.t. Does
anyone
know how I can make sure that the text being translated
“section.first_box.first” will preserve it’s css formatting and not have
it
removed because of the I18n.t tag?
This isn’t related to the use of i18n ( as a shortcut you can use just
‘t’ in views instead of I18n.t). As it stands the indentation in your
haml
file will put the internationalized text outside of the p tag, so the
css
rules for p tags won’t be used.
Fred
But I noticed that the css formatting that would apply to the %p tag no longer
applies because of the internationalization tag I18n.t. Does anyone know how I can
make sure that the text being translated “section.first_box.first” will preserve
it’s css formatting and not have it removed because of the I18n.t tag?
Can you write out, in HTML, how you want the final code to appear? The
use of HAML may be confusing things here.
On Monday, September 16, 2013 3:29:37 PM UTC+1, trekr67 wrote:
The problem is that the CSS formatting for the translated part is contained in
the p tag and that’s what I’d like preserved.
Or would you suggest creating a new tag for the translated text in the CSS file
with the same formatting as the p tag and then applying it that way?
At the moment your haml is resulting in markup that looks like
Translated text here
So it should be clear why the style rules for p have no effect. What I
was trying to say was that for the translated text to be inside the p
element you need to indent it, that is
%p
= I18n.t(…)
Or perhaps I’ve got the wrong end of the stick and you should spell out
what you’re trying to do, as Walter suggests.
Fred
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.