Translate formatted strings

This commit is contained in:
Athozus 2023-05-05 16:05:07 +02:00
parent 95ab299016
commit 5e3cfedc5e
No known key found for this signature in database
GPG Key ID: B50895022E8484BF
9 changed files with 107 additions and 99 deletions

13
api.lua
View File

@ -1,5 +1,8 @@
-- see: mail.md -- see: mail.md
-- translation
local S = minetest.get_translator("mail")
local f = string.format local f = string.format
mail.registered_on_receives = {} mail.registered_on_receives = {}
@ -7,9 +10,6 @@ function mail.register_on_receive(func)
mail.registered_on_receives[#mail.registered_on_receives + 1] = func mail.registered_on_receives[#mail.registered_on_receives + 1] = func
end end
mail.receive_mail_message = "You have a new message from %s! Subject: %s\nTo view it, type /mail"
mail.read_later_message = "You can read your messages later by using the /mail command"
function mail.send(m) function mail.send(m)
if type(m.from) ~= "string" then return false, "'from' is not a string" end if type(m.from) ~= "string" then return false, "'from' is not a string" end
if type(m.to) ~= "string" then return false, "'to' is not a string" end if type(m.to) ~= "string" then return false, "'to' is not a string" end
@ -94,12 +94,17 @@ function mail.send(m)
end end
-- notify recipients that happen to be online -- notify recipients that happen to be online
local mail_alert = f(mail.receive_mail_message, m.from, m.subject) local mail_alert = S("You have a new message from @1! Subject: @2", m.from, m.subject) ..
"\n" .. S("To view it, type /mail")
local unified_inventory_alert = S("You could also use the button in your inventory.")
for _, player in ipairs(minetest.get_connected_players()) do for _, player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name() local name = player:get_player_name()
if recipients[name] then if recipients[name] then
if mail.get_setting(name, "chat_notifications") == true then if mail.get_setting(name, "chat_notifications") == true then
minetest.chat_send_player(name, mail_alert) minetest.chat_send_player(name, mail_alert)
if minetest.get_modpath("unified_inventory") then
minetest.chat_send_player(name, unified_inventory_alert)
end
end end
local receiver_entry = mail.get_storage_entry(name) local receiver_entry = mail.get_storage_entry(name)
local receiver_messages = receiver_entry.inbox local receiver_messages = receiver_entry.inbox

View File

@ -1,9 +1,5 @@
if minetest.get_modpath("unified_inventory") then if minetest.get_modpath("unified_inventory") then
mail.receive_mail_message = mail.receive_mail_message ..
" or use the mail button in the inventory"
mail.read_later_message = mail.read_later_message ..
" or by using the mail button in the inventory"
unified_inventory.register_button("mail", { unified_inventory.register_button("mail", {
type = "image", type = "image",

View File

@ -6,17 +6,14 @@ Expat (code), WTFPL (textures)=
Communication using this system is NOT guaranteed to be private!= Communication using this system is NOT guaranteed to be private!=
Admins are able to view the messages of any player.= Admins are able to view the messages of any player.=
Contributors= Contributors=
Note=Notiz You have a new message from @1! Subject: @2=
To view it, type /mail=
You could also use the button in your inventory.=
BCC=BCC BCC=BCC
Cancel=Abbrechen Cancel=Abbrechen
Save draft=Entwurf Speichern Save draft=Entwurf Speichern
Send=Senden Send=Senden
CC=CC CC=CC
Subject=Betreff
To=An
Back=Zurück
New=Neu
Delete=Löschen
No drafts=Keine Entwürfe No drafts=Keine Entwürfe
Player name=Spielername Player name=Spielername
That name is already in your contacts= That name is already in your contacts=
@ -26,22 +23,25 @@ Desc=Beschreibung
Players=Spieler Players=Spieler
That name is already in your mailing lists.= That name is already in your mailing lists.=
The mailing list name cannot be empty.= The mailing list name cannot be empty.=
Save=Speichern
Mark Read=Als gelesen makieren Mark Read=Als gelesen makieren
Mark Unread=Als ungelesen makieren Mark Unread=Als ungelesen makieren
Read=Lesen
Filter=
Allow multiple selection=
selected=
(Un)select all=
No mail=Keine Nachrichten
(No description)=(Keine Beschreibung) (No description)=(Keine Beschreibung)
No maillist=Keine Verteilerliste No maillist=Keine Verteilerliste
Edit=Bearbeiten Edit=Bearbeiten
Name=Name Name=Name
New=Neu
Delete=Löschen
Note=Notiz
Back=Zurück
From=Von From=Von
Reply=Antworten You have mail! Type /mail to read=
Reply all=Allen antworten Read=Lesen
Forward=Weiter Filter=
Allow multiple selection=
@1 selected=
(Un)select all=
No mail=Keine Nachrichten
Inbox=Posteingang Inbox=Posteingang
Sent messages=Nachrichten senden Sent messages=Nachrichten senden
Drafts=Entwürfe Drafts=Entwürfe
@ -50,8 +50,15 @@ Mail lists=Verteilerlisten
Options= Options=
Close=Schließen Close=Schließen
(No subject)=(Kein Betreff) (No subject)=(Kein Betreff)
Reply=Antworten
Reply all=Allen antworten
Forward=Weiter
Date=Datum
Ascending=
Descending=
Add=Hinzufügen Add=Hinzufügen
Remove=Entfernen Remove=Entfernen
To=An
Notifications= Notifications=
Chat notifications= Chat notifications=
On join notifications= On join notifications=
@ -64,19 +71,4 @@ From/To=Von/An
Reset= Reset=
Settings= Settings=
About=Über About=Über
Save=Speichern Subject=Betreff
Ascending=
Descending=
Date=Datum
##### not used anymore #####
That name=Der Name
is already in=ist bereits in
your maillists.=ihre Verteilerlisten.
The maillist=Die Verteilerliste
name cannot=Name kann nicht
be empty.=leer sein.
your contacts.=ihre Kontakte.
The contact=Der Kontakt

View File

@ -6,17 +6,14 @@ Expat (code), WTFPL (textures)=Expat (code), WTFPL (textures)
Communication using this system is NOT guaranteed to be private!=La communication par ce système n'est pas garantie d'être privée ! Communication using this system is NOT guaranteed to be private!=La communication par ce système n'est pas garantie d'être privée !
Admins are able to view the messages of any player.=Les administrateurs peuvent voir les messages de chaque joueur. Admins are able to view the messages of any player.=Les administrateurs peuvent voir les messages de chaque joueur.
Contributors=Contributeurs Contributors=Contributeurs
Note=Note You have a new message from @1! Subject: @2=Vous avez un nouveau message de @1 ! Objet : @2
To view it, type /mail=Pour le consulter, entrez /mail
You could also use the button in your inventory.=Vous pouvez également utiliser le bouton dans votre inventaire
BCC=Cci BCC=Cci
Cancel=Annuler Cancel=Annuler
Save draft=Enregistrer le brouillon Save draft=Enregistrer le brouillon
Send=Envoyer Send=Envoyer
CC=Cc CC=Cc
Subject=Objet
To=À
Back=Retour
New=Nouveau
Delete=Supprimer
No drafts=Pas de brouillons No drafts=Pas de brouillons
Player name=Nom du joueur Player name=Nom du joueur
That name is already in your contacts=Ce nom est déjà dans vos contacts That name is already in your contacts=Ce nom est déjà dans vos contacts
@ -26,22 +23,25 @@ Desc=Desc
Players=Joueurs Players=Joueurs
That name is already in your mailing lists.=Ce nom est déjà dans vos listes de diffusion. That name is already in your mailing lists.=Ce nom est déjà dans vos listes de diffusion.
The mailing list name cannot be empty.=Le nom de la liste de diffusion ne peut pas être vide. The mailing list name cannot be empty.=Le nom de la liste de diffusion ne peut pas être vide.
Save=Sauvegarder
Mark Read=Marquer comme lu Mark Read=Marquer comme lu
Mark Unread=Marquer non lu Mark Unread=Marquer non lu
Read=Lire
Filter=Filtre
Allow multiple selection=Autoriser la sélection multiple
selected=sélectionnés
(Un)select all=Tout (dé)selectionner
No mail=Aucun mail
(No description)=Sans description (No description)=Sans description
No maillist=Aucune liste de diffusion No maillist=Aucune liste de diffusion
Edit=Modifier Edit=Modifier
Name=Nom Name=Nom
New=Nouveau
Delete=Supprimer
Note=Note
Back=Retour
From=De From=De
Reply=Répondre You have mail! Type /mail to read=Vous avez reçu un mail ! Entrez /mail pour le consulter
Reply all=Répondre à tous Read=Lire
Forward=Transférer Filter=Filtre
Allow multiple selection=Autoriser la sélection multiple
@1 selected=@1 sélectionnés
(Un)select all=Tout (dé)selectionner
No mail=Aucun mail
Inbox=Boîte de réception Inbox=Boîte de réception
Sent messages=Messages envoyés Sent messages=Messages envoyés
Drafts=Brouillons Drafts=Brouillons
@ -50,8 +50,15 @@ Mail lists=Listes de diffusion
Options=Options Options=Options
Close=Fermer Close=Fermer
(No subject)=(Sans objet) (No subject)=(Sans objet)
Reply=Répondre
Reply all=Répondre à tous
Forward=Transférer
Date=Date
Ascending=Croissant
Descending=Décroissant
Add=Ajouter Add=Ajouter
Remove=Enlever Remove=Enlever
To=À
Notifications=Notifications Notifications=Notifications
Chat notifications=Notifications dans le tchat Chat notifications=Notifications dans le tchat
On join notifications=Notifications à la connexion On join notifications=Notifications à la connexion
@ -64,7 +71,4 @@ From/To=De/À
Reset=Réinitialiser Reset=Réinitialiser
Settings=Paramètres Settings=Paramètres
About=À propos About=À propos
Save=Sauvegarder Subject=Objet
Ascending=Croissant
Descending=Décroissant
Date=Date

View File

@ -6,17 +6,14 @@ Expat (code), WTFPL (textures)=
Communication using this system is NOT guaranteed to be private!= Communication using this system is NOT guaranteed to be private!=
Admins are able to view the messages of any player.= Admins are able to view the messages of any player.=
Contributors= Contributors=
Note=備註 You have a new message from @1! Subject: @2=
To view it, type /mail=
You could also use the button in your inventory.=
BCC=密件副本 BCC=密件副本
Cancel=取消 Cancel=取消
Save draft=儲存草稿 Save draft=儲存草稿
Send=發送 Send=發送
CC=副本 CC=副本
Subject=主旨
To=收件人
Back=返回
New=新建
Delete=刪除
No drafts=沒有草稿 No drafts=沒有草稿
Player name=玩家名稱 Player name=玩家名稱
That name is already in your contacts= That name is already in your contacts=
@ -26,22 +23,25 @@ Desc=描述
Players=玩家 Players=玩家
That name is already in your mailing lists.= That name is already in your mailing lists.=
The mailing list name cannot be empty.= The mailing list name cannot be empty.=
Save=儲存
Mark Read=標記已讀 Mark Read=標記已讀
Mark Unread=標記未讀 Mark Unread=標記未讀
Read=閱讀
Filter=
Allow multiple selection=
selected=
(Un)select all=
No mail=沒有郵件
(No description)=(沒有描述) (No description)=(沒有描述)
No maillist=沒有郵件列表 No maillist=沒有郵件列表
Edit=編輯 Edit=編輯
Name=名稱 Name=名稱
New=新建
Delete=刪除
Note=備註
Back=返回
From=寄件者 From=寄件者
Reply=回覆 You have mail! Type /mail to read=
Reply all=回覆所有人 Read=閱讀
Forward=轉寄 Filter=
Allow multiple selection=
@1 selected=
(Un)select all=
No mail=沒有郵件
Inbox=收件箱 Inbox=收件箱
Sent messages=寄件備份 Sent messages=寄件備份
Drafts=草稿 Drafts=草稿
@ -50,8 +50,15 @@ Mail lists=郵件列表
Options= Options=
Close=關閉 Close=關閉
(No subject)=(沒有主旨) (No subject)=(沒有主旨)
Reply=回覆
Reply all=回覆所有人
Forward=轉寄
Date=日期
Ascending=
Descending=
Add=加入 Add=加入
Remove=移除 Remove=移除
To=收件人
Notifications= Notifications=
Chat notifications= Chat notifications=
On join notifications= On join notifications=
@ -64,7 +71,4 @@ From/To=
Reset= Reset=
Settings= Settings=
About=關於 About=關於
Save=儲存 Subject=主旨
Ascending=
Descending=
Date=日期

View File

@ -6,17 +6,14 @@ Expat (code), WTFPL (textures)=
Communication using this system is NOT guaranteed to be private!= Communication using this system is NOT guaranteed to be private!=
Admins are able to view the messages of any player.= Admins are able to view the messages of any player.=
Contributors= Contributors=
Note= You have a new message from @1! Subject: @2=
To view it, type /mail=
You could also use the button in your inventory.=
BCC= BCC=
Cancel= Cancel=
Save draft= Save draft=
Send= Send=
CC= CC=
Subject=
To=
Back=
New=
Delete=
No drafts= No drafts=
Player name= Player name=
That name is already in your contacts= That name is already in your contacts=
@ -26,22 +23,25 @@ Desc=
Players= Players=
That name is already in your mailing lists.= That name is already in your mailing lists.=
The mailing list name cannot be empty.= The mailing list name cannot be empty.=
Save=
Mark Read= Mark Read=
Mark Unread= Mark Unread=
Read=
Filter=
Allow multiple selection=
selected=
(Un)select all=
No mail=
(No description)= (No description)=
No maillist= No maillist=
Edit= Edit=
Name= Name=
New=
Delete=
Note=
Back=
From= From=
Reply= You have mail! Type /mail to read=
Reply all= Read=
Forward= Filter=
Allow multiple selection=
@1 selected=
(Un)select all=
No mail=
Inbox= Inbox=
Sent messages= Sent messages=
Drafts= Drafts=
@ -50,8 +50,15 @@ Mail lists=
Options= Options=
Close= Close=
(No subject)= (No subject)=
Reply=
Reply all=
Forward=
Date=
Ascending=
Descending=
Add= Add=
Remove= Remove=
To=
Notifications= Notifications=
Chat notifications= Chat notifications=
On join notifications= On join notifications=
@ -64,7 +71,4 @@ From/To=
Reset= Reset=
Settings= Settings=
About= About=
Save= Subject=
Ascending=
Descending=
Date=

View File

@ -1,3 +1,6 @@
-- translation
local S = minetest.get_translator("mail")
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
minetest.after(2, function(name) minetest.after(2, function(name)
local entry = mail.get_storage_entry(name) local entry = mail.get_storage_entry(name)
@ -14,7 +17,7 @@ minetest.register_on_joinplayer(function(player)
if unreadcount > 0 and mail.get_setting(name, "onjoin_notifications") then if unreadcount > 0 and mail.get_setting(name, "onjoin_notifications") then
minetest.chat_send_player(name, minetest.chat_send_player(name,
minetest.colorize("#00f529", "(" .. unreadcount .. ") You have mail! Type /mail to read")) minetest.colorize("#00f529", "(" .. unreadcount .. ") " .. S("You have mail! Type /mail to read")))
end end
end, player:get_player_name()) end, player:get_player_name())
end) end)

View File

@ -34,7 +34,7 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] .. checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] ..
tostring(mail.selected_idxs.multipleselection[name]) .. [[] tostring(mail.selected_idxs.multipleselection[name]) .. [[]
label[0,9.65;]] .. tostring(#mail.selected_idxs.inbox[name]) .. " " .. S("selected") .. [[] label[0,9.65;]] .. S("@1 selected", tostring(#mail.selected_idxs.inbox[name])) .. [[]
button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[] button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[]
tablecolumns[color;text;text] tablecolumns[color;text;text]

View File

@ -32,7 +32,7 @@ function mail.show_sent(name, sortfieldindex, sortdirection, filter)
checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] .. checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] ..
tostring(mail.selected_idxs.multipleselection[name]) .. [[] tostring(mail.selected_idxs.multipleselection[name]) .. [[]
label[0,9.65;]] .. tostring(#mail.selected_idxs.sent[name]) .. " " .. S("selected") .. [[] label[0,9.65;]] .. S("@1 selected", tostring(#mail.selected_idxs.sent[name])) .. [[]
button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[] button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[]
tablecolumns[color;text;text] tablecolumns[color;text;text]