Im sure everyone is enjoined himself with globalization plugin, what a features, what abilities..
However one thing is veeerry disappearing me, (or maybe i just dont know how-to), NO option to know status of translations…
Okay, imagine we have Staticpage model with some fields to be translated.
so in .rb >
translates :name, :abstract, :body
thats ok, rest of stuff is “automatically” mapped by globalization plugin.
BUT (or butt:) ! in views/staticpages/list.rhtml you dont have anything that tell you about translation in different languages.
so you need to shake a lizard and do some work, look here:
in model:
def translation_languages
when in list.rhtml:
reply = “”
LOCALES.each do | local |
iso639 = local[0]
flag = local[1].slice(3..4).downcase + “.png”
if iso639 != “en”
# do not display “en” language
n = ModelTranslation.find :all,
:conditions => [”globalize_languages.iso_639_1 = ? AND globalize_translations.item_id=? AND globalize_translations.language_id = globalize_languages.id”, iso639, id],
:joins => “INNER JOIN globalize_languages”
if n.size == 0 #|| Locale.language_code != iso639
tClass = “tr_incomplete”
tTitle = “Not translated”
else
tTitle = “Translated”
tClass = “tr_complete”
end
reply+= “span class=’#{tClass}’ title=’#{tTitle}’>img src=’/images/flags/#{flag}’ /> /span>”
end
end
return reply
end
<%= staticpage.translation_languages %>
will render all flags with “Translated” “Not Translated” titles.
you must have /images/flags/*.png appropriate flags, also you must have two css classes tr_incomplete and tr_complete.