Oli and Casper,

I would love some assistance getting Radiant on Rails 2.1
Rails edge has some localization and translation features built in, so moving to 2.1 would get us there faster (I hope).

If you'd like to help, please fork my rails_2_1_0 branch and contribute:
http://github.com/saturnflyer/radiant/tree/rails_2_1_0

I've only had the time to get so far with it, so assistance would be greatly appreciated. So this isn't a fast solution for the problems you're trying to solve, but I hope it'll be good for the long term of Radiant development.

-Jim

On Aug 2, 2008, at 2:19 PM, Casper Fabricius wrote:

Hi Oli,

I'm also faced with a Radiant that needs to run two multiple languages, however, non of them Japanese, so can't help you there.

But I'm eager to hear if you have found a fitting extension for handling multiple languages. I'm considering using Loren Johnson's language switch (http://github.com/lorenjohnson/radiant-language-switch/tree/master ), but maybe there is something better or different or more advanced out there?

Cheers,
Casper Fabricius


On 02/08/2008, at 3:46, Oli Studholme wrote:

Hi All,

[sorry if this ends up being a double-post]
I’ve been having lots of fun with making a bilingual site in Radiant. Here are some current problems that I hope someone can suggest fixes for:

# Pages in Shift-JIS charset

Most Japanese cellphones require Shift-JIS for mobile sites, but the content-type field in Layout ignores charsets. Can anyone suggest how I’d add support for charsets to this, or another way to work around it?

# Mailer extension and sending ISO-2022-JP emails

Despite ActiveMailer docs[1] containing this:
“default_charset - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also pick a different charset from inside a method with charset.”

Setting this in environment.rb:

 config.action_mailer.default_charset = "iso-2022-jp"

still results in my email header and body being UTF-8 encoded, with body settings of:
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Quoted-printable

If I add this to environment.rb:

config.action_mailer.default_content_type = "text/ plain;charset=iso-2022-jp"

I get the bizarre combo of utf-8 encoded subject and body settings of:
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Iso-2022-jp

which is even worse. A Japanese article[2] suggests wrapping ActionMailer in TMail then iso-2022-jp and base64 the email, but I guess that requires a hack or an extension, right? here’s their code:

module ActionMailer #:nodoc:
class Base
  require 'nkf'
  class << self
    def base64(text, charset="iso-2022-jp", convert=true)
      if convert
        if charset == "iso-2022-jp"
          text = NKF.nkf('-j -m0', text)
        end
      end
      text = [text].pack('m').delete("¥r¥n")
      "=?#{charset}?B?#{text}?="
    end
  end
end
end

class Notifications < ActionMailer::Base
@@default_charset = "iso-2022-jp"
@@encode_subject = false
#...
end
Then in test:

class NotificationsTest < Test::Unit::TestCase
CHARSET = "iso-2022-jp"
#...
private
  def encode(subject)
    ActionMailer::Base.base64(subject, CHARSET)
  end
end

Anyone ever managed to get emails in non-UTF8 working

Finally, what’s up with i18n and how can I help? I can’t even get the Jargon branch (with the partially baked gibberish support) to run anymore…

peace - oli

[1] http://api.rubyonrails.org/classes/ActionMailer/Base.html
[2] http://wiki.fdiary.net/rails/?ActionMailer
_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to