From f1915dbd3b7b4d5b290fc3721743ac3658a2e9e5 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 10 Nov 2016 21:09:49 +0100 Subject: [PATCH] Add intllib support --- depends.txt | 1 + init.lua | 198 ++++++++++++++++++++++++++++------------------------ locale/template.txt | 98 ++++++++++++++++++++++++++ 3 files changed, 206 insertions(+), 91 deletions(-) create mode 100644 locale/template.txt diff --git a/depends.txt b/depends.txt index 5e68a59..280f067 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,2 @@ paint_roller? +intllib? diff --git a/init.lua b/init.lua index 13a0e87..b08ea4b 100644 --- a/init.lua +++ b/init.lua @@ -1,110 +1,116 @@ +local S +if minetest.get_modpath("intllib") then + S = intllib.Getter() +else + S = function(s) return s end +end + local cc = {} cc.colors = { "white", "yellow", "orange", "red", "redviolet", "magenta", "violet", "blue", "skyblue", "cyan", "aqua", "green", "lime", "pink", "brown", "dark_green", "light_gray", "dark_gray", "black" } cc.dye_colors = { white = "unicolor_white", yellow = "unicolor_yellow", orange = "unicolor_orange", red = "unicolor_red", redviolet = "unicolor_red_violet", magenta = "unicolor_magenta", violet = "unicolor_violet", blue = "unicolor_blue", skyblue = "unicolor_sky_blue", cyan = "unicolor_cyan", aqua = "unicolor_aqua", green = "unicolor_green", lime = "unicolor_lime", pink = "unicolor_light_red", brown = "unicolor_dark_orange", dark_green = "unicolor_dark_green", light_gray = "unicolor_grey", dark_gray = "unicolor_darkgrey", black = "unicolor_black" } cc.human_colors = { single = { - white = "White basic color cube", - yellow = "Yellow basic color cube", - orange = "Orange basic color cube", - red = "Red basic color cube", - redviolet = "Red-violet basic color cube", - magenta = "Magenta basic color cube", - violet = "Violet basic color cube", - blue = "Blue basic color cube", - skyblue = "Skyblue basic color cube", - cyan = "Cyan basic color cube", - aqua = "Aqua basic color cube", - green = "Green basic color cube", - lime = "Lime basic color cube", - pink = "Pink basic color cube", - brown = "Brown basic color cube", - dark_green = "Dark green basic color cube", - light_gray = "Light gray basic color cube", - dark_gray = "Dark gray basic color cube", - black = "Black basic color cube", + white = S("White basic color cube"), + yellow = S("Yellow basic color cube"), + orange = S("Orange basic color cube"), + red = S("Red basic color cube"), + redviolet = S("Red-violet basic color cube"), + magenta = S("Magenta basic color cube"), + violet = S("Violet basic color cube"), + blue = S("Blue basic color cube"), + skyblue = S("Skyblue basic color cube"), + cyan = S("Cyan basic color cube"), + aqua = S("Aqua basic color cube"), + green = S("Green basic color cube"), + lime = S("Lime basic color cube"), + pink = S("Pink basic color cube"), + brown = S("Brown basic color cube"), + dark_green = S("Dark green basic color cube"), + light_gray = S("Light gray basic color cube"), + dark_gray = S("Dark gray basic color cube"), + black = S("Black basic color cube"), }, window = { - white = "White window color cube", - yellow = "Yellow window color cube", - orange = "Orange window color cube", - red = "Red window color cube", - redviolet = "Red-violet window color cube", - magenta = "Magenta window color cube", - violet = "Violet window color cube", - blue = "Blue window color cube", - skyblue = "Skyblue window color cube", - cyan = "Cyan window color cube", - aqua = "Aqua window color cube", - green = "Green window color cube", - lime = "Lime window color cube", - pink = "Pink window color cube", - brown = "Brown window color cube", - dark_green = "Dark green window color cube", - light_gray = "Light gray window color cube", - dark_gray = "Dark gray window color cube", - black = "Black window color cube", + white = S("White window color cube"), + yellow = S("Yellow window color cube"), + orange = S("Orange window color cube"), + red = S("Red window color cube"), + redviolet = S("Red-violet window color cube"), + magenta = S("Magenta window color cube"), + violet = S("Violet window color cube"), + blue = S("Blue window color cube"), + skyblue = S("Skyblue window color cube"), + cyan = S("Cyan window color cube"), + aqua = S("Aqua window color cube"), + green = S("Green window color cube"), + lime = S("Lime window color cube"), + pink = S("Pink window color cube"), + brown = S("Brown window color cube"), + dark_green = S("Dark green window color cube"), + light_gray = S("Light gray window color cube"), + dark_gray = S("Dark gray window color cube"), + black = S("Black window color cube"), }, tiled = { - white = "White tiled color cube", - yellow = "Yellow tiled color cube", - orange = "Orange tiled color cube", - red = "Red tiled color cube", - redviolet = "Red-violet tiled color cube", - magenta = "Magenta tiled color cube", - violet = "Violet tiled color cube", - blue = "Blue tiled color cube", - skyblue = "Skyblue tiled color cube", - cyan = "Cyan tiled color cube", - aqua = "Aqua tiled color cube", - green = "Green tiled color cube", - lime = "Lime tiled color cube", - pink = "Pink tiled color cube", - brown = "Brown tiled color cube", - dark_green = "Dark green tiled color cube", - light_gray = "Light gray tiled color cube", - dark_gray = "Dark gray tiled color cube", - black = "Black tiled color cube", + white = S("White tiled color cube"), + yellow = S("Yellow tiled color cube"), + orange = S("Orange tiled color cube"), + red = S("Red tiled color cube"), + redviolet = S("Red-violet tiled color cube"), + magenta = S("Magenta tiled color cube"), + violet = S("Violet tiled color cube"), + blue = S("Blue tiled color cube"), + skyblue = S("Skyblue tiled color cube"), + cyan = S("Cyan tiled color cube"), + aqua = S("Aqua tiled color cube"), + green = S("Green tiled color cube"), + lime = S("Lime tiled color cube"), + pink = S("Pink tiled color cube"), + brown = S("Brown tiled color cube"), + dark_green = S("Dark green tiled color cube"), + light_gray = S("Light gray tiled color cube"), + dark_gray = S("Dark gray tiled color cube"), + black = S("Black tiled color cube"), }, inward = { - white = "White concentric color cube", - yellow = "Yellow concentric color cube", - orange = "Orange concentric color cube", - red = "Red concentric color cube", - redviolet = "Red-violet concentric color cube", - magenta = "Magenta concentric color cube", - violet = "Violet concentric color cube", - blue = "Blue concentric color cube", - skyblue = "Skyblue concentric color cube", - cyan = "Cyan concentric color cube", - aqua = "Aqua concentric color cube", - green = "Green concentric color cube", - lime = "Lime concentric color cube", - pink = "Pink concentric color cube", - brown = "Brown concentric color cube", - dark_green = "Dark green concentric color cube", - light_gray = "Light gray concentric color cube", - dark_gray = "Dark gray concentric color cube", - black = "Black concentric color cube", + white = S("White concentric color cube"), + yellow = S("Yellow concentric color cube"), + orange = S("Orange concentric color cube"), + red = S("Red concentric color cube"), + redviolet = S("Red-violet concentric color cube"), + magenta = S("Magenta concentric color cube"), + violet = S("Violet concentric color cube"), + blue = S("Blue concentric color cube"), + skyblue = S("Skyblue concentric color cube"), + cyan = S("Cyan concentric color cube"), + aqua = S("Aqua concentric color cube"), + green = S("Green concentric color cube"), + lime = S("Lime concentric color cube"), + pink = S("Pink concentric color cube"), + brown = S("Brown concentric color cube"), + dark_green = S("Dark green concentric color cube"), + light_gray = S("Light gray concentric color cube"), + dark_gray = S("Dark gray concentric color cube"), + black = S("Black concentric color cube"), }, light = { - white = "White light color cube", - yellow = "Yellow light color cube", - orange = "Orange light color cube", - red = "Red light color cube", - redviolet = "Red-violet light color cube", - magenta = "Magenta light color cube", - violet = "Violet light color cube", - blue = "Blue light color cube", - skyblue = "Skyblue light color cube", - cyan = "Cyan light color cube", - aqua = "Aqua light color cube", - green = "Green light color cube", - lime = "Lime light color cube", + white = S("White light color cube"), + yellow = S("Yellow light color cube"), + orange = S("Orange light color cube"), + red = S("Red light color cube"), + redviolet = S("Red-violet light color cube"), + magenta = S("Magenta light color cube"), + violet = S("Violet light color cube"), + blue = S("Blue light color cube"), + skyblue = S("Skyblue light color cube"), + cyan = S("Cyan light color cube"), + aqua = S("Aqua light color cube"), + green = S("Green light color cube"), + lime = S("Lime light color cube"), } } - local light_level = 14 local soundmaker = function (mod) @@ -256,7 +262,17 @@ end --[[ Tiled blocks with 2 different colors (usuall complementary colors) ]] local complementary = { { "yellow", "blue"}, {"aqua", "redviolet"}, {"red", "cyan"}, {"light_gray", "dark_gray"}, {"green", "magenta"}, {"orange", "skyblue"}, {"lime", "violet"}, {"black", "white"}, {"orange", "brown"} } -local complementary_names = { "Yellow/blue tiled color cube", "Aqua/red-violet tiled color cube", "Red/cyan tiled color cube", "Light/dark gray tiled color cube", "Green/magenta tiled color cube", "Orange/skyblue tiled color cube", "Lime/violet tiled color cube", "Black/white tiled color cube", "Orange/brown tiled color cube" } +local complementary_names = { + S("Yellow/blue tiled color cube"), + S("Aqua/red-violet tiled color cube"), + S("Red/cyan tiled color cube"), + S("Light/dark gray tiled color cube"), + S("Green/magenta tiled color cube"), + S("Orange/skyblue tiled color cube"), + S("Lime/violet tiled color cube"), + S("Black/white tiled color cube"), + S("Orange/brown tiled color cube"), +} for i=1,#complementary do local c1, c2 diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..c98ae58 --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,98 @@ +Aqua basic color cube = +Aqua concentric color cube = +Aqua light color cube = +Aqua tiled color cube = +Aqua window color cube = +Aqua/red-violet tiled color cube = +Black basic color cube = +Black concentric color cube = +Black tiled color cube = +Black window color cube = +Black/white tiled color cube = +Blue basic color cube = +Blue concentric color cube = +Blue light color cube = +Blue tiled color cube = +Blue window color cube = +Brown basic color cube = +Brown concentric color cube = +Brown tiled color cube = +Brown window color cube = +Cyan basic color cube = +Cyan concentric color cube = +Cyan light color cube = +Cyan tiled color cube = +Cyan window color cube = +Dark gray basic color cube = +Dark gray concentric color cube = +Dark gray tiled color cube = +Dark gray window color cube = +Dark green basic color cube = +Dark green concentric color cube = +Dark green tiled color cube = +Dark green window color cube = +Green basic color cube = +Green concentric color cube = +Green light color cube = +Green tiled color cube = +Green window color cube = +Green/magenta tiled color cube = +Light gray basic color cube = +Light gray concentric color cube = +Light gray tiled color cube = +Light gray window color cube = +Light/dark gray tiled color cube = +Lime basic color cube = +Lime concentric color cube = +Lime light color cube = +Lime tiled color cube = +Lime window color cube = +Lime/violet tiled color cube = +Magenta basic color cube = +Magenta concentric color cube = +Magenta light color cube = +Magenta tiled color cube = +Magenta window color cube = +Orange basic color cube = +Orange concentric color cube = +Orange light color cube = +Orange tiled color cube = +Orange window color cube = +Orange/brown tiled color cube = +Orange/skyblue tiled color cube = +Pink basic color cube = +Pink concentric color cube = +Pink tiled color cube = +Pink window color cube = +Red basic color cube = +Red concentric color cube = +Red light color cube = +Red tiled color cube = +Red window color cube = +Red-violet basic color cube = +Red-violet concentric color cube = +Red-violet light color cube = +Red-violet tiled color cube = +Red-violet window color cube = +Red/cyan tiled color cube = +Skyblue basic color cube = +Skyblue concentric color cube = +Skyblue light color cube = +Skyblue tiled color cube = +Skyblue window color cube = +Violet basic color cube = +Violet concentric color cube = +Violet light color cube = +Violet tiled color cube = +Violet window color cube = +White basic color cube = +White concentric color cube = +White light color cube = +White tiled color cube = +White window color cube = +Yellow basic color cube = +Yellow concentric color cube = +Yellow light color cube = +Yellow tiled color cube = +Yellow window color cube = +Yellow/blue tiled color cube = -- 2.11.4.GIT