Rafał Posted May 11 Share Posted May 11 Whenever I send strings directly in lua to function DisplayMessage or DisplayChatText my end result always begins with '#' in game. It's not a big deal but as a perfectionist I simply do not like it, can I do something about it? Code for comparison: DisplayMessage('Witaj '.. GetUsername() ..'!' .. '\nW dzisiejszym scenariuszu zrobisz totalnie nic', 10) Link to comment Share on other sites More sharing options...
SIMRAIL Team s0n1c Posted May 13 SIMRAIL Team Share Posted May 13 Hello You have to set key in your specific language file in Locales folder. So for example for polish it will be pl.lang with key like this HelloMessage=Your text And then use it in DisplayMessage function like this DisplayMessage("HelloMessage") Remember that you also need the main en.lang file if your scenario doesn't support all languages available in SimRail, then it will be used as default language file. More information about file structure you can find here. 1 Link to comment Share on other sites More sharing options...
Rafał Posted May 13 Author Share Posted May 13 5 godzin temu, s0n1c napisał(a): You have to set key in your specific language file in Locales folder True, I've noticed it, but using locale files I cannot call function GetUsername() and marge it with string from lang file, or am I wrong? Link to comment Share on other sites More sharing options...
SIMRAIL Team s0n1c Posted May 14 SIMRAIL Team Share Posted May 14 To make this possible you should use DisplayMessage_Formatted function, where {x} is replacement for your GetUsername function. For example key in locales should look like: Message=Welcome {0} in this scenario and the code with DisplayMessage_Formatted: DisplayMessage_Formatted("Message", 10, GetUsername()) Replacements in key should be defined in range from 0 to 4, that means you have limit of 5 replacements for 1 key. 1 1 Link to comment Share on other sites More sharing options...
Rafał Posted May 14 Author Share Posted May 14 Do I have to declare those lang files somewhere, or are they loaded automatically if only game will find them in 'Locales' folder? Because it doesnt work for me... Link to comment Share on other sites More sharing options...
SIMRAIL Team s0n1c Posted May 15 SIMRAIL Team Share Posted May 15 W dniu 13.05.2024 o 09:21, s0n1c napisał(a): Remember that you also need the main en.lang file if your scenario doesn't support all languages available in SimRail, then it will be used as default language file. They are loaded automatically from Locales folder, but the problem you have is basically what i have mentioned here. You are missing default language file which is en.lang. Make sure all language files should have the same structure, that means your key Cango should be in both pl.lang and en.lang files. 1 Link to comment Share on other sites More sharing options...
Recommended Posts