-
Notifications
You must be signed in to change notification settings - Fork 709
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
Fix: Workaround for localized texts in DarkRP not loading correctly #3262
Changes from 2 commits
d7066f1
0db4ac0
7aede3b
ffd6c9a
4cee3c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
local rp_languages = {} | ||
local selectedLanguage = GetConVar("gmod_language"):GetString() -- Switch language by setting gmod_language to another language | ||
local selectedLanguage = "en" -- Switch language by setting gmod_language to another language | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think even if the convar is empty, we should still try to use it. That way it will still work if some other server managed to configure it differently. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I'll revert this back too. |
||
|
||
cvars.AddChangeCallback("gmod_language", function(cv, old, new) | ||
selectedLanguage = new | ||
end) | ||
|
||
hook.Add("Think", "DarkRPSetLanguage", function() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be covered by the Maybe the empty string check can be moved there instead. That would remove the need of the separate hook. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems I haven't managed to make |
||
gmodLanguage = GetConVar("gmod_language"):GetString() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed that this introduces a new global variable, by the way. |
||
if gmodLanguage != "" then | ||
selectedLanguage = gmodLanguage | ||
end | ||
hook.Remove("Think", "DarkRPSetLanguage") | ||
end) | ||
|
||
function DarkRP.addLanguage(name, tbl) | ||
local old = rp_languages[name] or {} | ||
rp_languages[name] = tbl | ||
|
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.
I'm not sure I understand the problem. Looking quickly at the rest of the file, it seems that the server only uses
Anims
to see whether an animation is registered. It ignores the actual translation. The client does show the animation in the menu.Other than that, instead of creating and removing a think hook, on can run a
timer.Simple(0,...)
. Note that either option will run the code quite a bit later than now.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.
Never mind, I'm not able to reproduce this issue. This may be due to my misconfiguration on my part. I'll revert this change.