Skip to content

Commit

Permalink
Fix and improve translation strings (#2471)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 authored Sep 12, 2019
1 parent ea992bd commit e4adb01
Show file tree
Hide file tree
Showing 15 changed files with 387 additions and 166 deletions.
10 changes: 6 additions & 4 deletions game_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -726,27 +726,29 @@ delivered with Minetest Game, to keep them compatible with other mods.
* `sounds`: See [#Default sounds]
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]

`stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex)`
`stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)`

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

`stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex)`
`stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)`

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

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

Expand Down
2 changes: 1 addition & 1 deletion mods/binoculars/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ minetest.after(4.7, cyclic_update)
-- Binoculars item

minetest.register_craftitem("binoculars:binoculars", {
description = S("Binoculars\nUse with 'Zoom' key"),
description = S("Binoculars") .. "\n" .. S("Use with 'Zoom' key"),
inventory_image = "binoculars_binoculars.png",
stack_max = 1,

Expand Down
4 changes: 2 additions & 2 deletions mods/boats/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ function boat.on_step(self, dtime)
if ctrl.up and ctrl.down then
if not self.auto then
self.auto = true
minetest.chat_send_player(self.driver, S("[boats] Cruise on"))
minetest.chat_send_player(self.driver, S("Boat cruise mode on"))
end
elseif ctrl.down then
self.v = self.v - dtime * 1.8
if self.auto then
self.auto = false
minetest.chat_send_player(self.driver, S("[boats] Cruise off"))
minetest.chat_send_player(self.driver, S("Boat cruise mode off"))
end
elseif ctrl.up or self.auto then
self.v = self.v + dtime * 1.8
Expand Down
4 changes: 2 additions & 2 deletions mods/bones/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ minetest.register_on_dieplayer(function(player)
meta:set_string("owner", player_name)

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

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

minetest.get_node_timer(pos):start(10)
else
meta:set_string("infotext", S("@1's bones.", player_name))
meta:set_string("infotext", S("@1's bones", player_name))
end
end)
15 changes: 7 additions & 8 deletions mods/butterflies/init.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
-- butrerflies/init.lua
-- butterflies/init.lua

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

-- register butterflies
local butter_list = {
{"white", S("White")},
{"red", S("Red")},
{"violet", S("Violet")}
{"white", S("White Butterfly")},
{"red", S("Red Butterfly")},
{"violet", S("Violet Butterfly")}
}

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

minetest.register_node("butterflies:butterfly_"..name, {
description = S("@1 Butterfly", desc),
description = desc,
drawtype = "plantlike",
tiles = {{
name = "butterflies_butterfly_"..name.."_animated.png",
Expand Down Expand Up @@ -61,10 +61,9 @@ for i in ipairs (butter_list) do
})

minetest.register_node("butterflies:hidden_butterfly_"..name, {
description = S("Hidden @1 Butterfly", desc),
drawtype = "airlike",
inventory_image = "insects_butterfly_"..name..".png",
wield_image = "insects_butterfly_"..name..".png",
inventory_image = "butterflies_butterfly_"..name..".png",
wield_image = "butterflies_butterfly_"..name..".png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
Expand Down
2 changes: 1 addition & 1 deletion mods/carts/cart_entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ end
minetest.register_entity("carts:cart", cart_entity)

minetest.register_craftitem("carts:cart", {
description = S("Cart (Sneak+Click to pick up)"),
description = S("Cart") .. "\n" .. S("(Sneak+Click to pick up)"),
inventory_image = minetest.inventorycube("carts_cart_top.png", "carts_cart_side.png", "carts_cart_side.png"),
wield_image = "carts_cart_side.png",
on_place = function(itemstack, placer, pointed_thing)
Expand Down
2 changes: 1 addition & 1 deletion mods/default/craftitems.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ minetest.register_craftitem("default:book", {
})

minetest.register_craftitem("default:book_written", {
description = S("Book With Text"),
description = S("Book with Text"),
inventory_image = "default_book_written.png",
groups = {book = 1, not_in_creative_inventory = 1, flammable = 3},
stack_max = 1,
Expand Down
19 changes: 12 additions & 7 deletions mods/default/furnace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -226,30 +226,35 @@ local function furnace_node_timer(pos, elapsed)
end

local fuel_state = S("Empty")
local active = "inactive"
local active = false
local result = false

if fuel_totaltime ~= 0 then
active = "active"
active = true
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
fuel_state = fuel_percent .. "%"
fuel_state = S("@1%", fuel_percent)
formspec = default.get_furnace_active_formspec(fuel_percent, item_percent)
swap_node(pos, "default:furnace_active")
-- make sure timer restarts automatically
result = true
else
if not fuellist[1]:is_empty() then
fuel_state = "0%"
fuel_state = S("@1%", 0)
end
formspec = default.get_furnace_inactive_formspec()
swap_node(pos, "default:furnace")
-- stop timer on the inactive furnace
minetest.get_node_timer(pos):stop()
end

-- local infotext = "Furnace " .. active .. "\n(Item: " .. item_state ..
-- "; Fuel: " .. fuel_state .. ")"
local infotext = S("Furnace @1 \n(Item: @2; Fuel: @3)", active, item_state, fuel_state)

local infotext
if active then
infotext = S("Furnace active")
else
infotext = S("Furnace inactive")
end
infotext = infotext .. "\n" .. S("(Item: @1; Fuel: @2)", item_state, fuel_state)

--
-- Set meta values
Expand Down
10 changes: 5 additions & 5 deletions mods/default/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -513,14 +513,14 @@ minetest.register_node("default:dirt_with_coniferous_litter", {
})

minetest.register_node("default:dry_dirt", {
description = "Dry Dirt",
description = S("Dry Dirt"),
tiles = {"default_dry_dirt.png"},
groups = {crumbly = 3, soil = 1},
sounds = default.node_sound_dirt_defaults(),
})

minetest.register_node("default:dry_dirt_with_dry_grass", {
description = "Dry Dirt with Dry Grass",
description = S("Dry Dirt with Dry Grass"),
tiles = {"default_dry_grass.png", "default_dry_dirt.png",
{name = "default_dry_dirt.png^default_dry_grass_side.png",
tileable_vertical = false}},
Expand Down Expand Up @@ -2556,7 +2556,7 @@ minetest.register_node("default:bookshelf", {

local function register_sign(material, desc, def)
minetest.register_node("default:sign_wall_" .. material, {
description = S("@1 Sign", desc),
description = desc,
drawtype = "nodebox",
tiles = {"default_sign_wall_" .. material .. ".png"},
inventory_image = "default_sign_" .. material .. ".png",
Expand Down Expand Up @@ -2605,12 +2605,12 @@ local function register_sign(material, desc, def)
})
end

register_sign("wood", S("Wooden"), {
register_sign("wood", S("Wooden Sign"), {
sounds = default.node_sound_wood_defaults(),
groups = {choppy = 2, attached_node = 1, flammable = 2, oddly_breakable_by_hand = 3}
})

register_sign("steel", S("Steel"), {
register_sign("steel", S("Steel Sign"), {
sounds = default.node_sound_metal_defaults(),
groups = {cracky = 2, attached_node = 1}
})
Expand Down
54 changes: 38 additions & 16 deletions mods/dye/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ local S = minetest.get_translator("dye")
-- Make dye names and descriptions available globally

dye.dyes = {
{"white", S("White")},
{"grey", S("Grey")},
{"dark_grey", S("Dark Grey")},
{"black", S("Black")},
{"violet", S("Violet")},
{"blue", S("Blue")},
{"cyan", S("Cyan")},
{"dark_green", S("Dark Green")},
{"green", S("Green")},
{"yellow", S("Yellow")},
{"brown", S("Brown")},
{"orange", S("Orange")},
{"red", S("Red")},
{"magenta", S("Magenta")},
{"pink", S("Pink")},
{"white", "White"},
{"grey", "Grey"},
{"dark_grey", "Dark Grey"},
{"black", "Black"},
{"violet", "Violet"},
{"blue", "Blue"},
{"cyan", "Cyan"},
{"dark_green", "Dark Green"},
{"green", "Green"},
{"yellow", "Yellow"},
{"brown", "Brown"},
{"orange", "Orange"},
{"red", "Red"},
{"magenta", "Magenta"},
{"pink", "Pink"},
}

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

minetest.register_craftitem("dye:" .. name, {
inventory_image = "dye_" .. name .. ".png",
description = S("@1 Dye", description),
description = S(description .. " Dye"),
groups = groups
})

Expand Down Expand Up @@ -103,3 +103,25 @@ for _, mix in pairs(dye_recipes) do
recipe = {"dye:" .. mix[1], "dye:" .. mix[2]},
})
end

-- Dummy calls to S() to allow translation scripts to detect the strings.
-- To update this run:
-- for _,e in ipairs(dye.dyes) do print(("S(%q)"):format(e[2].." Dye")) end

--[[
S("White Dye")
S("Grey Dye")
S("Dark Grey Dye")
S("Black Dye")
S("Violet Dye")
S("Blue Dye")
S("Cyan Dye")
S("Dark Green Dye")
S("Green Dye")
S("Yellow Dye")
S("Brown Dye")
S("Orange Dye")
S("Red Dye")
S("Magenta Dye")
S("Pink Dye")
--]]
4 changes: 2 additions & 2 deletions mods/farming/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ minetest.register_node("farming:soil_wet", {
})

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

minetest.register_node("farming:dry_soil_wet", {
description = "Wet Dry Soil",
description = S("Wet Dry Soil"),
tiles = {"default_dry_dirt.png^farming_soil_wet.png", "default_dry_dirt.png^farming_soil_wet_side.png"},
drop = "default:dry_dirt",
groups = {crumbly=3, not_in_creative_inventory=1, soil=3, wet = 1, grassland = 1, field = 1},
Expand Down
2 changes: 1 addition & 1 deletion mods/map/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ minetest.after(5.3, cyclic_update)
-- Mapping kit item

minetest.register_craftitem("map:mapping_kit", {
description = S("Mapping Kit\nUse with 'Minimap' key"),
description = S("Mapping Kit") .. "\n" .. S("Use with 'Minimap' key"),
inventory_image = "map_mapping_kit.png",
stack_max = 1,
groups = {flammable = 3},
Expand Down
2 changes: 1 addition & 1 deletion mods/screwdriver/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ end

-- Screwdriver
minetest.register_tool("screwdriver:screwdriver", {
description = S("Screwdriver (left-click rotates face, right-click rotates axis)"),
description = S("Screwdriver") .. "\n" .. S("(left-click rotates face, right-click rotates axis)"),
inventory_image = "screwdriver.png",
groups = {tool = 1},
on_use = function(itemstack, user, pointed_thing)
Expand Down
Loading

0 comments on commit e4adb01

Please sign in to comment.