tags:

views:

364

answers:

2

I'm building a tool that analyzes Gmail specific folders (e.g. '[Gmail]/All Mail', '[Gmail]/Spam'). It seems that the names are localized with respect to the user localization settings, so '[Gmail]/All Mail' show as '[Gmail]/Todos' to Spanish users for example.

Is there a non-localized canonical name for gmail folders? A way to detect it? Or in worst case scenario, a list of the possible localized names.

+1  A: 

This user script has a very incomplete list with lots of question marks:

  • Inbox, Indbakke, Posteingang, Recibidos, Bo?te de r?ception, Posta in arrivo, Postvak IN, Odebrane, Caixa de entrada,
  • Starred, Stjernemarkerede, Markiert, Destacados, Messages suivis, Speciali, Met ster, Oznaczone gwiazdka, Com estrela, ??????????,
  • Chats, Chatsamtaler, Tous les chats, Chat, Czaty, Bate-papo, ????,
  • Sent Mail, Sendte e-mails, Gesendet, Enviados, Messages envoy?s, Posta inviata, Verzonden berichten, Wyslane, E-mails enviados, Correio enviado, ????????????,
  • Drafts, Kladder, Entw?rfe, Borradores, Brouillons, Bozze, Concepten, Wersje robocze, Rascunhos, ?????????,
  • All Mail, Alle e-mails, Alle Nachrichten, Todos, Tous les messages, Tutti i messaggi, Alle berichten, Wszystkie, Todos os e-mails, Todo o correio, ??? ?????,
  • Spam, Mensagens n?o solicitadas, ????,
  • Trash, Bin, Papirkurv, Papierkorb, Papelera, Corbeille, Cestino, Prullenbak, Kosz, Lixeira, Caixote do lixo, ???????,

Android's Email repo has some more under res/values-xx/strings.xml. It turned up in a Google search for some of Gmail's strings, so there's a chance it will work. They might not necessarily match Gmail's strings, so caveat emptor — it doesn't have "All Mail", for example, since it's for the generic email client.

  • drafts Borradores, Borradores, Bozze, Brouillons, Concepten, Entwürfe, Kladder, Koncepty, Kopie robocze, Rascunhos, Rascunhos, Taslaklar, Utkast, Utkast, Πρόχειρα, Черновики, 下書き, 草稿, 草稿, 임시보관함
  • inbox Bandeja de entrada, Boîte de réception, Caixa de entrada, Caixa de entrada, Doručená pošta, Gelen Kutusu, Indbakke, Inkorgen, Innboks, Odebrane, Posta in arrivo, Posteingang, Postvak IN, Recibidos, Εισερχόμενα, Входящие, 受信トレイ, 收件匣, 收件箱, 받은편지함
  • junk Correio electrónico não solicitado, Correo basura, Junk, Junk, Lixo, Nettsøppel, Nevyžádaná pošta, No solicitado, Ongewenst, Posta indesiderata, Skräp, Spam, Wiadomości-śmieci, Önemsiz, Ανεπιθύμητα, Спам, 垃圾邮件, 垃圾郵件, 迷惑メール, 스팸
  • outbox Bandeja de salida, Boîte d'envoi, Caixa de saída, Caixa de saída, Do wysłania, Enviados, Giden Kutusu, Posta in uscita, Postausgang, Postvak UIT, Pošta k odeslání, Udbakke, Utboks, Utkorgen, Εξερχόμενα, Исходящие, 发件箱, 寄件匣, 送信トレイ, 보낼편지함
  • sent E-mails enviados, Enviada, Enviado, Enviado, Gesendet, Gönderildi, Inviati, Odeslaná pošta, Sendt, Sendt, Skickat, Verzonden, Wysłane, Éléments envoyés, Απεσταλμένα, Отправленные, 寄件備份, 已发送邮件, 送信済み, 보낸편지함
  • trash Cestino, Corbeille, Kosz, Koš, Lixeira, Lixo, Papelera, Papelera, Papierkorb, Papirkurv, Papirkurv, Papperskorgen, Prullenbak, Çöp Kutusu, Κάδος απορριμμάτων, Корзина, ゴミ箱, 垃圾桶, 已删除邮件, 휴지통
jleedev
This seems extremely error-prone
Pawel Lesnikowski
A: 

There is a better way: XLIST command.

Google and Apple developed a special IMAP command XLIST to address this issue.

IMAP XLIST command returns a list of folders and their well-know flags (\Inbox, \Drafts, \Trash, \Sent, \Spam):

  • XLIST (\HasNoChildren \Inbox) "/" "Inbox"

Mail.dll IMAP client (Commercial product I've created) supports XLIST command. It is used automatically when server advertises support for this feature. You can read more here: http://www.lesnikowski.com/blog/index.php/localized-gmail-imap-folders/

Pawel Lesnikowski