1. Hello everyone! Especially @Wulf =D
    I've got some strange.... situation. Here is the function that I'm usually using to get lang line:
    Code:
    string GetMsg(string key, BasePlayer player = null) => lang.GetMessage(key, this, player == null ? null : player.UserIDString);
    So, easy. If the player is not null is should return lang line for his game lang. Right? Right. And it use to work just fine, but now - no matter if I'm sending player it still returns default lang file for the current server language.
    What can be a problem?
    Even the code like this:
    Code:
    string GetMsg(string key, BasePlayer player = null) => lang.GetMessage(key, this, player.UserIDString);
    Doesn't do anything.....
    So? Is this me or something with oxide? Thanks in advance =D
    [DOUBLEPOST=1500425213][/DOUBLEPOST]I've also check a few my previous plugins - didn't work as well =(
    [DOUBLEPOST=1500425890][/DOUBLEPOST]Once again, to simplify - if the server lang is "en" it return "en" lang line.
    If server language is "ru" it returns "ru" lang line.
    it doesn't matter what language being used by the client with sended ID
    [DOUBLEPOST=1500425936][/DOUBLEPOST]Here is my lang datafile.
    [DOUBLEPOST=1500426084][/DOUBLEPOST]Ok, I think I got it - for some reason the steam ID wich I'm currently work on is not listed in the lang file......
    [DOUBLEPOST=1500426593][/DOUBLEPOST]Ok, correct me if I'm wrong, but it looks like player language only being saved if it's different from the server, so....
    Now the question - what if the server language would be changed "On fly"?
    The players, whos lang wasn't saved before would have different lang lines....
    I don't know if this is a problem, but still - I think something must be done with this. Maybe saving evryones lang, or just check everyone if the server lang was changed....
     

    Attached Files:

  2. Wulf

    Wulf Community Admin

    The language for each player is set when they first connect. The server default is only used if set to forced, a player doesn't have a preference set for whatever reason, or there was no localized key found.
     
  3. Forced? What are you talking about?
    Anyway - as I can see - if the player have the same lang as the server - his preference are not being saved, and if server lang being chaged during the player is connect - his lang would change with the server....
    This is how it works now. Double checked.
     
  4. Wulf

    Wulf Community Admin

    You can force a server language so that player preferences are ignored by setting "lang xx" (xx beyond a language code other than en) on your server. You can see where the language is set for a player here: Oxide/RustHooks.cs at develop · OxideMod/Oxide · GitHub

    If I'm reading Oxide/Lang.cs at develop · OxideMod/Oxide · GitHub right though, your theory may be correct. It looks like it does remove the player's language if it matches the server's language.
     
  5. And this is exacly what I'm talking about!
    Idk if this is a problem, but I think that preferences should be saved no matter what....
     
  6. Wulf

    Wulf Community Admin

    The reason they aren't saved right now if they are the same is that'd it cause slower lookups and larger file size. If the server is forcing a language, then player preferences wouldn't even matter.
     
  7. Ok.... I got it. Thread can be closed. Thanks for the reply!