-
Notifications
You must be signed in to change notification settings - Fork 156
Translate #664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Translate #664
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not mergeable as of now, but it's going into a good direction. Thank you for the PR.
@@ -1,5 +1,5 @@ | |||
|
|||
local S = technic.getter | |||
local S = minetest.get_translator("technic") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you please be so nice to use core
instead of minetest
for newly added function calls?
if minetest.settings:get_bool("log_mods") then | ||
print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start)) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated change. Please limit this PR to translating only.
local clear_networks | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated change. Please do translations only.
local function register_dust(name, ingot) | ||
local lname = string.lower(name) | ||
lname = string.gsub(lname, ' ', '_') | ||
minetest.register_craftitem("technic:"..lname.."_dust", { | ||
description = S("%s Dust"):format(S(name)), | ||
description = S(name) .. ' ' .. dust, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S(variable)
is not picked up by translation scripts, which parse files statically. S
uses the translator from "technic", thus the item names are probably not translated. Did you verify this in-game?
@@ -54,7 +54,7 @@ function technic.register_base_machine(data) | |||
"list[current_name;src;"..(4-input_size)..",1;"..input_size..",1;]".. | |||
"list[current_name;dst;5,1;2,2;]".. | |||
"list[current_player;main;0,5;8,4;]".. | |||
"label[0,0;"..machine_desc:format(tier).."]".. | |||
"label[0,0;"..machine_desc.."]".. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other mods might still rely on the previous behaviour, thus resulting in machine names like %s Fire-o-Matic Deluxe
where %s
is no longer replaced by LV/MV/HV. Please add a check for %s
and still format the string if necessary.
local function replaceMk(str, mk, mode) | ||
local t = {} | ||
t['1'] = mk | ||
t['2'] = mode | ||
local str1 = str | ||
local str2 = string.gsub(str1, "%%(%d+)", t) | ||
return str2 | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shorter, and a more intuitive function name.
local function replaceMk(str, mk, mode) | |
local t = {} | |
t['1'] = mk | |
t['2'] = mode | |
local str1 = str | |
local str2 = string.gsub(str1, "%%(%d+)", t) | |
return str2 | |
end | |
local function get_description_string(str, mk, mode) | |
local t = { ["1"] = mk, ["2"] = mode } | |
return (string.gsub(str, "%%(%d+)", t)) | |
end |
local S = minetest.get_translator("technic_chests") | ||
|
||
technic.chests:register(S("Copper"), "copper", { | ||
width = 14, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional change. Please undo.
@@ -386,11 +381,11 @@ local _TUBELIB_CALLBACKS = { | |||
end, | |||
} | |||
|
|||
function technic.chests:register(name, data) | |||
function technic.chests:register(name, lname, data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change. Please ensure backwards compatibility, or do the technic_chests
translation in a separate PR. You could solve this trivially by passing lname
in data
(but handling nil
values too).
for_each_registered_node(function(node_name, node_def) | ||
if node_name ~= "default:steelblock" and | ||
node_name:find("steelblock", 1, true) and | ||
node_def.description:find("Steel", 1, true) then | ||
minetest.override_item(node_name, { | ||
description = node_def.description:gsub("Steel", S("Wrought Iron")), | ||
description = "Steel".. tr_wrought, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SteelWrought Iron
is surely not the expected outcome. I don't think this can be translated trivially.
The translation system has been reworked: now the mod detects the client's language and displays translations accordingly. Testing has been carried out on a multiplayer server.