Add internationalization (and French translation) (#30)

* Add translation tags

* Add translating template.txt

* Add French translation

* Rework buttons size to fix UI due to big translations

* Add translations for selecting contacts
This commit is contained in:
Athozus 2023-03-29 19:23:16 +02:00 committed by GitHub
parent b3e0c158f7
commit eae547b2f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 235 additions and 96 deletions

View File

@ -30,6 +30,10 @@ if minetest.get_modpath("default") then
mail.theme = default.gui_bg .. default.gui_bg_img
end
-- translation
S = minetest.get_translator("mail")
-- sub files
local MP = minetest.get_modpath(minetest.get_current_modname())
dofile(MP .. "/util/normalize.lua")
dofile(MP .. "/util/uuid.lua")

46
locale/mail.fr.tr Normal file
View File

@ -0,0 +1,46 @@
# textdomain: mail
BCC=Cci
Cancel=Annuler
Send=Envoyer
Player name=Nom du joueur
your contacts.=vos contacts.
The contact=Ce contact
Save=Sauvegarder
That name=Ce nom
is already in=existe déjà
name cannot=nom ne peut pas
be empty.=être vide.
Note=Note
Maillist name=Nom de la liste de diffusion
Desc=Desc
Players=Joueurs
your maillists.=vos listes de diffusion.
The maillist=Cette liste de diffusion
Back=Retour
Mark Read=Marquer comme lu
Mark Unread=Marquer non lu
Delete=Supprimer
New=Nouveau
From=De
Inbox=Boîte de réception
Sent messages=Messages envoyés
Read=Lire
Contacts=Contacts
Mail lists=Listes de diffusion
About=À propos
Close=Fermer
(No subject)=(Sans objet)
No mail=Aucun mail
Reply=Répondre
Reply all=Répondre à tous
Forward=Transférer
Subject=Objet
(No description)=Sans description
No maillist=Aucune liste de diffusion
Edit=Modifier
Name=Nom
Date=Date
Add=Ajouter
Remove=Enlever
CC=Cc
To=À

44
locale/mail.fr.tr.old Normal file
View File

@ -0,0 +1,44 @@
# textdomain: mail
BCC=Cci
Cancel=Annuler
Send=Envoyer
Note=Note
Back=Retour
Delete=Supprimer
Edit=Modifier
Name=Nom
Player name=Nom du joueur
your contacts.=vos contacts.
The contact=Ce contact
Maillist name=Nom de la liste de diffusion
Desc=Desc
Players=Joueurs
your maillists.=vos listes de diffusion.
The maillist=Cette liste de diffusion
Save=Sauvegarder
That name=Ce nom
is already in=existe déjà
name cannot=nom ne peut pas
be empty.=être vide.
Mark Read=Marquer comme lu
Mark Unread=Marquer non lu
New=Nouveau
From=De
Reply=Répondre
Reply all=Répondre à tous
Forward=Transférer
Subject=Objet
Inbox=Boîte de réception
Sent messages=Messages envoyés
Read=Lire
Contacts=Contacts
Mail lists=Listes de diffusion
About=À propos
Close=Fermer
(No subject)=(Sans objet)
No mail=Aucun mail
(No description)=Sans description
No maillist=Aucune liste de diffusion
Date=Date
CC=Cc
To=À

46
locale/template.txt Normal file
View File

@ -0,0 +1,46 @@
# textdomain: mail
BCC=
Cancel=
Send=
Player name=
your contacts.=
The contact=
Save=
That name=
is already in=
name cannot=
be empty.=
Note=
Maillist name=
Desc=
Players=
your maillists.=
The maillist=
Back=
Mark Read=
Mark Unread=
Delete=
New=
From=
Inbox=
Sent messages=
Read=
Contacts=
Mail lists=
About=
Close=
(No subject)=
No mail=
Reply=
Reply all=
Forward=
Subject=
(No description)=
No maillist=
Edit=
Name=
Date=
Add=
Remove=
CC=
To=

View File

@ -3,16 +3,16 @@ local FORMNAME = "mail:compose"
function mail.show_compose(name, to, subject, body, cc, bcc)
local formspec = [[
size[8,9]
button[0,0;1,1;tocontacts;To:]
button[0,0;1,1;tocontacts;]] .. S("To") .. [[:]
field[1.1,0.3;3.2,1;to;;%s]
button[4,0;1,1;cccontacts;CC:]
button[4,0;1,1;cccontacts;]] .. S("CC") .. [[:]
field[5.1,0.3;3.1,1;cc;;%s]
button[4,0.75;1,1;bcccontacts;BCC:]
button[4,0.75;1,1;bcccontacts;]] .. S("BCC") .. [[:]
field[5.1,1.05;3.1,1;bcc;;%s]
field[0.25,2;8,1;subject;Subject:;%s]
field[0.25,2;8,1;subject;]] .. S("Subject") .. [[:;%s]
textarea[0.25,2.5;8,6;body;;%s]
button[0.5,8.5;3,1;cancel;Cancel]
button[4.5,8.5;3,1;send;Send]
button[0.5,8.5;3,1;cancel;]] .. S("Cancel") .. [[]
button[4.5,8.5;3,1;send;]] .. S("Send") .. [[]
]] .. mail.theme
formspec = string.format(formspec,
@ -86,4 +86,4 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
return true
end)
end)

