Skip to content

Commit e4adb01

Browse files
authoredSep 12, 2019
Fix and improve translation strings (#2471)
1 parent ea992bd commit e4adb01

File tree

15 files changed

+387
-166
lines changed

15 files changed

+387
-166
lines changed
 

‎game_api.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -726,27 +726,29 @@ delivered with Minetest Game, to keep them compatible with other mods.
726726
* `sounds`: See [#Default sounds]
727727
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
728728

729-
`stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex)`
729+
`stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)`
730730

731731
* Registers an inner corner stair
732732
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_inner_subname"
733733
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
734734
* `groups`: See [Known damage and digging time defining groups]
735735
* `images`: See [Tile definition]
736-
* `description`: Used for the description field in the stair's definition
736+
* `description`: Used for the description field in the stair's definition with "Inner" prepended
737737
* `sounds`: See [#Default sounds]
738738
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
739+
* `full_description`: Overrides the description, bypassing string concatenation. This is useful for translation. (optional)
739740

740-
`stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex)`
741+
`stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)`
741742

742743
* Registers an outer corner stair
743744
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_outer_subname"
744745
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
745746
* `groups`: See [Known damage and digging time defining groups]
746747
* `images`: See [Tile definition]
747-
* `description`: Used for the description field in the stair's definition
748+
* `description`: Used for the description field in the stair's definition with "Outer" prepended
748749
* `sounds`: See [#Default sounds]
749750
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
751+
* `full_description`: Overrides the description, bypassing string concatenation. This is useful for translation. (optional)
750752

751753
`stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds, worldaligntex)`
752754

‎mods/binoculars/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ minetest.after(4.7, cyclic_update)
5959
-- Binoculars item
6060

6161
minetest.register_craftitem("binoculars:binoculars", {
62-
description = S("Binoculars\nUse with 'Zoom' key"),
62+
description = S("Binoculars") .. "\n" .. S("Use with 'Zoom' key"),
6363
inventory_image = "binoculars_binoculars.png",
6464
stack_max = 1,
6565

‎mods/boats/init.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ function boat.on_step(self, dtime)
154154
if ctrl.up and ctrl.down then
155155
if not self.auto then
156156
self.auto = true
157-
minetest.chat_send_player(self.driver, S("[boats] Cruise on"))
157+
minetest.chat_send_player(self.driver, S("Boat cruise mode on"))
158158
end
159159
elseif ctrl.down then
160160
self.v = self.v - dtime * 1.8
161161
if self.auto then
162162
self.auto = false
163-
minetest.chat_send_player(self.driver, S("[boats] Cruise off"))
163+
minetest.chat_send_player(self.driver, S("Boat cruise mode off"))
164164
end
165165
elseif ctrl.up or self.auto then
166166
self.v = self.v + dtime * 1.8

‎mods/bones/init.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ minetest.register_on_dieplayer(function(player)
269269
meta:set_string("owner", player_name)
270270

271271
if share_bones_time ~= 0 then
272-
meta:set_string("infotext", S("@1's fresh bones.", player_name))
272+
meta:set_string("infotext", S("@1's fresh bones", player_name))
273273

274274
if share_bones_time_early == 0 or not minetest.is_protected(pos, player_name) then
275275
meta:set_int("time", 0)
@@ -279,6 +279,6 @@ minetest.register_on_dieplayer(function(player)
279279

280280
minetest.get_node_timer(pos):start(10)
281281
else
282-
meta:set_string("infotext", S("@1's bones.", player_name))
282+
meta:set_string("infotext", S("@1's bones", player_name))
283283
end
284284
end)

‎mods/butterflies/init.lua

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
-- butrerflies/init.lua
1+
-- butterflies/init.lua
22

33
-- Load support for MT game translation.
44
local S = minetest.get_translator("butterflies")
55

66
-- register butterflies
77
local butter_list = {
8-
{"white", S("White")},
9-
{"red", S("Red")},
10-
{"violet", S("Violet")}
8+
{"white", S("White Butterfly")},
9+
{"red", S("Red Butterfly")},
10+
{"violet", S("Violet Butterfly")}
1111
}
1212

1313
for i in ipairs (butter_list) do
1414
local name = butter_list[i][1]
1515
local desc = butter_list[i][2]
1616

1717
minetest.register_node("butterflies:butterfly_"..name, {
18-
description = S("@1 Butterfly", desc),
18+
description = desc,
1919
drawtype = "plantlike",
2020
tiles = {{
2121
name = "butterflies_butterfly_"..name.."_animated.png",
@@ -61,10 +61,9 @@ for i in ipairs (butter_list) do
6161
})
6262

6363
minetest.register_node("butterflies:hidden_butterfly_"..name, {
64-
description = S("Hidden @1 Butterfly", desc),
6564
drawtype = "airlike",
66-
inventory_image = "insects_butterfly_"..name..".png",
67-
wield_image = "insects_butterfly_"..name..".png",
65+
inventory_image = "butterflies_butterfly_"..name..".png",
66+
wield_image = "butterflies_butterfly_"..name..".png",
6867
paramtype = "light",
6968
sunlight_propagates = true,
7069
walkable = false,

‎mods/carts/cart_entity.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ end
388388
minetest.register_entity("carts:cart", cart_entity)
389389

390390
minetest.register_craftitem("carts:cart", {
391-
description = S("Cart (Sneak+Click to pick up)"),
391+
description = S("Cart") .. "\n" .. S("(Sneak+Click to pick up)"),
392392
inventory_image = minetest.inventorycube("carts_cart_top.png", "carts_cart_side.png", "carts_cart_side.png"),
393393
wield_image = "carts_cart_side.png",
394394
on_place = function(itemstack, placer, pointed_thing)

‎mods/default/craftitems.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ minetest.register_craftitem("default:book", {
165165
})
166166

167167
minetest.register_craftitem("default:book_written", {
168-
description = S("Book With Text"),
168+
description = S("Book with Text"),
169169
inventory_image = "default_book_written.png",
170170
groups = {book = 1, not_in_creative_inventory = 1, flammable = 3},
171171
stack_max = 1,

‎mods/default/furnace.lua

+12-7
Original file line numberDiff line numberDiff line change
@@ -226,30 +226,35 @@ local function furnace_node_timer(pos, elapsed)
226226
end
227227

228228
local fuel_state = S("Empty")
229-
local active = "inactive"
229+
local active = false
230230
local result = false
231231

232232
if fuel_totaltime ~= 0 then
233-
active = "active"
233+
active = true
234234
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
235-
fuel_state = fuel_percent .. "%"
235+
fuel_state = S("@1%", fuel_percent)
236236
formspec = default.get_furnace_active_formspec(fuel_percent, item_percent)
237237
swap_node(pos, "default:furnace_active")
238238
-- make sure timer restarts automatically
239239
result = true
240240
else
241241
if not fuellist[1]:is_empty() then
242-
fuel_state = "0%"
242+
fuel_state = S("@1%", 0)
243243
end
244244
formspec = default.get_furnace_inactive_formspec()
245245
swap_node(pos, "default:furnace")
246246
-- stop timer on the inactive furnace
247247
minetest.get_node_timer(pos):stop()
248248
end
249249

250-
-- local infotext = "Furnace " .. active .. "\n(Item: " .. item_state ..
251-
-- "; Fuel: " .. fuel_state .. ")"
252-
local infotext = S("Furnace @1 \n(Item: @2; Fuel: @3)", active, item_state, fuel_state)
250+
251+
local infotext
252+
if active then
253+
infotext = S("Furnace active")
254+
else
255+
infotext = S("Furnace inactive")
256+
end
257+
infotext = infotext .. "\n" .. S("(Item: @1; Fuel: @2)", item_state, fuel_state)
253258

254259
--
255260
-- Set meta values

‎mods/default/nodes.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,14 @@ minetest.register_node("default:dirt_with_coniferous_litter", {
513513
})
514514

515515
minetest.register_node("default:dry_dirt", {
516-
description = "Dry Dirt",
516+
description = S("Dry Dirt"),
517517
tiles = {"default_dry_dirt.png"},
518518
groups = {crumbly = 3, soil = 1},
519519
sounds = default.node_sound_dirt_defaults(),
520520
})
521521

522522
minetest.register_node("default:dry_dirt_with_dry_grass", {
523-
description = "Dry Dirt with Dry Grass",
523+
description = S("Dry Dirt with Dry Grass"),
524524
tiles = {"default_dry_grass.png", "default_dry_dirt.png",
525525
{name = "default_dry_dirt.png^default_dry_grass_side.png",
526526
tileable_vertical = false}},
@@ -2556,7 +2556,7 @@ minetest.register_node("default:bookshelf", {
25562556

25572557
local function register_sign(material, desc, def)
25582558
minetest.register_node("default:sign_wall_" .. material, {
2559-
description = S("@1 Sign", desc),
2559+
description = desc,
25602560
drawtype = "nodebox",
25612561
tiles = {"default_sign_wall_" .. material .. ".png"},
25622562
inventory_image = "default_sign_" .. material .. ".png",
@@ -2605,12 +2605,12 @@ local function register_sign(material, desc, def)
26052605
})
26062606
end
26072607

2608-
register_sign("wood", S("Wooden"), {
2608+
register_sign("wood", S("Wooden Sign"), {
26092609
sounds = default.node_sound_wood_defaults(),
26102610
groups = {choppy = 2, attached_node = 1, flammable = 2, oddly_breakable_by_hand = 3}
26112611
})
26122612

2613-
register_sign("steel", S("Steel"), {
2613+
register_sign("steel", S("Steel Sign"), {
26142614
sounds = default.node_sound_metal_defaults(),
26152615
groups = {cracky = 2, attached_node = 1}
26162616
})

‎mods/dye/init.lua

+38-16
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ local S = minetest.get_translator("dye")
88
-- Make dye names and descriptions available globally
99

1010
dye.dyes = {
11-
{"white", S("White")},
12-
{"grey", S("Grey")},
13-
{"dark_grey", S("Dark Grey")},
14-
{"black", S("Black")},
15-
{"violet", S("Violet")},
16-
{"blue", S("Blue")},
17-
{"cyan", S("Cyan")},
18-
{"dark_green", S("Dark Green")},
19-
{"green", S("Green")},
20-
{"yellow", S("Yellow")},
21-
{"brown", S("Brown")},
22-
{"orange", S("Orange")},
23-
{"red", S("Red")},
24-
{"magenta", S("Magenta")},
25-
{"pink", S("Pink")},
11+
{"white", "White"},
12+
{"grey", "Grey"},
13+
{"dark_grey", "Dark Grey"},
14+
{"black", "Black"},
15+
{"violet", "Violet"},
16+
{"blue", "Blue"},
17+
{"cyan", "Cyan"},
18+
{"dark_green", "Dark Green"},
19+
{"green", "Green"},
20+
{"yellow", "Yellow"},
21+
{"brown", "Brown"},
22+
{"orange", "Orange"},
23+
{"red", "Red"},
24+
{"magenta", "Magenta"},
25+
{"pink", "Pink"},
2626
}
2727

2828
-- Define items
@@ -35,7 +35,7 @@ for _, row in ipairs(dye.dyes) do
3535

3636
minetest.register_craftitem("dye:" .. name, {
3737
inventory_image = "dye_" .. name .. ".png",
38-
description = S("@1 Dye", description),
38+
description = S(description .. " Dye"),
3939
groups = groups
4040
})
4141

@@ -103,3 +103,25 @@ for _, mix in pairs(dye_recipes) do
103103
recipe = {"dye:" .. mix[1], "dye:" .. mix[2]},
104104
})
105105
end
106+
107+
-- Dummy calls to S() to allow translation scripts to detect the strings.
108+
-- To update this run:
109+
-- for _,e in ipairs(dye.dyes) do print(("S(%q)"):format(e[2].." Dye")) end
110+
111+
--[[
112+
S("White Dye")
113+
S("Grey Dye")
114+
S("Dark Grey Dye")
115+
S("Black Dye")
116+
S("Violet Dye")
117+
S("Blue Dye")
118+
S("Cyan Dye")
119+
S("Dark Green Dye")
120+
S("Green Dye")
121+
S("Yellow Dye")
122+
S("Brown Dye")
123+
S("Orange Dye")
124+
S("Red Dye")
125+
S("Magenta Dye")
126+
S("Pink Dye")
127+
--]]

‎mods/farming/nodes.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ minetest.register_node("farming:soil_wet", {
8686
})
8787

8888
minetest.register_node("farming:dry_soil", {
89-
description = "Dry Soil",
89+
description = S("Dry Soil"),
9090
tiles = {"default_dry_dirt.png^farming_soil.png", "default_dry_dirt.png"},
9191
drop = "default:dry_dirt",
9292
groups = {crumbly=3, not_in_creative_inventory=1, soil=2, grassland = 1, field = 1},
@@ -99,7 +99,7 @@ minetest.register_node("farming:dry_soil", {
9999
})
100100

101101
minetest.register_node("farming:dry_soil_wet", {
102-
description = "Wet Dry Soil",
102+
description = S("Wet Dry Soil"),
103103
tiles = {"default_dry_dirt.png^farming_soil_wet.png", "default_dry_dirt.png^farming_soil_wet_side.png"},
104104
drop = "default:dry_dirt",
105105
groups = {crumbly=3, not_in_creative_inventory=1, soil=3, wet = 1, grassland = 1, field = 1},

‎mods/map/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ minetest.after(5.3, cyclic_update)
5555
-- Mapping kit item
5656

5757
minetest.register_craftitem("map:mapping_kit", {
58-
description = S("Mapping Kit\nUse with 'Minimap' key"),
58+
description = S("Mapping Kit") .. "\n" .. S("Use with 'Minimap' key"),
5959
inventory_image = "map_mapping_kit.png",
6060
stack_max = 1,
6161
groups = {flammable = 3},

‎mods/screwdriver/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ end
150150

151151
-- Screwdriver
152152
minetest.register_tool("screwdriver:screwdriver", {
153-
description = S("Screwdriver (left-click rotates face, right-click rotates axis)"),
153+
description = S("Screwdriver") .. "\n" .. S("(left-click rotates face, right-click rotates axis)"),
154154
inventory_image = "screwdriver.png",
155155
groups = {tool = 1},
156156
on_use = function(itemstack, user, pointed_thing)

‎mods/stairs/init.lua

+285-114
Large diffs are not rendered by default.

‎mods/wool/init.lua

+23-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ for i = 1, #dyes do
99
local name, desc = unpack(dyes[i])
1010

1111
minetest.register_node("wool:" .. name, {
12-
description = S("@1 Wool", desc),
12+
description = S(desc .. " Wool"),
1313
tiles = {"wool_" .. name .. ".png"},
1414
is_ground_content = false,
1515
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3,
@@ -28,3 +28,25 @@ end
2828
-- Backwards compatibility with jordach's 16-color wool mod
2929
minetest.register_alias("wool:dark_blue", "wool:blue")
3030
minetest.register_alias("wool:gold", "wool:yellow")
31+
32+
-- Dummy calls to S() to allow translation scripts to detect the strings.
33+
-- To update this run:
34+
-- for _,e in ipairs(dye.dyes) do print(("S(%q)"):format(e[2].." Wool")) end
35+
36+
--[[
37+
S("White Wool")
38+
S("Grey Wool")
39+
S("Dark Grey Wool")
40+
S("Black Wool")
41+
S("Violet Wool")
42+
S("Blue Wool")
43+
S("Cyan Wool")
44+
S("Dark Green Wool")
45+
S("Green Wool")
46+
S("Yellow Wool")
47+
S("Brown Wool")
48+
S("Orange Wool")
49+
S("Red Wool")
50+
S("Magenta Wool")
51+
S("Pink Wool")
52+
--]]

0 commit comments

Comments
 (0)
Please sign in to comment.