Message localization
Message localization
Hi,
I need localization text message(HintText). How can I make it?
I need localization text message(HintText). How can I make it?
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)
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')
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...
https://forums.alliedmods.net/showthread.php?p=2105364#post2105364
Very frustrating that they would disable that cvar so randomly...
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#post2105364
Very 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.
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: This is the result I get:
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.
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'))
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.
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 127 guests