Raised This Month: $ Target: $400
 0% 

[TF2] Translating game item names


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fakuivan
Senior Member
Join Date: Nov 2015
Old 11-05-2015 , 15:57   [TF2] Translating game item names
Reply With Quote #1

Hi there!

I am making a plugin using the ItemDB database and plugin that shows the client a list of aviable taunts for the TF2 class that they are playing as, so far, so good.
The problem came when I realized that the database generated by the python program used by the plguin reads data from the file items_game.txt that is phrased in english only, leaving the rest to the game engine to translate it using the tf_%clientLang%.txt file (I gess).

I KNOW, I can do this using the translation system that comes with SourceMod but I would have to do it manually every time a taunt is added to the game, the idea is to make the plugin as "mantenaince free" as possible.

The question is: How can you make the game engine on the client side translate a generic string to the client's language? and, is that even possible?

EXAMPLE

Translate the Taunt name to spanish
Input: "TF_zoomin_broom" or index 30672
expected output : "Burla: La Nimbus Mercenaria" (in english "Taunt: Zoomin' Broom")

In tf_spanish.txt
Code:
"TF_zoomin_broom"	"Burla: La Nimbus Mercenaria"
"[english]TF_zoomin_broom"	"Taunt: Zoomin' Broom"

Last edited by fakuivan; 11-05-2015 at 16:53.
fakuivan is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-05-2015 , 16:06   Re: [TF2] Translating game item names
Reply With Quote #2

The server itself can't translate Valve translation phrases as the code to do so is in the game's client code.

Having said that... it might be possible. I'll have to play around with the TextMsg usermessage to check.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
fakuivan
Senior Member
Join Date: Nov 2015
Old 11-05-2015 , 16:52   Re: [TF2] Translating game item names
Reply With Quote #3

So, if that turns out to be possible, what string do I need to use? "TF_zoomin_broom" or "Taunt: Zoomin' Broom"
fakuivan is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 11-05-2015 , 17:23   Re: [TF2] Translating game item names
Reply With Quote #4

Just parse the tf_spanish.txt file?
Potato Uno is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-05-2015 , 17:25   Re: [TF2] Translating game item names
Reply With Quote #5

Quote:
Originally Posted by Potato Uno View Post
Just parse the tf_spanish.txt file?
It's in UTF-16, and as FlaminSarge found out the hard way, SourceMod's KeyValues stuff doesn't appear to support it.

Now, if TextMsg does allow custom messages instead of a formatting string as its first String argument, then you'd need "#TF_zoomin_broom" to do a lookup of the name on the client.

Haven't been able to test it yet as I've been busy with other stuff (plus I need access to a game client and I've been at work)
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 11-05-2015 at 17:26.
Powerlord is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 11-05-2015 , 17:29   Re: [TF2] Translating game item names
Reply With Quote #6

Don't use keyvalues because it's not even in keyvalues form. Just manually parse it as its flatfile form by reading each line individually. It's just a mess of string explosions and all but if you do it on OnPluginStart you should be ok (bar the watchdog timer).

Parsing it off-site using an external program and then having a second database to map translations to is better (although more work).
Potato Uno is offline
fakuivan
Senior Member
Join Date: Nov 2015
Old 11-05-2015 , 18:18   Re: [TF2] Translating game item names
Reply With Quote #7

Quote:
Originally Posted by Potato Uno View Post
Don't use keyvalues because it's not even in keyvalues form. Just manually parse it as its flatfile form by reading each line individually. It's just a mess of string explosions and all but if you do it on OnPluginStart you should be ok (bar the watchdog timer).


Parsing it off-site using an external program and then having a second database to map translations to is better (although more work).
It seems like that's what I am going to do :º, I'll post it when I finish it.

Quote:
Originally Posted by Powerlord View Post
It's in UTF-16, and as FlaminSarge found out the hard way, SourceMod's KeyValues stuff doesn't appear to support it.

Now, if TextMsg does allow custom messages instead of a formatting string as its first String argument, then you'd need "#TF_zoomin_broom" to do a lookup of the name on the client.

Haven't been able to test it yet as I've been busy with other stuff (plus I need access to a game client and I've been at work)
#TF_zoomin_broom, as in items_game.txt

Quote:
Originally Posted by Potato Uno View Post
Just parse the tf_spanish.txt file?
3,71mb just for the spanish file :/
fakuivan is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 11-06-2015 , 03:06   Re: [TF2] Translating game item names
Reply With Quote #8

Support for parsing the translation files with the KV natives has been in SM for a while.
__________________
asherkin is offline
fakuivan
Senior Member
Join Date: Nov 2015
Old 11-07-2015 , 03:08   Re: [TF2] Translating game item names
Reply With Quote #9

Quote:
Originally Posted by asherkin View Post
Support for parsing the translation files with the KV natives has been in SM for a while.
Does that mean that I can load the ~12 files of 3mb each? How does that work?
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 14:06.


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