i18n support
Closed this issue · 3 comments
luciolucio commented
Message#archive! does not work in other languages because "All Mail" is hardcoded in message.rb. "Spam" can potentially change too from one language to another.
For example, in Italian while "Spam" is still "Spam", the "All Mail" mailbox is called "Tutti i messaggi"
luciolucio commented
I believe gmail's IMAP has an API to get the localized name of a folder.
luciolucio commented
OK, here's an example (based on this). I'm trying to think of where's the best place to use this. What do you think of gmail.rb
getting a mailbox_name
member, to be used like mailbox_name( :All )
returns "[Gmail]/All Mail"
, used in message.rb?
require 'net/imap'
imap = Net::IMAP.new('imap.gmail.com',993,true,nil,false)
res = imap.login( 'user', 'password' )
if res && res.name == "OK"
l = imap.list( "[Gmail]/", "%" )
x = l.select { | m | m.attr.include?( :All ) }
all_mail = x.first.name
y = l.select { | m | m.attr.include?( :Junk ) }
spam = y.first.name
imap.logout
puts all_mail
puts spam
end
myobie commented
I think you can use the i18n gem directly and not need to integrate it into this gem directly.