Page 1 of 1

LangStrings

Posted: Fri Aug 05, 2016 1:19 pm
by decompile
Hey,

Im just wondering why LangStrings always creates two files.

Im simply using

Syntax: Select all

strings = LangStrings('plugin_strings')

def text(message, keywords, language):
return strings[message].get_string(language, **keywords)


but in resource/source-python/translations/ i have plugin_strings.ini & plugin_string_server.ini .

plugin_string_server is completly empty, but gets auto generated on delete.

Re: LangStrings

Posted: Fri Aug 05, 2016 1:33 pm
by L'In20Cible
The server file can be used by the server owner to modify the strings and keep those modifications when the plugin is updated.

Re: LangStrings

Posted: Fri Aug 05, 2016 1:35 pm
by satoon101
The server file is for server operators to make changes/additions.

For instance, if a server operator wants to add a language that is not currently supported by the plugin, they use the server specific file to add those in. Then, if the plugin gets updated, they will overwrite the base file and not the server file with their additions.

Now, they should also be notifying the plugin maintainer of these changes/additions. But, in case they don't, or the plugin maintainer does not add the changes before their next release of the plugin, the server specific file will still be intact.

Also, this allows server operators make changes to already included languages, in case they want to use a slightly different translation than the ones that come with the plugin. The server file's values will always be used over the plugin's values.

satoon101 wrote:* Please note that when you get a LangString instance, another file will automatically be created at the same location with _server appended to the filename you pass. Please do not upload this server specific file with your addons, as the purpose of these types of files is so that the server can have their own langstrings added to your script. If you were to include the file in your upload, it would cause server owners to accidentally overwrite their server specific file defeating the purpose of the file, as they would have to re-add their langstrings.

Re: LangStrings

Posted: Fri Aug 05, 2016 1:57 pm
by decompile
Thats awesome! Good to know

Re: LangStrings

Posted: Fri Aug 05, 2016 3:30 pm
by satoon101
I should also note that the _server.ini files aren't created as completely empty files. They contain a header that we get from this translation file:
https://github.com/Source-Python-Dev-Te ... trings.ini

Maybe we should update the headers to explain a bit more in detail the reason for the files. After all, it's the server operators, not plugin writers, that will need to know what they are there for and how to use them.