Message localization

Please post any questions about developing your plugin here. Please use the search function before posting!
nullable
Senior Member
Posts: 137
Joined: Sat Nov 08, 2014 7:22 pm

Message localization

Postby nullable » Sun Nov 16, 2014 9:42 am

Hi,

I need localization text message(HintText). How can I make it?
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Nov 16, 2014 1:09 pm

Image
nullable
Senior Member
Posts: 137
Joined: Sat Nov 08, 2014 7:22 pm

Postby nullable » Sun Nov 16, 2014 7:02 pm

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)
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Sun Nov 16, 2014 7:24 pm

Works fine for me after I fixed the NameError in you last line. Which game did you use to test this?
nullable
Senior Member
Posts: 137
Joined: Sat Nov 08, 2014 7:22 pm

Postby nullable » Sun Nov 16, 2014 7:42 pm

Cs:go
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Nov 16, 2014 11:08 pm

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.
Image
nullable
Senior Member
Posts: 137
Joined: Sat Nov 08, 2014 7:22 pm

Postby nullable » Mon Nov 17, 2014 5:49 am

I am using official steam account and csgo from it. Text locale I got from your thread.
nullable
Senior Member
Posts: 137
Joined: Sat Nov 08, 2014 7:22 pm

Postby nullable » Fri Nov 21, 2014 6:43 am

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')
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Nov 21, 2014 3:42 pm

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...
Image
User avatar
Doldol
Senior Member
Posts: 200
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Postby Doldol » Fri Nov 21, 2014 10:09 pm

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Nov 21, 2014 10:17 pm

Yeah, I am certainly not big on that idea, personally. I would much rather Valve/HPE bring that cvar back.
Image
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Sat Nov 22, 2014 11:03 am

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Nov 22, 2014 2:15 pm

Alright, good to know. That will definitely be something we will add. Thank you for testing.
Image
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Nov 25, 2014 11:55 pm

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.
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 140 guests