Raised This Month: $32 Target: $400
 8% 

[ANY?] Localization Server (2016-09-20)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
nosoop
Veteran Member
Join Date: Aug 2014
Plugin ID:
5010
Plugin Version:
0.6.0
Plugin Category:
Technical/Development
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    1 
    Plugin Description:
    Provides built-in-game localized strings to plugins
    Old 01-19-2016 , 01:15   [ANY?] Localization Server (2016-09-20)
    Reply With Quote #1

    Description:
    A small library to query for localized strings in a database by string token (such as the keys from /tf/resource/tf_english.txt).

    Localizations are read from the game's /resource directory through a Python script and stored in an SQLite database. Kind of similar to TF2 Item DB. You'll want to run the script every now and then to keep the translations fresh.

    Originally, I wasn't going to finish working on this (I've had the Python script for what feels like forever), but I've been working on a plugin that reads certain usermessages that would need colorization as of late. And someone mentioned Sourcemod being unable to access these translations.

    If you're only interested in sending localized messages (i.e., not interested in getting the localized string to manipulate it), you're probably better off with Powerlord's PrintValveTranslation stocks, which also supports formatting and doesn't need to keep an SQLite database up to date.

    Installation:
    1. Install localization_server.smx as you would any other plugin.
    2. Add localization strings.
      1. If using TF2 (and if you only care about very outdated TF2 localizations):
        1. Download and unpack the language-db.7z file available here to addons/sourcemod/data/sqlite
          (Note: That database does not get updates.)
      2. If trying to use strings other than those under /tf/resources (manual generation):
        1. Install the vdf library.
        2. Modify the Python script (utilities/localization_db.py) as needed to point to your game directory, language files, and Sourcemod installation, then run. Requires Python 3. I assume the language files are structured in the same way as TF2's; I can't test them myself.
    Things this plugin might clobber:
    I've only ever tested English strings so far, if that tells you anything.

    Usage:

    The plugin currently provides two non-threaded "resolve" natives and one threaded "get" native (and associated callback). Documentation is provided in the include.
    (Note: do not include the "#" symbol in the token.)

    Sample usage is available as the localization_test plugin.

    Version History:
    • 0.6.0 Added ResolveAllLocalizedStrings, which returns a StringMap containing all localized versions of the specified token. Non-threaded. Should make it easier for those that want to print multiple messages in one go.
      • Also updated the script to support Russian, Thai, and Bulgarian. Wonder if there's a good way to get a list of supported languages so I don't have to update it by hand.
      • Also, the script uses Python 3 syntax.
    • 0.5.1 Made the native callback fail more gracefully (a failed threaded query now passes an empty string to the callback instead of just throwing a native error), so any data handles can be closed. Forgot to commit this; it's been a while. (How did this get 22 downloads? Nobody's commented or anything.)
    • 0.4.0 The GetLocalizedString function actually uses threaded queries now!
    • 0.3.0 Initial plugin release.
    Source code and include files on Github.
    Attached Files
    File Type: sp Get Plugin or Get Source (localization_server.sp - 824 views - 6.9 KB)
    __________________
    I do TF2, TF2 servers, and TF2 plugins.
    I don't do DMs over Discord -- PM me on the forums regarding inquiries.
    AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

    Last edited by nosoop; 09-21-2016 at 01:00. Reason: Updated to 0.6.0
    nosoop is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 23:33.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode