LangStrings

Please post any questions about developing your plugin here. Please use the search function before posting!
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

LangStrings

Postby decompile » Fri Aug 05, 2016 1:19 pm

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.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: LangStrings

Postby L'In20Cible » Fri Aug 05, 2016 1:33 pm

The server file can be used by the server owner to modify the strings and keep those modifications when the plugin is updated.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: LangStrings

Postby satoon101 » Fri Aug 05, 2016 1:35 pm

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.
Image
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: LangStrings

Postby decompile » Fri Aug 05, 2016 1:57 pm

Thats awesome! Good to know
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: LangStrings

Postby satoon101 » Fri Aug 05, 2016 3:30 pm

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.
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 141 guests