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

Solved [L4D(2)] How to change client language?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 03-23-2021 , 07:12   [L4D(2)] How to change client language?
Reply With Quote #1

I've written some plugins that use translations. I would like to test that each of the translated messages are working correctly. How do I change my language so I can test translations?

I've tried changing the language in Steam (my account drop-down near the top of the screen -> Store Preferences), changed my language in Windows (language preferences -> Windows display language and language preferences -> Apps & websites), and did a right-click on L4D2 in Steam then Properties -> Language. None of these had any effect on the game except for the last one (right-click L4D2 in Steam then Properties -> Language). That option caused the the L4D2 characters to speak in the selected language, but messages from my plugin were still displayed in English, not the selected language. Of course, I have valid messages in my translation file for the selected language, it just displayed the English one instead of the selected language.

Did I miss something in setting language preferences?

For those of you who test language translations, how do you change language so the game displays plugin messages in the selected language?
__________________

Last edited by Mystik Spiral; 03-24-2021 at 11:07.
Mystik Spiral is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 03-23-2021 , 07:22   Re: [L4D(2)] How to change language?
Reply With Quote #2

Usually, changing the language on Steam and the game's properties is enough for me. I just restart Steam after doing so for the changes to take effect.
__________________
Psyk0tik is offline
TomL.
Veteran Member
Join Date: Oct 2017
Location: Germany
Old 03-23-2021 , 10:46   Re: [L4D(2)] How to change language?
Reply With Quote #3

You can force it via addons\sourcemod\configs\core.cfg
Check supported languages from addons\sourcemod\configs\languages.cfg

https://github.com/alliedmodders/sou...nfigs/core.cfg

Line 24 - 30

Code:
	/**
	 * Language that multilingual enabled plugins and extensions will use to print messages.
	 * Only languages listed in languages.cfg are valid.
	 *
	 * The default value is "en"
	 */
	"ServerLang"	"en"
Line 75 - 82

Code:
	/**
	 * Enables or disables whether SourceMod reads a client's cl_language cvar to set 
	 * their language for server-side phrase translation.
	 *
	 * "on"		- Translate using the client's language (default)
	 * "off"	- Translate using default server's language
	 */
	"AllowClLanguageVar"		"On"
TomL. is offline
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 03-24-2021 , 10:43   Re: [L4D(2)] How to change language?
Reply With Quote #4

Thank you Crasher_3637 and TomL. I was referring to client side messages, but your post led me to an answer.

I can manually set cl_language in my client's autoexec.cfg, or in the client's Windows registry under...

Computer\HKEY_CURRENT_USER\SOFTWARE\Valve\Ste am\Language

And probably the easiest option, in the client's Steam session, all the way at the top left part of the screen click...

Steam -> Settings -> Interface -> Select the language you wish Steam to use (requires Steam to restart)

And to be complete, you can change which language the L4D2 characters speak by right-clicking the L4D2 icon in Steam then Properties -> Language

It is interesting to me that there are separate settings for the client display language and the client spoken language, but now I know how to change both. Thanks again.
__________________

Last edited by Mystik Spiral; 03-24-2021 at 10:48. Reason: minor typo
Mystik Spiral is offline
TomL.
Veteran Member
Join Date: Oct 2017
Location: Germany
Old 03-24-2021 , 10:45   Re: [L4D(2)] How to change language?
Reply With Quote #5

I was providing you a way which is unrelated to the game as cl_language is not a valid cvar in all of the games sourcemod supports.

Last edited by TomL.; 03-24-2021 at 10:48.
TomL. is offline
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 03-24-2021 , 11:01   Re: [L4D(2)] How to change language?
Reply With Quote #6

Quote:
Originally Posted by TomL. View Post
I was providing you a way which is unrelated to the game as cl_language is not a valid cvar in all of the games sourcemod supports.
Yes, thank you. In the code to display a translation message with %T you can specify LANG_SERVER or client (player id) to determine whether the server language or the client language is used to translate the message...

PrintToChat(client, "%T", "AnnounceAll", client);
...or...
PrintToChat(client, "%T", "AnnounceAll", LANG_SERVER);

If client (player id) is used, then it will use the client language as determined by...

Steam -> Settings -> Interface -> Select the language you wish Steam to use (requires Steam to restart)

If LANG_SERVER is used, then it will use the server language as determined by...

<Left4Dead2_DedicatedServer_Location>\addons\ sourcemod\configs\core.cfg\ServerLang
__________________

Last edited by Mystik Spiral; 03-24-2021 at 11:18. Reason: add example
Mystik Spiral is offline
TomL.
Veteran Member
Join Date: Oct 2017
Location: Germany
Old 03-24-2021 , 11:04   Re: [L4D(2)] How to change client language? (RESOLVED)
Reply With Quote #7

You can mark the topic as solved by pressing edit on your main post, Go Advanced and choose [Solved] from the title dropdown menu

Last edited by TomL.; 03-24-2021 at 11:04.
TomL. is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-24-2021 , 11:08   Re: [L4D(2)] How to change client language?
Reply With Quote #8

CS:GO have this problem, cl_language is hidden and is using language setting by Steam register key.

There is one kind plugin tough.
GeoIP Language Selection
Bacardi 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 04:34.


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