Check language
Moderators: GZDoom Developers, Raze Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
-
- Posts: 8
- Joined: Fri Sep 09, 2022 6:45 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
Check language
Is there a way to check language in ACS? I want to change voice acting depeding which language the player is using.
-
- Lead GZDoom+Raze Developer
- Posts: 48519
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Check language
Yes, you can check the 'language' CVAR, but be aware that this may be a bit tricky with languages that have multiple variants.
The language CVAR can be two or three letters, where the third letter defines a language variant.
For example, English can be enu for US, eng for UK, ena for Australia plus several others. Unless you want to support such variants, only check the first two letters.
The language CVAR can be two or three letters, where the third letter defines a language variant.
For example, English can be enu for US, eng for UK, ena for Australia plus several others. Unless you want to support such variants, only check the first two letters.
-
- Posts: 8
- Joined: Fri Sep 09, 2022 6:45 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
Re: Check language
I see,thank you!
-
- Posts: 8
- Joined: Fri Sep 09, 2022 6:45 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
Re: Check language
hmm How do I actually do the check in ACS?
I have tried this and it prints "finnish" in any language.
I have tried this and it prints "finnish" in any language.
Code: Select all
str language = GetCVarString("language");
if (Strcmp(language, "FI") == 1)
print(s:"finnish");
else
print(s:"something else");
-
- Lead GZDoom+Raze Developer
- Posts: 48519
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Check language
strcmp returns 0 for equality.
But you'd be better off doing the check like this
to account for lower case content and sub-languages.
But you'd be better off doing the check like this
Code: Select all
if (stricmp(strleft(language, 2), "FI") == 0)
-
- Posts: 8
- Joined: Fri Sep 09, 2022 6:45 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
Re: Check language
Work's perfeckt! Thanks!