+1 here.
Was the same problem some time ago.... Fixed itself after few restarts
Also, I can confirm that it's not wild spread - over plugin on my server was changing fine, and this one in particular was changing find on another server, so.... I think it's bug that almost impossible to trace...
Languages are not updated when the plug-in is reload
Discussion in 'Rust Development' started by Sanlerus, Jun 15, 2017.
-
When it will be fixed, Wolf? With every change in lang file I should restart the server, wtf?!
-
Wulf Community Admin
-
-
Wulf Community Admin
-
To all who have this issue, how does the plugin load the language file?
As in, what hook do you use for the reloading? And please give some full examples, not those cryptic ones.. -
Wulf Community Admin
If a plugin uses the Lang API, they generally would register the default messages which then Oxide would use that to create the file for the languages they have set in the plugin. Default would be en, but other languages can be added via the plugin's code or by a user manually. I've tested both default generated languages as well as manually added languages and haven't reproduced the issue. -
Perhaps I worded it wrongly.
What I meant is, how do they load strings from disk? I assume they use a hook to initiate the loading of language strings. -
Wulf Community Admin
-
Makes sense.
Got confused by some implementations I have seen.
Building a little shitty test now to see if I experience the same. -
Wulf Community Admin
-
I've seen some weird-ass json monstrosities etc.
Nothing really as simple as this (Until today) -
I seem to not have the issue on my side.
The only issue I noticed is that, when I update the json files, I need to reload the plugin.
Snippet used:
Code:using System.Collections.Generic;namespace Oxide.Plugins { [Info("LangTest", "ThibmoRozier", "1.0.0")] [Description("A shitty test")] class LangTest : RustPlugin { void Loaded() { lang.RegisterMessages(new Dictionary<string, string> { ["Test One"] = "This is a text", ["Test Two"] = "This is another text", ["Test Three"] = "This is yet another text" // First test was without this var }, this, "en"); } [ConsoleCommand("showlang")] void ShowLangCallback(ConsoleSystem.Arg arg) { string origLang = lang.GetServerLanguage(); string msg1, msg2, msg3; lang.SetServerLanguage("en"); msg1 = lang.GetMessage("Test One", this); msg2 = lang.GetMessage("Test Two", this); msg3 = lang.GetMessage("Test Three", this); Puts($"Eng:\r\nmsg1 = {msg1}\r\nmsg2 = {msg2}\r\nmsg3 = {msg3}\r\n"); lang.SetServerLanguage("ru"); msg1 = lang.GetMessage("Test One", this); msg2 = lang.GetMessage("Test Two", this); msg3 = lang.GetMessage("Test Three", this); Puts($"Rus:\r\nmsg1 = {msg1}\r\nmsg2 = {msg2}\r\nmsg3 = {msg3}\r\n"); lang.SetServerLanguage("lt"); msg1 = lang.GetMessage("Test One", this); msg2 = lang.GetMessage("Test Two", this); msg3 = lang.GetMessage("Test Three", this); Puts($"Lit:\r\nmsg1 = {msg1}\r\nmsg2 = {msg2}\r\nmsg3 = {msg3}\r\n"); lang.SetServerLanguage(origLang); } } }
Last edited by a moderator: Dec 20, 2017 -
Wulf Community Admin
-
I have the same problem if i change something in lang/en/*.json.
But only with chat messages. Text in UI change after Plugin reload immediately. Text in chat messages change only after server restart. -
-
I will continue to try to narrow down the errors. -
Maybe there is a difference in how the plugin retrieves those messages? (Loads them to a field/fields)
-
Wulf Community Admin
-
Getting them to share some code for reference would be useful.. :I
But I understand what you mean, @Wulf. I was just thinking that it might be the plugins themselves that are screwing up here, not Oxide.