Page 1 of 1
Message localization
Posted: Sun Nov 16, 2014 9:42 am
by nullable
Hi,
I need localization text message(HintText). How can I make it?
Posted: Sun Nov 16, 2014 1:09 pm
by satoon101
Posted: Sun Nov 16, 2014 7:02 pm
by nullable
Thanks. But when I try to get language I get empty string
Syntax: Select all
from events import Event
from engines.server import engine_server
from players.helpers import index_from_userid
@Event
def player_activate(game_event):
userid = game_event.get_int('userid')
index = index_from_userid(userid)
lang = engine_server.get_client_convar_value(index, 'cl_language')
print('LANGUAGE: %s' % lang)
Posted: Sun Nov 16, 2014 7:24 pm
by Ayuto
Works fine for me after I fixed the NameError in you last line. Which game did you use to test this?
Posted: Sun Nov 16, 2014 7:42 pm
by nullable
Cs:go
Posted: Sun Nov 16, 2014 11:08 pm
by satoon101
Just as in your other thread, I have to ask if you are using a cracked version of the game? If you are, you will get no further support. This functionality has been proven to function properly on CS:GO.
Posted: Mon Nov 17, 2014 5:49 am
by nullable
I am using official steam account and csgo from it. Text locale I got from your thread.
Posted: Fri Nov 21, 2014 6:43 am
by nullable
Why is it doesn't work on my official steam account (CS:GO)?
Syntax: Select all
lang = engine_server.get_client_convar_value(index, 'cl_language')
Posted: Fri Nov 21, 2014 3:42 pm
by satoon101
I would like to apologize to you. It seems that, while this value used to be used in CS:GO (like every other Valve game), it no longer is... I am not sure when or why that happened, and I am not sure how we are supposed to get the language to use outside of that value. This is the first mentioning I can find of that change:
https://forums.alliedmods.net/showthread.php?p=2105364#post2105364
Very frustrating that they would disable that cvar so randomly...
Posted: Fri Nov 21, 2014 10:09 pm
by Doldol
satoon101 wrote:I would like to apologize to you. It seems that, while this value used to be used in CS:GO (like every other Valve game), it no longer is... I am not sure when or why that happened, and I am not sure how we are supposed to get the language to use outside of that value. This is the first mentioning I can find of that change:
https://forums.alliedmods.net/showthread.php?p=2105364#post2105364Very frustrating that they would disable that cvar so randomly...
Check the IP and then guess the language? Not 100% perfect by any means, but better than nothing? Like suggested in the AM topic.
Posted: Fri Nov 21, 2014 10:17 pm
by satoon101
Yeah, I am certainly not big on that idea, personally. I would much rather Valve/HPE bring that cvar back.
Posted: Sat Nov 22, 2014 11:03 am
by Ayuto
Today I did some testings and it seems like we can still access cl_language if we start a client convar query. This works fine for me:
Syntax: Select all
from engines.server import engine_server
from listeners import OnQueryCvarValueFinished
from listeners import ClientFullyConnect
from players.helpers import edict_from_index
from players.helpers import edict_from_userid
from events import Event
@OnQueryCvarValueFinished
def query(*args):
print('OnQueryCvarValueFinished', args)
@Event
def player_jump(event):
print('COOKIE', engine_server.start_query_cvar_value(
edict_from_userid(event.get_int('userid')), 'cl_language'))
This is the result I get:
Syntax: Select all
COOKIE 12
OnQueryCvarValueFinished (12, 1, _engines.QueryCvarStatus.SUCCESS, 'cl_language', 'german')
However, since we can't get the value immediately we should query the player's language when he connects (e.g. ClientConnect or ClientFullyConnect) and store the value somewhere. Then we also need to add a new function (e.g. GetClientLanguage) which returns the stored value if the game is CS:GO and starts an "immediate query" for all other games. A good place for the new function could be the new PlayerEntity class.
Posted: Sat Nov 22, 2014 2:15 pm
by satoon101
Alright, good to know. That will definitely be something we will add. Thank you for testing.
Posted: Tue Nov 25, 2014 11:55 pm
by satoon101
In case any of you haven't been checking the repository, we have implemented changes to fix this issue. Those changes are currently being tested i a new branch (language_changes), but should soon be merged into the entities_changes branch.