From be8f0e590f12aca5e0d9ef9b349ec44b827d99ef Mon Sep 17 00:00:00 2001 From: Athozus Date: Mon, 17 Jul 2023 16:45:57 +0200 Subject: [PATCH] Add a setting to choose date format --- locale/mail.de.tr | 53 ++++++++++++++++++++++---------------------- locale/mail.es.tr | 53 ++++++++++++++++++++++---------------------- locale/mail.fr.tr | 53 ++++++++++++++++++++++---------------------- locale/mail.hu.tr | 53 ++++++++++++++++++++++---------------------- locale/mail.pt_BR.tr | 53 ++++++++++++++++++++++---------------------- locale/mail.zh_CN.tr | 53 ++++++++++++++++++++++---------------------- locale/mail.zh_TW.tr | 53 ++++++++++++++++++++++---------------------- locale/template.txt | 53 ++++++++++++++++++++++---------------------- storage.lua | 1 + ui/message.lua | 2 +- ui/receivers.lua | 2 +- ui/settings.lua | 21 ++++++++++++++++-- 12 files changed, 238 insertions(+), 212 deletions(-) diff --git a/locale/mail.de.tr b/locale/mail.de.tr index b2a1495..c77589f 100644 --- a/locale/mail.de.tr +++ b/locale/mail.de.tr @@ -14,42 +14,22 @@ Cancel=Abbrechen Save draft=Entwurf speichern Send=Senden No contacts=Keine Kontakte -Edit=Bearbeiten +Name=Name No drafts=Keine Entwürfe +Edit=Bearbeiten +To=An Player name=Spielername That name is already in your contacts=Dieser Name ist bereits in Ihren Kontakten The contact name cannot be empty.=Der Kontaktname kann nicht leer sein. Note=Anmerkung -Back=Zurück -Save=Speichern Maillist name=Verteilerlistenname Desc=Beschreibung Players=Spieler That name is already in your mailing lists.=Dieser Name ist bereits in Ihren Verteilerlisten. The mailing list name cannot be empty.=Der Verteilerlistenname kann nicht leer sein. +Back=Zurück Mark Read=Als gelesen makieren Mark Unread=Als ungelesen makieren -Reply=Antworten -Reply all=Allen antworten -Forward=Weiterleiten -Reply only to the sender= -Reply to all involved people= -Transfer message to other people= -From=Von -Filter=Filter -Allow multiple selection=Mehrfachauswahl zulassen -@1 of @2 selected=@1 von @2 ausgewählt -(Un)select all=Alle aus-/abwählen -No mail=Keine Nachrichten -Subject=Betreff -New=Neu -Delete=Löschen -Date=Datum -(No description)=(Keine Beschreibung) -No maillist=Keine Verteilerliste -Receivers=Empfänger -You have mail! Type /mail to read=Sie haben Post! „/mail“ eingeben zum Lesen -Read=Lesen Trash=Papierkorb Inbox=Posteingang Outbox=Senden @@ -59,10 +39,29 @@ Mail lists=Verteilerlisten Options=Einstellungen Close=Schließen (No subject)=(Kein Betreff) -To=An +Subject=Betreff +Delete=Löschen +New=Neu +Date=Datum +Filter=Filter +Allow multiple selection=Mehrfachauswahl zulassen +@1 of @2 selected=@1 von @2 ausgewählt +(Un)select all=Alle aus-/abwählen +No mail=Keine Nachrichten +Reply=Antworten +Reply all=Allen antworten +Forward=Weiterleiten +Reply only to the sender= +Reply to all involved people= +Transfer message to other people= +Read=Lesen +From=Von +(No description)=(Keine Beschreibung) +No maillist=Keine Verteilerliste +Receivers=Empfänger +You have mail! Type /mail to read=Sie haben Post! „/mail“ eingeben zum Lesen Add=Hinzufügen Remove=Entfernen -Name=Name CC=CC Notifications=Benachrichtigungen Chat notifications=Chat-Benachrichtigungen @@ -76,6 +75,7 @@ Default sorting fields=Standardsortierfelder Other=Anderes Move deleted messages to trash=Gelöschte Nachrichten in den Papierkorb verschieben Automatic marking read= +Date format:= Receive a message in the chat when there is a new message= Receive a message at login when inbox isn't empty= Show an HUD notification when inbox isn't empty= @@ -84,6 +84,7 @@ Mark a message as read when opened= Reset=Zurücksetzen Settings=Einstellungen About=Über +Save=Speichern Ascending=Aufsteigend Descending=Absteigend From/To=Von/An diff --git a/locale/mail.es.tr b/locale/mail.es.tr index a34c440..0bee381 100644 --- a/locale/mail.es.tr +++ b/locale/mail.es.tr @@ -14,42 +14,22 @@ Cancel=Cancelar Save draft=Guardar borrador Send=Enviar No contacts= -Edit=Editar +Name=Nombre No drafts=No hay borradores +Edit=Editar +To=Para Player name=Nombre del jugador That name is already in your contacts=Ese nombre ya está en tus contactos The contact name cannot be empty.=Ese nombre de contacto no puede estar vacío. Note=Nota -Back=Volver -Save=Guardar Maillist name=Nombre de la lista de correo Desc=Desc Players=Jugadores That name is already in your mailing lists.=Ese nombre ya está entus listas de correo. The mailing list name cannot be empty.=Ese nombre de lista de correo no puede estar vacío. +Back=Volver Mark Read=Marcar como leído Mark Unread=Marcar como no leído -Reply=Responder -Reply all=Responder a todos -Forward=Reenviar -Reply only to the sender= -Reply to all involved people= -Transfer message to other people= -From=De -Filter=Filtrar -Allow multiple selection=Permitir selección múltiple -@1 of @2 selected= -(Un)select all=(Des)seleccionar todos -No mail=Sin correo -Subject=Asunto -New=Nuevo -Delete=Borrar -Date=Fecha -(No description)=(Sin descripción) -No maillist=Sin lista de correo -Receivers= -You have mail! Type /mail to read= -Read=Leído Trash= Inbox=Entrada Outbox=Enviados @@ -59,10 +39,29 @@ Mail lists=Listas de correo Options= Close=Cerrar (No subject)=(Sin asunto) -To=Para +Subject=Asunto +Delete=Borrar +New=Nuevo +Date=Fecha +Filter=Filtrar +Allow multiple selection=Permitir selección múltiple +@1 of @2 selected= +(Un)select all=(Des)seleccionar todos +No mail=Sin correo +Reply=Responder +Reply all=Responder a todos +Forward=Reenviar +Reply only to the sender= +Reply to all involved people= +Transfer message to other people= +Read=Leído +From=De +(No description)=(Sin descripción) +No maillist=Sin lista de correo +Receivers= +You have mail! Type /mail to read= Add=Añadir Remove=Quitar -Name=Nombre CC=CC Notifications= Chat notifications= @@ -76,6 +75,7 @@ Default sorting fields= Other= Move deleted messages to trash= Automatic marking read= +Date format:= Receive a message in the chat when there is a new message= Receive a message at login when inbox isn't empty= Show an HUD notification when inbox isn't empty= @@ -84,6 +84,7 @@ Mark a message as read when opened= Reset= Settings= About=Acerca de +Save=Guardar Ascending=Ascendente Descending=Descendiente From/To=De/Para diff --git a/locale/mail.fr.tr b/locale/mail.fr.tr index ba345af..3d82d5d 100644 --- a/locale/mail.fr.tr +++ b/locale/mail.fr.tr @@ -14,42 +14,22 @@ Cancel=Annuler Save draft=Enregistrer le brouillon Send=Envoyer No contacts=Aucun contact -Edit=Modifier +Name=Nom No drafts=Aucun brouillon +Edit=Modifier +To=À Player name=Nom du joueur That name is already in your contacts=Ce nom est déjà dans vos contacts The contact name cannot be empty.=Le nom du contact ne peut pas être vide. Note=Note -Back=Retour -Save=Sauvegarder Maillist name=Nom de la liste de diffusion Desc=Desc Players=Joueurs That name is already in your mailing lists.=Ce nom est déjà présent dans vos listes de diffusion. The mailing list name cannot be empty.=Le nom de la liste de diffusion ne peut pas être vide. +Back=Retour Mark Read=Marquer comme lu Mark Unread=Marquer non lu -Reply=Répondre -Reply all=Répondre à tous -Forward=Transférer -Reply only to the sender=Répondre uniquement à l'expéditeur -Reply to all involved people=Répondre à toutes les personnes concernées -Transfer message to other people=Transférer le message à d'autres personnes -From=De -Filter=Filtre -Allow multiple selection=Autoriser la sélection multiple -@1 of @2 selected=@1 sur @2 sélectionnés -(Un)select all=Tout (dé)selectionner -No mail=Aucun mail -Subject=Objet -New=Nouveau -Delete=Supprimer -Date=Date -(No description)=Sans description -No maillist=Aucune liste de diffusion -Receivers=Destinataires -You have mail! Type /mail to read=Vous avez reçu un mail ! Entrez /mail pour le consulter -Read=Lire Trash=Corbeille Inbox=Boîte de réception Outbox=Envoyés @@ -59,10 +39,29 @@ Mail lists=Listes de diffusion Options=Options Close=Fermer (No subject)=(Sans objet) -To=À +Subject=Objet +Delete=Supprimer +New=Nouveau +Date=Date +Filter=Filtre +Allow multiple selection=Autoriser la sélection multiple +@1 of @2 selected=@1 sur @2 sélectionnés +(Un)select all=Tout (dé)selectionner +No mail=Aucun mail +Reply=Répondre +Reply all=Répondre à tous +Forward=Transférer +Reply only to the sender=Répondre uniquement à l'expéditeur +Reply to all involved people=Répondre à toutes les personnes concernées +Transfer message to other people=Transférer le message à d'autres personnes +Read=Lire +From=De +(No description)=Sans description +No maillist=Aucune liste de diffusion +Receivers=Destinataires +You have mail! Type /mail to read=Vous avez reçu un mail ! Entrez /mail pour le consulter Add=Ajouter Remove=Enlever -Name=Nom CC=Cc Notifications=Notifications Chat notifications=Notifications dans le tchat @@ -76,6 +75,7 @@ Default sorting fields=Champs de tri par défaut Other=Autre Move deleted messages to trash=Supprimer les messages dans la corbeille Automatic marking read=Lu automatique +Date format:=Format de la date : Receive a message in the chat when there is a new message=Recevoir un message dans le tchat lorsqu'un nouveau message est reçu Receive a message at login when inbox isn't empty=Recevoir un message à la connexion lorsque la boîte de réception n'est pas vide Show an HUD notification when inbox isn't empty=Indiquer dans l'ATH que la boîte de réception n'est pas vide @@ -84,6 +84,7 @@ Mark a message as read when opened=Marquer un message comme lu lorsqu'il est ouv Reset=Réinitialiser Settings=Paramètres About=À propos +Save=Sauvegarder Ascending=Croissant Descending=Décroissant From/To=De/À diff --git a/locale/mail.hu.tr b/locale/mail.hu.tr index 73bd461..4f5ea3b 100644 --- a/locale/mail.hu.tr +++ b/locale/mail.hu.tr @@ -14,42 +14,22 @@ Cancel=Mégse Save draft=mentés piszkozatként Send=Küldés No contacts= -Edit=Szerkesztés +Name=Név No drafts=Nincsenek piszkozatok +Edit=Szerkesztés +To=Neki Player name=Játékos neve That name is already in your contacts=A név már a kontaktok között van The contact name cannot be empty.=A contakt neve nem lehet üres. Note=Jegyzet -Back=Visza -Save=Mentés Maillist name=Levelező lista neve Desc=Desc Players=Játékosok That name is already in your mailing lists.=A név már benne van a levelező listában The mailing list name cannot be empty.=A levelező lista neve nem lehet üres +Back=Visza Mark Read=Jelöld olvasottként Mark Unread=Jelöld olvasatlanul -Reply=Válasz -Reply all=Válaszmindenkinek -Forward=Továbbítás -Reply only to the sender= -Reply to all involved people= -Transfer message to other people= -From=Tőle -Filter=Filterek -Allow multiple selection= -@1 of @2 selected= -(Un)select all=(ne válaszd ki) mindegyik választása -No mail=Nincs levél -Subject=Cím -New=Új -Delete=Törlés -Date=Dátum -(No description)=(Nincs leírás) -No maillist=Nincs levelező lista -Receivers= -You have mail! Type /mail to read=Van egy leveled! Írd /mail az olvasáshoz -Read=Olvasott Trash= Inbox=PostaLáda Outbox=Elküldött @@ -59,10 +39,29 @@ Mail lists=Levelező lista Options=Lehetőségek Close=Bezár (No subject)=(nincs cím) -To=Neki +Subject=Cím +Delete=Törlés +New=Új +Date=Dátum +Filter=Filterek +Allow multiple selection= +@1 of @2 selected= +(Un)select all=(ne válaszd ki) mindegyik választása +No mail=Nincs levél +Reply=Válasz +Reply all=Válaszmindenkinek +Forward=Továbbítás +Reply only to the sender= +Reply to all involved people= +Transfer message to other people= +Read=Olvasott +From=Tőle +(No description)=(Nincs leírás) +No maillist=Nincs levelező lista +Receivers= +You have mail! Type /mail to read=Van egy leveled! Írd /mail az olvasáshoz Add=Hozzáadás Remove=Elvétel -Name=Név CC=CC Notifications=Értesítések Chat notifications=Chates értesítések @@ -76,6 +75,7 @@ Default sorting fields=Alap válogató terület Other= Move deleted messages to trash= Automatic marking read= +Date format:= Receive a message in the chat when there is a new message= Receive a message at login when inbox isn't empty= Show an HUD notification when inbox isn't empty= @@ -84,6 +84,7 @@ Mark a message as read when opened= Reset=Viszaállítás Settings=Beállítások About=Róla +Save=Mentés Ascending=Emelkedő Descending=Sűlyedő From/To=Tól(től)/neki diff --git a/locale/mail.pt_BR.tr b/locale/mail.pt_BR.tr index c994b14..7c5d47b 100644 --- a/locale/mail.pt_BR.tr +++ b/locale/mail.pt_BR.tr @@ -14,42 +14,22 @@ Cancel=Cancelar Save draft=Salvar rascunho Send=Enviar No contacts= -Edit=Editar +Name=Nome No drafts=Sem rascunhos +Edit=Editar +To=Para Player name=Nome do jogador That name is already in your contacts=Esse nome já consta em sua lista de contatos The contact name cannot be empty.=Informe o nome do destinatário Note=Nota -Back=Voltar -Save=Salvar Maillist name=Nome da lista de discussão Desc=Descrição Players=Jogador That name is already in your mailing lists.=Esse nome ja está sendo usado em sua lista de discussões The mailing list name cannot be empty.=O nome da lista de discussões deve ser informado +Back=Voltar Mark Read=Marcar como lido Mark Unread=Marcar como não lido -Reply=Responder -Reply all=Responder Todos -Forward=Encaminhar -Reply only to the sender= -Reply to all involved people= -Transfer message to other people= -From=De -Filter=Filtrar -Allow multiple selection=Permitir selecionar vários -@1 of @2 selected= -(Un)select all=Desmarcar todos -No mail=Sem e-mails no momento -Subject=Assunto -New=Novo -Delete=Apagar -Date=Data -(No description)=(sem descrição) -No maillist=Sem lista de discussão -Receivers= -You have mail! Type /mail to read=Você recebeu e-mail! Tecle /mail para ler -Read=Ler Trash= Inbox=Entrada Outbox=Enviadas @@ -59,10 +39,29 @@ Mail lists=Lista de correios Options=Opções Close=Fechar (No subject)=(Sem assunto) -To=Para +Subject=Assunto +Delete=Apagar +New=Novo +Date=Data +Filter=Filtrar +Allow multiple selection=Permitir selecionar vários +@1 of @2 selected= +(Un)select all=Desmarcar todos +No mail=Sem e-mails no momento +Reply=Responder +Reply all=Responder Todos +Forward=Encaminhar +Reply only to the sender= +Reply to all involved people= +Transfer message to other people= +Read=Ler +From=De +(No description)=(sem descrição) +No maillist=Sem lista de discussão +Receivers= +You have mail! Type /mail to read=Você recebeu e-mail! Tecle /mail para ler Add=Adicionar Remove=Remover -Name=Nome CC=CC Notifications=Notificações Chat notifications=Notificação de conversa @@ -76,6 +75,7 @@ Default sorting fields=Ordenamento de campos padrão Other= Move deleted messages to trash= Automatic marking read= +Date format:= Receive a message in the chat when there is a new message= Receive a message at login when inbox isn't empty= Show an HUD notification when inbox isn't empty= @@ -84,6 +84,7 @@ Mark a message as read when opened= Reset= Settings=Ajustes About=Sobre +Save=Salvar Ascending=Ascendente Descending=Descendente From/To=De/Para diff --git a/locale/mail.zh_CN.tr b/locale/mail.zh_CN.tr index e69caeb..c75cf82 100644 --- a/locale/mail.zh_CN.tr +++ b/locale/mail.zh_CN.tr @@ -14,43 +14,23 @@ Cancel=取消 Save draft=保存草稿 Send=发送 No contacts= -Edit=编辑 +Name=名字 #if new means new mail, it would be New=新邮件 No drafts=没有草稿 +Edit=编辑 +To=收件人 Player name=玩家名字 That name is already in your contacts= The contact name cannot be empty.= Note=备注 -Back=返回 -Save=保存 Maillist name=建组名 Desc=描述 Players=玩家 That name is already in your mailing lists.= The mailing list name cannot be empty.= +Back=返回 Mark Read=标记为已读 Mark Unread=标记为未读 -Reply=回复 -Reply all=回复所有 -Forward=转发 -Reply only to the sender= -Reply to all involved people= -Transfer message to other people= -From=发件人 -Filter=筛选 -Allow multiple selection=允许多选 -@1 of @2 selected= -(Un)select all=(取消)选中所有 -No mail=无邮件 -Subject=主题 -New=新 -Delete=删除 -Date=时间 -(No description)=(无描述) -No maillist=无建组 -Receivers= -You have mail! Type /mail to read= -Read=浏览 Trash= Inbox=收件箱 Outbox=已发送 @@ -60,10 +40,29 @@ Mail lists=建组 Options= Close=关闭 (No subject)=(无主题) -To=收件人 +Subject=主题 +Delete=删除 +New=新 +Date=时间 +Filter=筛选 +Allow multiple selection=允许多选 +@1 of @2 selected= +(Un)select all=(取消)选中所有 +No mail=无邮件 +Reply=回复 +Reply all=回复所有 +Forward=转发 +Reply only to the sender= +Reply to all involved people= +Transfer message to other people= +Read=浏览 +From=发件人 +(No description)=(无描述) +No maillist=无建组 +Receivers= +You have mail! Type /mail to read= Add=添加 Remove=移除 -Name=名字 CC=抄送 Notifications= Chat notifications= @@ -77,6 +76,7 @@ Default sorting fields= Other= Move deleted messages to trash= Automatic marking read= +Date format:= Receive a message in the chat when there is a new message= Receive a message at login when inbox isn't empty= Show an HUD notification when inbox isn't empty= @@ -85,6 +85,7 @@ Mark a message as read when opened= Reset= Settings= About=关于 +Save=保存 Ascending=升序 Descending=降序 From/To= diff --git a/locale/mail.zh_TW.tr b/locale/mail.zh_TW.tr index bace234..d5df3a2 100644 --- a/locale/mail.zh_TW.tr +++ b/locale/mail.zh_TW.tr @@ -14,42 +14,22 @@ Cancel=取消 Save draft=儲存草稿 Send=發送 No contacts= -Edit=編輯 +Name=名稱 No drafts=沒有草稿 +Edit=編輯 +To=收件人 Player name=玩家名稱 That name is already in your contacts= The contact name cannot be empty.= Note=備註 -Back=返回 -Save=儲存 Maillist name=郵件列表名稱 Desc=描述 Players=玩家 That name is already in your mailing lists.= The mailing list name cannot be empty.= +Back=返回 Mark Read=標記已讀 Mark Unread=標記未讀 -Reply=回覆 -Reply all=回覆所有人 -Forward=轉寄 -Reply only to the sender= -Reply to all involved people= -Transfer message to other people= -From=寄件者 -Filter= -Allow multiple selection= -@1 of @2 selected= -(Un)select all= -No mail=沒有郵件 -Subject=主旨 -New=新建 -Delete=刪除 -Date=日期 -(No description)=(沒有描述) -No maillist=沒有郵件列表 -Receivers= -You have mail! Type /mail to read= -Read=閱讀 Trash= Inbox=收件箱 Outbox=寄件備份 @@ -59,10 +39,29 @@ Mail lists=郵件列表 Options= Close=關閉 (No subject)=(沒有主旨) -To=收件人 +Subject=主旨 +Delete=刪除 +New=新建 +Date=日期 +Filter= +Allow multiple selection= +@1 of @2 selected= +(Un)select all= +No mail=沒有郵件 +Reply=回覆 +Reply all=回覆所有人 +Forward=轉寄 +Reply only to the sender= +Reply to all involved people= +Transfer message to other people= +Read=閱讀 +From=寄件者 +(No description)=(沒有描述) +No maillist=沒有郵件列表 +Receivers= +You have mail! Type /mail to read= Add=加入 Remove=移除 -Name=名稱 CC=副本 Notifications= Chat notifications= @@ -76,6 +75,7 @@ Default sorting fields= Other= Move deleted messages to trash= Automatic marking read= +Date format:= Receive a message in the chat when there is a new message= Receive a message at login when inbox isn't empty= Show an HUD notification when inbox isn't empty= @@ -84,6 +84,7 @@ Mark a message as read when opened= Reset= Settings= About=關於 +Save=儲存 Ascending= Descending= From/To= diff --git a/locale/template.txt b/locale/template.txt index c58c17c..ed940e1 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -14,42 +14,22 @@ Cancel= Save draft= Send= No contacts= -Edit= +Name= No drafts= +Edit= +To= Player name= That name is already in your contacts= The contact name cannot be empty.= Note= -Back= -Save= Maillist name= Desc= Players= That name is already in your mailing lists.= The mailing list name cannot be empty.= +Back= Mark Read= Mark Unread= -Reply= -Reply all= -Forward= -Reply only to the sender= -Reply to all involved people= -Transfer message to other people= -From= -Filter= -Allow multiple selection= -@1 of @2 selected= -(Un)select all= -No mail= -Subject= -New= -Delete= -Date= -(No description)= -No maillist= -Receivers= -You have mail! Type /mail to read= -Read= Trash= Inbox= Outbox= @@ -59,10 +39,29 @@ Mail lists= Options= Close= (No subject)= -To= +Subject= +Delete= +New= +Date= +Filter= +Allow multiple selection= +@1 of @2 selected= +(Un)select all= +No mail= +Reply= +Reply all= +Forward= +Reply only to the sender= +Reply to all involved people= +Transfer message to other people= +Read= +From= +(No description)= +No maillist= +Receivers= +You have mail! Type /mail to read= Add= Remove= -Name= CC= Notifications= Chat notifications= @@ -76,6 +75,7 @@ Default sorting fields= Other= Move deleted messages to trash= Automatic marking read= +Date format:= Receive a message in the chat when there is a new message= Receive a message at login when inbox isn't empty= Show an HUD notification when inbox isn't empty= @@ -84,6 +84,7 @@ Mark a message as read when opened= Reset= Settings= About= +Save= Ascending= Descending= From/To= diff --git a/storage.lua b/storage.lua index 3352d04..dc954e2 100644 --- a/storage.lua +++ b/storage.lua @@ -405,6 +405,7 @@ function mail.get_setting_default_value(setting_name) defaultsortdirection = 1, trash_move_enable = true, auto_marking_read = true, + date_format = "%Y-%m-%d %X", } return default_values[setting_name] end diff --git a/ui/message.lua b/ui/message.lua index 51126cd..0bb3fcf 100644 --- a/ui/message.lua +++ b/ui/message.lua @@ -39,7 +39,7 @@ function mail.show_message(name, id) local cc = minetest.formspec_escape(message.cc) or "" if string.len(cc) > 50 then cc = string.sub(cc, 1, 47) .. "..." end local date = type(message.time) == "number" - and minetest.formspec_escape(os.date("%Y-%m-%d %X", message.time)) or "" + and minetest.formspec_escape(os.date(mail.get_setting(name, "date_format"), message.time)) or "" local subject = minetest.formspec_escape(message.subject) or "" local body = minetest.formspec_escape(message.body) or "" formspec = string.format(formspec, from, to, cc, date, subject, body) diff --git a/ui/receivers.lua b/ui/receivers.lua index af13a7d..cb953be 100644 --- a/ui/receivers.lua +++ b/ui/receivers.lua @@ -31,7 +31,7 @@ function mail.show_receivers(name, id) local cc_str = mail.colors.header .. "," .. S("CC") .. ",," cc_str = cc_str .. table.concat(cc, ",,") local date = type(message.time) == "number" - and minetest.formspec_escape(os.date("%Y-%m-%d %X", message.time)) or "" + and minetest.formspec_escape(os.date(mail.get_setting(name, "date_format"), message.time)) or "" formspec = string.format(formspec, from, date, to_str, cc_str) minetest.show_formspec(name, FORMNAME, formspec) diff --git a/ui/settings.lua b/ui/settings.lua index cdd940c..b448156 100644 --- a/ui/settings.lua +++ b/ui/settings.lua @@ -3,7 +3,19 @@ local S = minetest.get_translator("mail") local FORMNAME = "mail:settings" +local date_formats = {"%Y-%m-%d %X", "%d/%m/%y %X", "%A %d %B %Y %X"} + function mail.show_settings(name) + -- date formats prepare + local dates_now = {} + local previous_date_format = mail.get_setting(name, "date_format") + local date_dropdown_index = 1 + for i, f in pairs(date_formats) do + table.insert(dates_now, os.date(f, os.time())) + if f == previous_date_format then date_dropdown_index = i end + end + local date_dropdown_str = table.concat(dates_now, ",") + local formspec = [[ size[10,6;] tabheader[0.3,1;optionstab;]] .. S("Settings") .. "," .. S("About") .. [[;1;false;false] @@ -41,6 +53,9 @@ function mail.show_settings(name) tostring(mail.get_setting(name, "trash_move_enable")) .. [[] checkbox[0,4.0;auto_marking_read;]] .. S("Automatic marking read") .. [[;]] .. tostring(mail.get_setting(name, "auto_marking_read")) .. [[] + label[0.31,4.7;]] .. S("Date format:") .. [[] + dropdown[2.7,4.6;4,0.5;date_format;]] .. date_dropdown_str .. [[;]] .. + tostring(date_dropdown_index) .. [[;true] tooltip[chat_notifications;]] .. S("Receive a message in the chat when there is a new message") .. [[] tooltip[onjoin_notifications;]] .. S("Receive a message at login when inbox isn't empty") .. [[] @@ -109,10 +124,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) mail.set_setting(playername, "trash_move_enable", mail.selected_idxs.trash_move_enable[playername]) mail.set_setting(playername, "auto_marking_read", mail.selected_idxs.auto_marking_read[playername]) -- dropdowns - local defaultsortfield = fields.defaultsortfield or mail.get_setting("defaultsortfield") - local defaultsortdirection = fields.defaultsortdirection or mail.get_setting("defaultsortdirection") + local defaultsortfield = fields.defaultsortfield or mail.get_setting(playername, "defaultsortfield") + local defaultsortdirection = fields.defaultsortdirection or mail.get_setting(playername, "defaultsortdirection") + local date_format = date_formats[tonumber(fields.date_format)] or mail.get_setting(playername, "date_format") mail.set_setting(playername, "defaultsortfield", tonumber(defaultsortfield)) mail.set_setting(playername, "defaultsortdirection", tonumber(defaultsortdirection)) + mail.set_setting(playername, "date_format", date_format) -- update visuals mail.hud_update(playername, mail.get_storage_entry(playername).inbox) mail.show_settings(playername)