View File

@ -1,12 +1,12 @@
local FORMNAME = "mail:contacts"
local contacts_formspec = "size[8,9;]" .. mail.theme .. [[
button[6,0.10;2,0.5;new;New]
button[6,0.85;2,0.5;edit;Edit]
button[6,1.60;2,0.5;delete;Delete]
button[6,8.25;2,0.5;back;Back]
button[6,0.10;2,0.5;new;]] .. S("New") .. [[]
button[6,0.85;2,0.5;edit;]] .. S("Edit") .. [[]
button[6,1.60;2,0.5;delete;]] .. S("Delete") .. [[]
button[6,8.25;2,0.5;back;]] .. S("Back") .. [[]
tablecolumns[color;text;text]
table[0,0;5.75,9;contacts;#999,Name,Note]]
table[0,0;5.75,9;contacts;#999,]] .. S("Name") .. "," .. S("Note")
function mail.show_contacts(name)
@ -80,4 +80,4 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
return true
end)
end)

View File

@ -3,22 +3,22 @@ local FORMNAME = "mail:editcontact"
function mail.show_edit_contact(name, contact_name, note, illegal_name_hint)
local formspec = [[
size[6,7]
button[4,6.25;2,0.5;back;Back]
field[0.25,0.5;4,1;name;Player name:;%s]
textarea[0.25,1.6;4,6.25;note;Note:;%s]
button[4,0.10;2,1;save;Save]
button[4,6.25;2,0.5;back;]] .. S("Back") .. [[]
field[0.25,0.5;4,1;name;]] .. S("Player name") .. [[:;%s]
textarea[0.25,1.6;4,6.25;note;]] .. S("Note") .. [[:;%s]
button[4,0.10;2,1;save;]] .. S("Save") .. [[]
]]
if illegal_name_hint == "collision" then
formspec = formspec .. [[
label[4,1;That name]
label[4,1.5;is already in]
label[4,2;your contacts.]
label[4,1;]] .. S("That name") .. [[]
label[4,1.5;]] .. S("is already in") .. [[]
label[4,2;]] .. S("your contacts.") .. [[]
]]
elseif illegal_name_hint == "empty" then
formspec = formspec .. [[
label[4,1;The contact]
label[4,1.5;name cannot]
label[4,2;be empty.]
label[4,1;]] .. S("The contact") .. [[]
label[4,1.5;]] .. S("name cannot") .. [[]
label[4,2;]] .. S("be empty.") .. [[]
]]
end
formspec = formspec .. mail.theme
@ -71,4 +71,4 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
return true
end)
end)

View File

@ -3,23 +3,23 @@ local FORMNAME = "mail:editmaillist"
function mail.show_edit_maillist(playername, maillist_name, desc, players, illegal_name_hint)
local formspec = [[
size[6,7]
button[4,6.25;2,0.5;back;Back]
field[0.25,0.5;4,1;name;Maillist name:;%s]
textarea[0.25,1.6;4,2;desc;Desc:;%s]
textarea[0.25,3.6;4,4.25;players;Players:;%s]
button[4,0.10;2,1;save;Save]
button[4,6.25;2,0.5;back;]] .. S("Back") .. [[]
field[0.25,0.5;4,1;name;]] .. S("Maillist name") .. [[:;%s]
textarea[0.25,1.6;4,2;desc;]] .. S("Desc") .. [[:;%s]
textarea[0.25,3.6;4,4.25;players;]] .. S("Players") .. [[:;%s]
button[4,0.10;2,1;save;]] .. S("Save") .. [[]
]]
if illegal_name_hint == "collision" then
formspec = formspec .. [[
label[4,1;That name]
label[4,1.5;is already in]
label[4,2;your maillists.]
label[4,1;]] .. S("That name") .. [[]
label[4,1.5;]] .. S("is already in") .. [[]
label[4,2;]] .. S("your maillists.") .. [[]
]]
elseif illegal_name_hint == "empty" then
formspec = formspec .. [[
label[4,1;The maillist]
label[4,1.5;name cannot]
label[4,2;be empty.]
label[4,1;]] .. S("The maillist") .. [[]
label[4,1.5;]] .. S("name cannot") .. [[]
label[4,2;]] .. S("be empty.") .. [[]
]]
end
formspec = formspec .. mail.theme
@ -50,4 +50,4 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
return true
end)
end)

View File

