-
Notifications
You must be signed in to change notification settings - Fork 708
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d7066f1
fix: get `gmod_language` convar after game is loaded
jjyao88 0db4ac0
fix: pose names aren't translated
jjyao88 7aede3b
Revert "fix: pose names aren't translated"
jjyao88 ffd6c9a
misc: revert selectedLanguage change
jjyao88 4cee3c5
Fix introducing a local, and use a timer instead of Think
FPtje File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,14 @@ cvars.AddChangeCallback("gmod_language", function(cv, old, new) | |
selectedLanguage = new | ||
end) | ||
|
||
hook.Add("Think", "DarkRPSetLanguage", function() | ||
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 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shouldn't this be covered by the
cvars.AddChangeCallback
call above? After all, the moment the car goes from empty to set, that function should trigger.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 comment
The reason will be displayed to describe this comment to others. Learn more.
Because the
cvars.AddChangeCallback
above doesn't work at all no matter what language codes I changed from dedicated server-side. This could be the bug directly from Facepunch...However, I could make it work by starting the server from the main game.
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.
Seems
gmod_language
only works for client side by design.I haven't managed to make
cvars.AddChangeCallback("gmod_language", ...)
work on server side.