Raised This Month: $51 Target: $400
 12% 

View Poll Results: What do you think?
Waste of time 1 25.00%
Useful 2 50.00%
I'll use it 1 25.00%
Voters: 4. You may not vote on this poll

What do you think about this plugin? |TFtDB| KeyPhrase translations made easy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fakuivan
Senior Member
Join Date: Nov 2015
Old 11-29-2015 , 15:28   What do you think about this plugin? |TFtDB| KeyPhrase translations made easy
Reply With Quote #1

Hi there!

A while ago I decided to make a plugin that could show a menu to the player containing all of the available weapons for each slot. Since TF2 Items Info was dead I decided to use TF2 Items Database instead. That plguin is currently running in my server, though it is working and is very functional when I finished it I felt like it was incomplete since my native language is spanish and I run the tf2 client in that language so, it felt a little out of place.

I started to analyze how I could translate the names of those items to spsnish, the first thing that came into my head was to use the included translation system in sourcemod, but if you think about it, it is a little silly since all of those translations are already in the tf2 translation files. The way that valve stores translations in tf2 is pretty easy to understand, you have a lot of files in the tf2/resource folder that match this filename "tf_(Only allow characters from a-Z).txt", those are translation files and they follow this basic structure

Code:
"lang"
{
	"Language"	"spanish"
	"Tokens"
	{
		"TF_ClassSkill_Heavy"	"HEAVY: Girar el cañón de la ametralladora"
		"[english]TF_ClassSkill_Heavy"	"HEAVY: Spin Minigun Barrel"
		"TF_zoomin_broom"	"Burla: La Nimbus Mercenaria"
		"[english]TF_zoomin_broom"	"Taunt: Zoomin' Broom"
	}
}
Except for english

Code:
"lang"
{
	"Language"	"english"
	"Tokens"
	{
		"TF_ClassSkill_Heavy"	"HEAVY: Spin Minigun Barrel"
		"TF_zoomin_broom"	"Taunt: Zoomin' Broom"
	}
}
Knowing that, it was just a matter of parsing all of the files and storing the result somewhere to retrive a tarnslation to any language using a token (what I call KeyPhrase, TF_zoomin_broom). The first thing that came to my head was to solve that problem using the integrated sourcemod KV system, That was absolutely not a good idea beacuse the translation files take up 65~mb of space in the hardrive, so using that was not an option becuase it could screw up any server as tf2 items info did.

I finally settled down on creating an sqlite databse and store all of the translations there. This is a much cleaner and a faster way to do it, the only problem is that it'd be more complicated to setup than any plugin if I planned to parse the files and buid the database outside of sourcemod, which I did, the database builder was programmed in Python and it takes about 15-25 seconds to build it. It's not as fast as I would like to but it works and you only have to run it when you update the server (assuming that you have python installed in your server, it comes included with some distos).

Yesterday I kinda finished setting up the natives and testing for memory leaks. It works, and it's pretty fast (using threaded queries) considering that the final database has 12072 rows (phrases) and 26 columns (languages). I made a test plugin and this is the output.

Code:
] sm_debug_Tgetphraserow TF_zoomin_broom
[TFtDB Test] Searching KeyPhrase in the DB...
[TFtDB Test] Results for TF_zoomin_broom:
[TFtDB Test] brazilian. Provocação: Vassoura Veloz
[TFtDB Test] bulgarian. Присмех: Профучаващата метла
[TFtDB Test] czech. Taunt: Zoomin' Broom
[TFtDB Test] danish. --not translated to this language--
[TFtDB Test] dutch. Bespotting: Bliksemse Bezem
[TFtDB Test] English. Taunt: Zoomin' Broom
[TFtDB Test] finnish. Pilkka: Lähtölakaisu
[TFtDB Test] french. Raillerie : Le balais filant
[TFtDB Test] german. Verspottung: Brausender Besen
[TFtDB Test] greek. Χλευασμός: Zoomin' Broom
[TFtDB Test] hungarian. Beszólás: Seprűn söprés
[TFtDB Test] italian. --not translated to this language--
[TFtDB Test] japanese. --not translated to this language--
[TFtDB Test] korean. --not translated to this language--
[TFtDB Test] norwegian. --not translated to this language--
[TFtDB Test] polish. Drwina: Lot na Miotle
[TFtDB Test] portuguese. Provocação: Vassoura Veloz
[TFtDB Test] romanian. Taunt: Zoomin' Broom
[TFtDB Test] russian. Насмешка: Улётные мётлы
[TFtDB Test] schinese. 嘲讽:扫帚飞行术
[TFtDB Test] spanish. Burla: La Nimbus Mercenaria
[TFtDB Test] swedish. Hån: Hast på Kvast
[TFtDB Test] tchinese. 嘲諷:飛翔掃帚
[TFtDB Test] turkish. Alay: Yakınlaşan Süpürge
[TFtDB Test] ukrainian. Кепкування: політ на мітлі
[TFtDB Test] Finished.
The natives can be implemented in any plugin that you might be building to make it more dynamic and to fit a wider audience. Some natives are:
Spoiler


Please keep in mind that this a work in progress and I WILL add (custom query) and remove natives becuse some of those seem to redundant. The main focus of this was on the functionality of the plugin itself so that's why I tried not to get into a lot of technical details.

I just wanted ask if you consider this plugin to be useful or just a huge waste of time D: . I hugely appreciate your feedback so don't be shy! Tell me what you think and thanks a lot for reading this, have a great day.

Last edited by fakuivan; 12-12-2015 at 21:10.
fakuivan 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 21:24.


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