@ -1,21 +1,21 @@
local inbox_formspec = "size[8,10;]" .. mail.theme .. [[
tabheader[0.3,1;boxtab;Inbox,Sent messages;1;false;false]
local inbox_formspec = "size[8.5,10;]" .. mail.theme .. [[
tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Sent messages") .. [[;1;false;false]
button[6,0.10;2,0.5;new;New]
button[6,0.95;2,0.5;read;Read]
button[6,1.70;2,0.5;reply;Reply]
button[6,2.45;2,0.5;replyall;Reply All]
button[6,3.20;2,0.5;forward;Forward]
button[6,3.95;2,0.5;delete;Delete]
button[6,4.82;2,0.5;markread;Mark Read]
button[6,5.55;2,0.5;markunread;Mark Unread]
button[6,6.8;2,0.5;contacts;Contacts]
button[6,7.6;2,0.5;maillists;Mail lists]
button[6,8.7;2,0.5;about;About]
button_exit[6,9.5;2,0.5;quit;Close]
button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[]
button[6,0.95;2.5,0.5;read;]] .. S("Read") .. [[]
button[6,1.70;2.5,0.5;reply;]] .. S("Reply") .. [[]
button[6,2.45;2.5,0.5;replyall;]] .. S("Reply all") .. [[]
button[6,3.20;2.5,0.5;forward;]] .. S("Forward") .. [[]
button[6,3.95;2.5,0.5;delete;]] .. S("Delete") .. [[]
button[6,4.82;2.5,0.5;markread;]] .. S("Mark Read") .. [[]
button[6,5.55;2.5,0.5;markunread;]] .. S("Mark Unread") .. [[]
button[6,6.8;2.5,0.5;contacts;]] .. S("Contacts") .. [[]
button[6,7.6;2.5,0.5;maillists;]] .. S("Mail lists") .. [[]
button[6,8.7;2.5,0.5;about;]] .. S("About") .. [[]
button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[]
tablecolumns[color;text;text]
table[0,0.7;5.75,9.35;inbox;#999,From,Subject]]
table[0,0.7;5.75,9.35;inbox;#999,]] .. S("From") .. "," .. S("Subject")
function mail.show_inbox(name)
@ -51,7 +51,7 @@ function mail.show_inbox(name)
formspec[#formspec + 1] = minetest.formspec_escape(message.subject)
end
else
formspec[#formspec + 1] = "(No subject)"
formspec[#formspec + 1] = S("(No subject)")
end
end
if mail.selected_idxs.inbox[name] then
@ -60,7 +60,7 @@ function mail.show_inbox(name)
end
formspec[#formspec + 1] = "]"
else
formspec[#formspec + 1] = "]label[2.25,4.5;No mail]"
formspec[#formspec + 1] = "]label[2.25,4.5;" .. S("No mail") .. "]"
end
minetest.show_formspec(name, "mail:inbox", table.concat(formspec, ""))
end

View File

@ -1,12 +1,12 @@
local FORMNAME = "mail:maillists"
local maillists_formspec = "size[8,9;]" .. mail.theme .. [[
button[6,0.10;2,0.5;new;New]
button[6,0.85;2,0.5;edit;Edit]
button[6,1.60;2,0.5;delete;Delete]
button[6,8.25;2,0.5;back;Back]
button[6,0.10;2,0.5;new;]] .. S("New") .. [[]
button[6,0.85;2,0.5;edit;]] .. S("Edit") .. [[]
button[6,1.60;2,0.5;delete;]] .. S("Delete") .. [[]
button[6,8.25;2,0.5;back;]] .. S("Back") .. [[]
tablecolumns[color;text;text]
table[0,0;5.75,9;maillists;#999,Name,Description]]
table[0,0;5.75,9;maillists;#999,]] .. S("Name") .. "," .. S("Note")
function mail.show_maillists(name)
local formspec = { maillists_formspec }
@ -26,7 +26,7 @@ function mail.show_maillists(name)
formspec[#formspec + 1] = minetest.formspec_escape(maillist.desc)
end
else
formspec[#formspec + 1] = "(No description)"
formspec[#formspec + 1] = S("(No description)")
end
end
if mail.selected_idxs.maillists[name] then
@ -35,7 +35,7 @@ function mail.show_maillists(name)
end
formspec[#formspec + 1] = "]"
else
formspec[#formspec + 1] = "]label[2.25,4.5;No maillist]"
formspec[#formspec + 1] = "]label[2.25,4.5;" .. S("No maillist") .. "]"
end
minetest.show_formspec(name, FORMNAME, table.concat(formspec, ""))
end
@ -107,4 +107,4 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
return true
end)
end)

View File

@ -10,18 +10,18 @@ function mail.show_message(name, id)
button[7.25,0.15;0.75,0.5;back;X]
label[0.2,0.1;From: %s]
label[0.2,0.5;To: %s]
label[0.2,0.9;CC: %s]
label[0.2,1.3;Date: %s]
label[0.2,0.1;]] .. S("From") .. [[: %s]
label[0.2,0.5;]] .. S("To") .. [[: %s]
label[0.2,0.9;]] .. S("CC") .. [[: %s]
label[0.2,1.3;]] .. S("Date") .. [[: %s]
label[0,2.1;Subject: %s]
label[0,2.1;]] .. S("Subject") .. [[: %s]
textarea[0.25,2.6;8,7.0;;;%s]
button[0,8.5;2,1;reply;Reply]
button[2,8.5;2,1;replyall;Reply All]
button[4,8.5;2,1;forward;Forward]
button[6,8.5;2,1;delete;Delete]
button[0,8.5;2,1;reply;]] .. S("Reply") .. [[]
button[2,8.5;2,1;replyall;]] .. S("Reply all") .. [[]
button[4,8.5;2,1;forward;]] .. S("Forward") .. [[]
button[6,8.5;2,1;delete;]] .. S("Delete") .. [[]
]] .. mail.theme
local from = minetest.formspec_escape(message.from) or ""
@ -133,4 +133,4 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
return true
end)
end)

View File

@ -1,20 +1,19 @@
local sent_formspec = "size[8.5,10;]" .. mail.theme .. [[
tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Sent messages") .. [[;2;false;false]
local sent_formspec = "size[8,10;]" .. mail.theme .. [[
tabheader[0.3,1;boxtab;Inbox,Sent messages;2;false;false]
button[6,0.10;2,0.5;new;New]
button[6,0.95;2,0.5;read;Read]
button[6,1.70;2,0.5;reply;Reply]
button[6,2.45;2,0.5;replyall;Reply All]
button[6,3.20;2,0.5;forward;Forward]
button[6,3.95;2,0.5;delete;Delete]
button[6,6.8;2,0.5;contacts;Contacts]
button[6,7.6;2,0.5;maillists;Mail lists]
button[6,8.7;2,0.5;about;About]
button_exit[6,9.5;2,0.5;quit;Close]
button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[]
button[6,0.95;2.5,0.5;read;]] .. S("Read") .. [[]
button[6,1.70;2.5,0.5;reply;]] .. S("Reply") .. [[]
button[6,2.45;2.5,0.5;replyall;]] .. S("Reply all") .. [[]
button[6,3.20;2.5,0.5;forward;]] .. S("Forward") .. [[]
button[6,3.95;2.5,0.5;delete;]] .. S("Delete") .. [[]
button[6,6.8;2.5,0.5;contacts;]] .. S("Contacts") .. [[]
button[6,7.6;2.5,0.5;maillists;]] .. S("Mail lists") .. [[]
button[6,8.7;2.5,0.5;about;]] .. S("About") .. [[]
button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[]
tablecolumns[color;text;text]
table[0,0.7;5.75,9.35;sent;#999,To,Subject]]
table[0,0.7;5.75,9.35;sent;#999,]] .. S("To") .. "," .. S("Subject")
function mail.show_sent(name)
@ -38,7 +37,7 @@ function mail.show_sent(name)
formspec[#formspec + 1] = minetest.formspec_escape(message.subject)
end
else
formspec[#formspec + 1] = "(No subject)"
formspec[#formspec + 1] = S("(No subject)")
end
end
if mail.selected_idxs.sent[name] then
@ -47,7 +46,7 @@ function mail.show_sent(name)
end
formspec[#formspec + 1] = "]"
else
formspec[#formspec + 1] = "]label[2.25,4.5;No mail]"
formspec[#formspec + 1] = "]label[2.25,4.5;" .. S("No mail") .. "]"
end
minetest.show_formspec(name, "mail:sent", table.concat(formspec, ""))
end

View File

@ -2,16 +2,16 @@ local FORMNAME = "mail:selectcontact"
local select_contact_formspec = "size[8,9;]" .. mail.theme .. [[
tablecolumns[color;text;text]
table[0,0;3.5,9;contacts;#999,Name,Note%s]
button[3.55,2.00;1.75,0.5;toadd; Add]
button[3.55,2.75;1.75,0.5;toremove; Remove]
button[3.55,6.00;1.75,0.5;ccadd; Add]
button[3.55,6.75;1.75,0.5;ccremove; Remove]
table[0,0;3.5,9;contacts;#999,]] .. S("Name") .. "," .. S("Note") .. [[%s]
button[3.55,2.00;1.75,0.5;toadd; ]] .. S("Add") .. [[]
button[3.55,2.75;1.75,0.5;toremove; ]] .. S("Remove") .. [[]
button[3.55,6.00;1.75,0.5;ccadd; ]] .. S("Add") .. [[]
button[3.55,6.75;1.75,0.5;ccremove; ]] .. S("Remove") .. [[]
tablecolumns[color;text;text]
table[5.15,0.0;2.75,4.5;to;#999,TO:,Note%s]
table[5.15,0.0;2.75,4.5;to;#999,]] .. S("To") .. ":," .. S("Note") .. [[%s]
tablecolumns[color;text;text]
table[5.15,4.6;2.75,4.5;cc;#999,CC:,Note%s]
button[3.55,8.25;1.75,0.5;back;Back]
table[5.15,4.6;2.75,4.5;cc;#999,]] .. S("CC") .. ":," .. S("Note") .. [[%s]
button[3.55,8.25;1.75,0.5;back;]] .. S("Back") .. [[]
]]
@ -112,4 +112,4 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
mail.show_compose(name, draft.to, draft.subject, draft.body, draft.cc, draft.bcc)
return true
end)
end)