fat115: added intllib support
* added intllib support * and french translation * one string translatedmaster
parent
9b8c3f76f3
commit
046eccf148
|
@ -1 +1,2 @@
|
|||
default
|
||||
intllib?
|
||||
|
|
17
init.lua
17
init.lua
|
@ -3,6 +3,11 @@
|
|||
GPL3 ]]
|
||||
|
||||
local mailbox = {}
|
||||
|
||||
-- Load support for intllib.
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
screwdriver = screwdriver or {}
|
||||
|
||||
|
||||
|
@ -16,7 +21,7 @@ function mailbox.get_formspec(pos, owner, fs_type)
|
|||
|
||||
if fs_type == 1 then
|
||||
return "size[8,9.5]" .. xbg .. default.get_hotbar_bg(0, 5.5) ..
|
||||
"checkbox[0,0;books_only;Only allow written books;" .. selected .. "]" ..
|
||||
"checkbox[0,0;books_only;"..S("Only allow written books")..";" .. selected .. "]" ..
|
||||
"list[nodemeta:" .. spos .. ";mailbox;0,1;8,4;]" ..
|
||||
"list[current_player;main;0,5.5;8,1;]" ..
|
||||
"list[current_player;main;0,6.75;8,3;8]" ..
|
||||
|
@ -25,7 +30,7 @@ function mailbox.get_formspec(pos, owner, fs_type)
|
|||
"button_exit[7,0;1,1;exit;X]"
|
||||
else
|
||||
return "size[8,5.5]" .. xbg .. default.get_hotbar_bg(0, 1.5) ..
|
||||
"label[0,0;Send your goods\nto " .. owner .. " :]" ..
|
||||
"label[0,0;"..S("Send your goods\nto: @1", owner).."]" ..
|
||||
"list[nodemeta:" .. spos .. ";drop;3.5,0;1,1;]" ..
|
||||
"list[current_player;main;0,1.5;8,1;]" ..
|
||||
"list[current_player;main;0,2.75;8,3;8]" ..
|
||||
|
@ -58,7 +63,7 @@ mailbox.after_place_node = function(pos, placer, _)
|
|||
local player_name = placer:get_player_name()
|
||||
|
||||
meta:set_string("owner", player_name)
|
||||
meta:set_string("infotext", player_name.."'s Mailbox")
|
||||
meta:set_string("infotext", S("@1's Mailbox", player_name))
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("mailbox", 8*4)
|
||||
|
@ -109,7 +114,7 @@ mailbox.allow_metadata_inventory_put = function(pos, listname, index, stack, pla
|
|||
if inv:room_for_item("mailbox", stack) then
|
||||
return -1
|
||||
else
|
||||
minetest.chat_send_player(player:get_player_name(), "Mailbox full.")
|
||||
minetest.chat_send_player(player:get_player_name(), S("Mailbox full."))
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
@ -118,7 +123,7 @@ end
|
|||
|
||||
|
||||
minetest.register_node("mailbox:mailbox", {
|
||||
description = "Mailbox",
|
||||
description = S("Mailbox"),
|
||||
tiles = {
|
||||
"mailbox_mailbox_top.png", "mailbox_mailbox_bottom.png",
|
||||
"mailbox_mailbox_side.png", "mailbox_mailbox_side.png",
|
||||
|
@ -136,7 +141,7 @@ minetest.register_node("mailbox:mailbox", {
|
|||
})
|
||||
|
||||
minetest.register_node("mailbox:letterbox", {
|
||||
description = "Letterbox (you hacker you!)",
|
||||
description = S("Letterbox (you hacker you!)"),
|
||||
tiles = {
|
||||
"mailbox_letterbox_top.png", "mailbox_letterbox_bottom.png",
|
||||
"mailbox_letterbox_side.png", "mailbox_letterbox_side.png",
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
-- Fallback functions for when `intllib` is not installed.
|
||||
-- Code released under Unlicense <http://unlicense.org>.
|
||||
|
||||
-- Get the latest version of this file at:
|
||||
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||
|
||||
local function format(str, ...)
|
||||
local args = { ... }
|
||||
local function repl(escape, open, num, close)
|
||||
if escape == "" then
|
||||
local replacement = tostring(args[tonumber(num)])
|
||||
if open == "" then
|
||||
replacement = replacement..close
|
||||
end
|
||||
return replacement
|
||||
else
|
||||
return "@"..open..num..close
|
||||
end
|
||||
end
|
||||
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||
end
|
||||
|
||||
local gettext, ngettext
|
||||
if minetest.get_modpath("intllib") then
|
||||
if intllib.make_gettext_pair then
|
||||
-- New method using gettext.
|
||||
gettext, ngettext = intllib.make_gettext_pair()
|
||||
else
|
||||
-- Old method using text files.
|
||||
gettext = intllib.Getter()
|
||||
end
|
||||
end
|
||||
|
||||
-- Fill in missing functions.
|
||||
|
||||
gettext = gettext or function(msgid, ...)
|
||||
return format(msgid, ...)
|
||||
end
|
||||
|
||||
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||
return format(n==1 and msgid or msgid_plural, ...)
|
||||
end
|
||||
|
||||
return gettext, ngettext
|
|
@ -0,0 +1,47 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-08-04 11:31+0200\n"
|
||||
"PO-Revision-Date: 2017-08-04 12:28+0200\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.12\n"
|
||||
"Last-Translator: fat115 <fat115@framasoft.org>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
"Language: fr\n"
|
||||
|
||||
#: init.lua
|
||||
msgid "Only allow written books"
|
||||
msgstr "Accepter uniquement les livres"
|
||||
|
||||
#: init.lua
|
||||
msgid ""
|
||||
"Send your goods\n"
|
||||
"to: @1"
|
||||
msgstr ""
|
||||
"Envoyer vos biens\n"
|
||||
"à @1"
|
||||
|
||||
#: init.lua
|
||||
msgid "@1's Mailbox"
|
||||
msgstr "Boite aux lettres de @1"
|
||||
|
||||
#: init.lua
|
||||
msgid "Mailbox full."
|
||||
msgstr "Boite aux lettres pleine"
|
||||
|
||||
#: init.lua
|
||||
msgid "Mailbox"
|
||||
msgstr "Boite aux lettres"
|
||||
|
||||
#: init.lua
|
||||
msgid "Letterbox (you hacker you!)"
|
||||
msgstr "Boite aux lettres (graine de pirate ! )"
|
|
@ -0,0 +1,44 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-08-04 11:30+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: init.lua
|
||||
msgid "Only allow written books"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid ""
|
||||
"Send your goods\n"
|
||||
"to: @1"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid "@1's Mailbox"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid "Mailbox full."
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid "Mailbox"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid "Letterbox (you hacker you!)"
|
||||
msgstr ""
|
Loading…
Reference in New Issue