mirror of
https://github.com/minetest-mods/quartz.git
synced 2024-11-17 15:58:16 +01:00
add intllib support. Also fix bug with quartz pillar stair/slab registration (#4)
* add intllib support. Also fix bug with quartz pillar stair/slab registration * add intllib to depends
This commit is contained in:
parent
ef865187a9
commit
6d5be4c515
@ -1,3 +1,4 @@
|
||||
default
|
||||
stairs
|
||||
moreblocks?
|
||||
intllib?
|
26
init.lua
26
init.lua
@ -1,16 +1,20 @@
|
||||
local settings = Settings(minetest.get_modpath("quartz").."/settings.txt")
|
||||
|
||||
-- internationalization boilerplate
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
--
|
||||
-- Item Registration
|
||||
--
|
||||
|
||||
-- Quartz Crystal
|
||||
minetest.register_craftitem("quartz:quartz_crystal", {
|
||||
description = "Quartz Crystal",
|
||||
description = S("Quartz Crystal"),
|
||||
inventory_image = "quartz_crystal_full.png",
|
||||
})
|
||||
minetest.register_craftitem("quartz:quartz_crystal_piece", {
|
||||
description = "Quartz Crystal Piece",
|
||||
description = S("Quartz Crystal Piece"),
|
||||
inventory_image = "quartz_crystal_piece.png",
|
||||
})
|
||||
|
||||
@ -20,7 +24,7 @@ minetest.register_craftitem("quartz:quartz_crystal_piece", {
|
||||
|
||||
-- Ore
|
||||
minetest.register_node("quartz:quartz_ore", {
|
||||
description = "Quartz Ore",
|
||||
description = S("Quartz Ore"),
|
||||
tiles = {"default_stone.png^quartz_ore.png"},
|
||||
groups = {cracky=3, stone=1},
|
||||
drop = 'quartz:quartz_crystal',
|
||||
@ -40,7 +44,7 @@ minetest.register_ore({
|
||||
|
||||
-- Quartz Block
|
||||
minetest.register_node("quartz:block", {
|
||||
description = "Quartz Block",
|
||||
description = S("Quartz Block"),
|
||||
tiles = {"quartz_block.png"},
|
||||
groups = {cracky=3, oddly_breakable_by_hand=1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
@ -48,7 +52,7 @@ minetest.register_node("quartz:block", {
|
||||
|
||||
-- Chiseled Quartz
|
||||
minetest.register_node("quartz:chiseled", {
|
||||
description = "Chiseled Quartz",
|
||||
description = S("Chiseled Quartz"),
|
||||
tiles = {"quartz_chiseled.png"},
|
||||
groups = {cracky=3, oddly_breakable_by_hand=1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
@ -56,7 +60,7 @@ minetest.register_node("quartz:chiseled", {
|
||||
|
||||
-- Quartz Pillar
|
||||
minetest.register_node("quartz:pillar", {
|
||||
description = "Quartz Pillar",
|
||||
description = S("Quartz Pillar"),
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"},
|
||||
groups = {cracky=3, oddly_breakable_by_hand=1},
|
||||
@ -68,15 +72,15 @@ minetest.register_node("quartz:pillar", {
|
||||
stairs.register_stair_and_slab("quartzblock", "quartz:block",
|
||||
{cracky=3, oddly_breakable_by_hand=1},
|
||||
{"quartz_block.png"},
|
||||
"Quartz stair",
|
||||
"Quartz slab",
|
||||
S("Quartz stair"),
|
||||
S("Quartz slab"),
|
||||
default.node_sound_glass_defaults())
|
||||
|
||||
stairs.register_slab("quartzstair", "quartz:pillar",
|
||||
stairs.register_stair_and_slab("quartzstair", "quartz:pillar",
|
||||
{cracky=3, oddly_breakable_by_hand=1},
|
||||
{"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"},
|
||||
"Quartz Pillar stair",
|
||||
"Quartz Pillar slab",
|
||||
S("Quartz Pillar stair"),
|
||||
S("Quartz Pillar slab"),
|
||||
default.node_sound_glass_defaults())
|
||||
|
||||
--
|
||||
|
45
intllib.lua
Normal file
45
intllib.lua
Normal file
@ -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
|
57
locale/template.pot
Normal file
57
locale/template.pot
Normal file
@ -0,0 +1,57 @@
|
||||
# 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-02-19 21:50-0700\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"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: init.lua:13
|
||||
msgid "Quartz Crystal"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:17
|
||||
msgid "Quartz Crystal Piece"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:27
|
||||
msgid "Quartz Ore"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:47
|
||||
msgid "Quartz Block"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:55
|
||||
msgid "Chiseled Quartz"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:63
|
||||
msgid "Quartz Pillar"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:75
|
||||
msgid "Quartz stair"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:76
|
||||
msgid "Quartz slab"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:82
|
||||
msgid "Quartz Pillar stair"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:83
|
||||
msgid "Quartz Pillar slab"
|
||||
msgstr ""
|
Loading…
Reference in New Issue
Block a user