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
-- translation
local S = minetest.get_translator("mail")
local f = string.format
mail.registered_on_receives = {}
@ -7,9 +10,6 @@ function mail.register_on_receive(func)
mail.registered_on_receives[#mail.registered_on_receives + 1] = func
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)
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
@ -94,12 +94,17 @@ function mail.send(m)
end
-- 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
local name = player:get_player_name()
if recipients[name] then
if mail.get_setting(name, "chat_notifications") == true then
minetest.chat_send_player(name, mail_alert)
if minetest.get_modpath("unified_inventory") then
minetest.chat_send_player(name, unified_inventory_alert)
end
end
local receiver_entry = mail.get_storage_entry(name)
local receiver_messages = receiver_entry.inbox

View File

@ -1,9 +1,5 @@
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", {
type = "image",

View File

@ -6,17 +6,14 @@ Expat (code), WTFPL (textures)=
Communication using this system is NOT guaranteed to be private!=
Admins are able to view the messages of any player.=
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
Cancel=Abbrechen
Save draft=Entwurf Speichern
Send=Senden
CC=CC
Subject=Betreff
To=An
Back=Zurück
New=Neu
Delete=Löschen
No drafts=Keine Entwürfe
Player name=Spielername
That name is already in your contacts=
@ -26,22 +23,25 @@ Desc=Beschreibung
Players=Spieler
That name is already in your mailing lists.=
The mailing list name cannot be empty.=
Save=Speichern
Mark Read=Als gelesen 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 maillist=Keine Verteilerliste
Edit=Bearbeiten
Name=Name
New=Neu
Delete=Löschen
Note=Notiz
Back=Zurück
From=Von
Reply=Antworten
Reply all=Allen antworten
Forward=Weiter
You have mail! Type /mail to read=
Read=Lesen
Filter=
Allow multiple selection=
@1 selected=
(Un)select all=
No mail=Keine Nachrichten
Inbox=Posteingang
Sent messages=Nachrichten senden
Drafts=Entwürfe
@ -50,8 +50,15 @@ Mail lists=Verteilerlisten
Options=
Close=Schließen
(No subject)=(Kein Betreff)
Reply=Antworten
Reply all=Allen antworten
Forward=Weiter
Date=Datum
Ascending=
Descending=
Add=Hinzufügen
Remove=Entfernen
To=An
Notifications=
Chat notifications=
On join notifications=
@ -64,19 +71,4 @@ From/To=Von/An
Reset=
Settings=
About=Über
Save=Speichern
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
Subject=Betreff

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 !
Admins are able to view the messages of any player.=Les administrateurs peuvent voir les messages de chaque joueur.
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
Cancel=Annuler
Save draft=Enregistrer le brouillon
Send=Envoyer
CC=Cc
Subject=Objet
To=À
Back=Retour
New=Nouveau
Delete=Supprimer
No drafts=Pas de brouillons
Player name=Nom du joueur
That name is already in your contacts=Ce nom est déjà dans vos contacts
@ -26,22 +23,25 @@ Desc=Desc
Players=Joueurs
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.
Save=Sauvegarder
Mark Read=Marquer comme 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 maillist=Aucune liste de diffusion
Edit=Modifier
Name=Nom
New=Nouveau
Delete=Supprimer
Note=Note
Back=Retour
From=De
Reply=Répondre
Reply all=Répondre à tous
Forward=Transférer
You have mail! Type /mail to read=Vous avez reçu un mail ! Entrez /mail pour le consulter
Read=Lire
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
Sent messages=Messages envoyés
Drafts=Brouillons
@ -50,8 +50,15 @@ Mail lists=Listes de diffusion
Options=Options
Close=Fermer
(No subject)=(Sans objet)
Reply=Répondre
Reply all=Répondre à tous
Forward=Transférer
Date=Date
Ascending=Croissant
Descending=Décroissant
Add=Ajouter
Remove=Enlever
To=À
Notifications=Notifications
Chat notifications=Notifications dans le tchat
On join notifications=Notifications à la connexion
@ -64,7 +71,4 @@ From/To=De/À
Reset=Réinitialiser
Settings=Paramètres
About=À propos
Save=Sauvegarder
Ascending=Croissant
Descending=Décroissant
Date=Date
Subject=Objet

View File

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

View File

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

View File

@ -1,3 +1,6 @@
-- translation
local S = minetest.get_translator("mail")
minetest.register_on_joinplayer(function(player)
minetest.after(2, function(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
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, player:get_player_name())
end)

View File

@ -34,7 +34,7 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] ..
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") .. [[]
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") .. [[;]] ..
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") .. [[]
tablecolumns[color;text;text]