-
Notifications
You must be signed in to change notification settings - Fork 154
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
Replace deprecated 'intllib' function: #382
Conversation
concrete/init.lua
Outdated
@@ -5,7 +5,7 @@ local technic = rawget(_G, "technic") or {} | |||
technic.concrete_posts = {} | |||
|
|||
-- Boilerplate to support localized strings if intllib mod is installed. | |||
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end | |||
local S = rawget(_G, "intllib") and intllib.make_gettext_pair() or intllib.Getter() or function(s) return s 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.
rawget(_G, "intllib") and (intllib.make_gettext_pair() or intllib.Getter()) or function(s) return s end
or
minetest.global_exists("intllib") and (intllib.make_gettext_pair() or intllib.Getter()) or function(s) return s end
or better something not that complicated
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.
Oh jeez, I can't believe I forgot the braces. 🙄
d4a9071
to
72cc0cf
Compare
How is that? |
Would it be better to replace |
@AntumDeluge no, conditional statements are better. What I suggested is wrong: braces per se can’t help if |
72cc0cf
to
9c5cd6c
Compare
concrete/init.lua
Outdated
@@ -5,7 +5,7 @@ local technic = rawget(_G, "technic") or {} | |||
technic.concrete_posts = {} | |||
|
|||
-- Boilerplate to support localized strings if intllib mod is installed. | |||
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end | |||
local S = rawget(_G, "intllib") and (intllib.make_gettext_pair() or intllib.Getter()) or function(s) return s 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.
This does not do what it should (see numberZero's comment). Just use intllib.make_gettext_pair()
everywhere (exists for an entire year already). Do not support legacy code and let them update their outdated mods.
technic/machines/MV/lighting.lua
Outdated
@@ -7,7 +7,11 @@ | |||
local S | |||
if (minetest.get_modpath("intllib")) then | |||
dofile(minetest.get_modpath("intllib").."/intllib.lua") | |||
S = intllib.Getter(minetest.get_current_modname()) | |||
if (intllib.make_gettext_pair) then |
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 = technic.getter
or am I missing something?
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.
See comments
...intllib'make_gettext_pair.
9c5cd6c
to
cd6ed58
Compare
It's been a while. I hope that is what you were looking for. Let me know if I misunderstood anything please. |
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.
LGTM
Closing in favour of #529 |
otherwise use deprecated function.