ValveSoftware / SteamOS

SteamOS community tracker
1.55k stars 70 forks source link

Some Games Require setting LC_ALL Variable for correct Language. Not possible due to stripped glibc package. #794

Closed NightHammer1000 closed 11 months ago

NightHammer1000 commented 2 years ago

Some Games Require that you pass LANG= %command% or LC_ALL= %command%

To launch the Game in the Correct Language. Some Games Default to English because thats the set System Language.

Doing this is not possible because the installed glibc was stripped of all its Language Files. Which is, in my opinion, a big no-go.

Attempting to enable a locale in /etc/locale.gen and running locale-gen results in:

Generating locales...
  de_DE.UTF-8...failed to set locale!
[error] cannot open locale definition file `de_DE': No such file or directory

This can only be fixed by reinstalling glibc via pacman.

The ability to set locales should be shipped in the stock Image. There is no reason why it shouldn't.

bertogg commented 1 year ago

Ok interesting, assuming your rootfs was not modified you probably have de_DE.UTF-8 set somewhere else (in /etc/ maybe?), I'll see if I have time to look into this tomorrow.

bertogg commented 1 year ago

Yeah so if e.g. /etc/locale.conf has been modified it's possible to reproduce the problem in Gamescope as well, so depending on what you have changed in your system you can hit this problem.

I haven't been able to do it simply by adjusting the regional settings in KDE.

But in general, yes, trying to change the locale from en_US.UTF-8 to something else can result in problems, so I would advise people against doing that unless they really know what they're doing.

Is there any game that does not work properly because of locale issues ? TF2 works fine in German as it is now.

Cederick commented 1 year ago

Yeah so if e.g. /etc/locale.conf has been modified it's possible to reproduce the problem in Gamescope as well, so depending on what you have changed in your system you can hit this problem.

I haven't been able to do it simply by adjusting the regional settings in KDE.

But in general, yes, trying to change the locale from en_US.UTF-8 to something else can result in problems, so I would advise people against doing that unless they really know what they're doing.

Is there any game that does not work properly because of locale issues ? TF2 works fine in German as it is now.

My problem is that I need to use the German locale due to my English not being perfect and wanting to use the desktop in my local language. And only have this issue encountered in TF2 so far. So I really urge for a fix to be found that first off fixes locales for other languages and second gets rid of the issue in TF2. Because the Steam Deck advertises itself as a device with desktop capabilities. And reading/understanding the UI and text is a big part of said feature.

bertogg commented 1 year ago

My problem is that I need to use the German locale due to my English not being perfect and wanting to use the desktop in my local language.

I understand the problem, but as discussed earlier in this thread this is not just about the locales, the translation files are also not included in the OS images.

So at the moment the desktop only works in English, and trying to change that can have unexpected side effects. As for the TF2 problem it seems to happen because you modified LC_TIME, LC_NUMERIC, etc. If you undo those changes the error should disappear.

bertogg commented 1 year ago

About Flatpak apps: someone mentioned it in an earlier comment but it's worth making this clear.

Flatpak has its own language configuration and defaults to the system language (English in this case). If you want to add additional languages (say Japanese and German) you can do it this way:

$ flatpak config --set extra-languages "ja;de"
$ flatpak update

With this you can run e.g. PPSSPP in any of those languages or change the locale in Lutris.

This is not a workaround. This is how additional languages are added to Flatpak, and with this apps will have access to those locales, as you can see if you try something like this:

$ flatpak run --command=sh org.ppsspp.PPSSPP -c 'locale -a' 

One other important thing here is that adding additional locales to SteamOS system-wide (running locale-gen and all that) will not make them magically available to Flatpak apps.

Cederick commented 1 year ago

Replying to https://github.com/ValveSoftware/SteamOS/issues/794#issuecomment-1517843799

Is it possible to set the flatpack default language to de for example without having to add extra languages to flat pack and having to force them for each package?

bertogg commented 1 year ago

Is it possible to set the flatpack default language to de for example without having to add extra languages to flat pack and having to force them for each package?

If you add a language to Flatpak it will be applied to all packages, you don't need to do it one by one.

$ flatpak config
languages: *unset* (default: en)
extra-languages: *unset*

$ flatpak config --set extra-languages "de"

$ flatpak config
languages: *unset* (default: de;en)
extra-languages: de

$ flatpak update

$ flatpak install lutris

$ flatpak run --command=sh net.lutris.Lutris -c 'locale -a'
C
C.utf8
de_AT
de_AT@euro
de_AT.utf8
de_BE
de_BE@euro
de_BE.utf8
[...]
bertogg commented 1 year ago

Is it possible to set the flatpack default language to de

Sorry, I just realized that I misread your question.

Yes, you can set the default language to German for all Flatpak apps:

$ flatpak override --env=LANG=de_DE.UTF-8

$ flatpak override --show
[Environment]
LANG=de_DE.UTF-8
Cederick commented 1 year ago

Wouldn't it be possible to make the language selection in gamescope to also affect this and set it for the user without having to know about this by yourself or are there other ways of dealing with different languages in the works down the line that would make this redundant?

$ flatpak override --env=LANG=de_DE.UTF-8
kisak-valve commented 1 year ago

Hello @Cederick, what you've described is feature creep. There's no legitimate reason why gamescope should be meddling with localization settings. In theory, that would go into a systemd service to start and immediately finish beside it.

bertogg commented 1 year ago

Hi everyone,

the latest image from the main channel (20230522.1000) comes with additional locales and translation files, so you should be able to change the desktop language and to run a game with a different locale. If you want to give it a try, feedback will be appreciated.

Some words of warning:

xrishox commented 1 year ago

Is there a list of added locales?

bertogg commented 1 year ago
bg_BG.utf8        en_IL.utf8       es_GT.utf8      nl_AW
C                 en_IN            es_HN.utf8      nl_AW.utf8
cs_CZ.utf8        en_IN.utf8       es_MX.utf8      nl_BE.utf8
C.UTF-8           en_NG            es_NI.utf8      nl_NL.utf8
da_DK.utf8        en_NG.utf8       es_PA.utf8      pl_PL.utf8
de_AT.utf8        en_NZ.utf8       es_PE.utf8      POSIX
de_BE.utf8        en_PH.utf8       es_PR.utf8      pt_BR.utf8
de_CH.utf8        en_SC.utf8       es_PY.utf8      pt_PT.utf8
de_DE.utf8        en_SG.utf8       es_SV.utf8      ro_RO.utf8
de_IT.utf8        en_US.utf8       es_US.utf8      ru_RU.utf8
de_LI.utf8        en_ZA.utf8       es_UY.utf8      ru_UA.utf8
de_LU.utf8        en_ZM            es_VE.utf8      sv_FI.utf8
el_CY.utf8        en_ZM.utf8       fi_FI.utf8      sv_SE.utf8
el_GR.utf8        en_ZW.utf8       fr_BE.utf8      th_TH.utf8
en_AG             es_AR.utf8       fr_CA.utf8      tr_CY.utf8
en_AG.utf8        es_BO.utf8       fr_CH.utf8      tr_TR.utf8
en_AU.utf8        es_CL.utf8       fr_FR.utf8      uk_UA.utf8
en_BW.utf8        es_CO.utf8       fr_LU.utf8      vi_VN
en_CA.utf8        es_CR.utf8       hu_HU.utf8      vi_VN.utf8
en_DK.utf8        es_CU            it_CH.utf8      zh_CN.utf8
en_GB.utf8        es_CU.utf8       it_IT.utf8      zh_HK.utf8
en_HK.utf8        es_DO.utf8       ja_JP.utf8      zh_SG.utf8
en_IE.utf8        es_EC.utf8       ko_KR.utf8      zh_TW.utf8
en_IL             es_ES.utf8       nb_NO.utf8
NightHammer1000 commented 1 year ago

Great. Desktop finally is usable and all the old games finally start in the right language.

Thank you.

rKsanu2MMYvypWePtQWM commented 1 year ago

It seems very weird that not all European Union countries are supported in this change (at least from the list above). It seems weird that Valve didn't add support for the countries the Deck is being sold at.

germanicianus commented 1 year ago

Just for the record - see https://github.com/ValveSoftware/SteamOS/issues/816#issuecomment-1569123259 why supporting multiple locales is important for Valve's revenue (from my understanding).

@bertogg, many thanks for highlighting in https://github.com/ValveSoftware/SteamOS/issues/794#issuecomment-1517843799 that Flatpak has an independent language setting but defaults to the system language.

With main you mean the preview update channel which is built from the master branch, right?

bertogg commented 1 year ago

With main you mean the preview update channel which is built from the master branch, right?

I mean the preview channel, yes.

bertogg commented 12 months ago

This is now available in SteamOS 3.5 preview (OS build 20230915.100)

superboo07 commented 11 months ago

Updating the flatpak langauge no longer makes that language accessible for programs in the preview branch

bertogg commented 11 months ago

@superboo07 do you have an example of a Flatpak app where you cannot set the language?

bertogg commented 11 months ago

Let's do a recap on how to change the language settings in Flatpak in SteamOS 3.5.


CASE 1: you want to change the language for the desktop and for all Flatpak apps.

After this, open a terminal and run sudo flatpak update, this will download the Flatpak locales for the new language. You only need to do this once. All apps that you install from now on will come with the selected language pack (if they support it).

This should be enough, all desktop and Flatpak apps will run using the locale that you have selected.


CASE 2: you want to run a Flatpak app with a locale different from the system one.

NOTES

Even if you select a certain locale when you run an app that doesn't mean that the app is going to show the messages in that language. It's up to the app to decide whether to show the messages based on the current locale or based on some other criteria.

Example: PPSSPP uses the language that is defined in the configuration file, ~/.var/app/org.ppsspp.PPSSPP/config/ppsspp/PSP/SYSTEM/ppsspp.ini

superboo07 commented 11 months ago

@superboo07 do you have an example of a Flatpak app where you cannot set the language?

Lutris, it used to work in a past update where adding the locale would allow setting prefixes made in it to use that locale. Now the locales don't show up at all

xrishox commented 11 months ago

you can manually set environment variables in lutris on a per app basis. it definitely works as i have done it personally.

superboo07 commented 11 months ago

you can manually set environment variables in lutris on a per app basis. it definitely works as i have done it personally.

it can't use japanese locale without it being installed in flatpak, which used to work in the past but doesn't anymore.

superboo07 commented 11 months ago

Still desperate for a fix, tried running the below command to check if it had installed the locale

flatpak run --command=sh net.lutris.Lutris -c 'locale -a' 

Output revealed that it indeed hadn't, and I don't know where to go from here since I have added the japanese locale to my extra languages in flatpak

superboo07 commented 11 months ago

I have at this point attempted everything I can, the only thing I can reasonably conclude is that something has been been broken between the switch from 3.4 to 3.5. A fix would be much enjoyed as this issue stops a multitude of software that would've once ran near perfectly from running at all.

xrishox commented 11 months ago

once again it definitely does work. i'm on steamos 3.5 right now playing japanese games with japanese locale in lutris.

superboo07 commented 11 months ago

Could you post the output you recieve apon using the below command then please

flatpak run --command=sh net.lutris.Lutris -c 'locale -a' 
xrishox commented 11 months ago
(deck@steamdeck ~)$ flatpak run --command=sh net.lutris.Lutris -c 'locale -a'
C
C.utf8
en_AG
en_AU
en_AU.utf8
en_BW
en_BW.utf8
en_CA
en_CA.utf8
en_DK
en_DK.utf8
en_GB
en_GB.utf8
en_HK
en_HK.utf8
en_IE
en_IE@euro
en_IE.utf8
en_IL
en_IN
en_NG
en_NZ
en_NZ.utf8
en_PH
en_PH.utf8
en_SG
en_SG.utf8
en_US
en_US.utf8
en_ZA
en_ZA.utf8
en_ZM
en_ZW
en_ZW.utf8
ja_JP.eucjp
ja_JP.utf8
POSIX
superboo07 commented 11 months ago

What are the steps you took to install the japanese locale, I used the ones that were given above in this thread but they didn't work on 3.5

xrishox commented 11 months ago

It's been a long time since i did it so i don't remember exactly. that said I use linux outside of the steam deck and these are the usual flatpak locale commands i run:

flatpak config --set extra-languages ja_JP.UTF-8

flatpak config --user --set languages "en;jp;ja"

flatpak update

i'm sure that those commands are some combination of incorrect or redundant, but they have worked for me on my linux installs. someone else can probably fix them to make them how they should be. then inside of lutris or bottles i don't use the built in locale dropdowns i manually set the environment variables in the settings on a prefix by prefix basis.

environment variables i use:

LC_ALL="ja_JP.UTF-8" 
TZ="Asia/Tokyo"

for what it's worth i didn't run any commands at all after upgrading to 3.5 because it never stopped working from before.

bertogg commented 11 months ago

@superboo07

What are the steps you took to install the japanese locale, I used the ones that were given above in this thread but they didn't work on 3.5

# Check the existing configuration
$ flatpak config
languages: *unset* (default: en)
extra-languages: *unset*

# Add the Japanese locale
$ sudo flatpak config --set extra-languages "ja"

# Check the updated configuration
$ flatpak config
languages: *unset* (default: en;ja)
extra-languages: ja

# Download the localization files
$ sudo flatpak update
superboo07 commented 11 months ago

Replying to https://github.com/ValveSoftware/SteamOS/issues/794#issuecomment-1748871773

these are the exact steps I took. I suppose there is a chance my install was bugged though.

superboo07 commented 11 months ago

Replying to https://github.com/ValveSoftware/SteamOS/issues/794#issuecomment-1747975321

Maybe it keeps locales installed before 3.5, I suppose you could check if it'll install the german locales to lutris since it won't hurt to test. Though I'm thinking my 3.5 install might've been bugged

bertogg commented 11 months ago

these are the exact steps I took. I suppose there is a chance my install was bugged though.

Can you send me the output of these two commands?

$ flatpak config

$ flatpak run --command=sh net.lutris.Lutris -c 'locale -a'
superboo07 commented 11 months ago

these are the exact steps I took. I suppose there is a chance my install was bugged though.

Can you send me the output of these two commands?

$ flatpak config

$ flatpak run --command=sh net.lutris.Lutris -c 'locale -a'

When I was on 3.5 The output for flatpak config is:

languages: *unset* (default: en)
extra-languages: ja

The output for checking the flatpak locale is:

C
C.utf8
en_AG
en_AU
en_AU.utf8
en_BW
en_BW.utf8
en_CA
en_CA.utf8
en_DK
en_DK.utf8
en_GB
en_GB.utf8
en_HK
en_HK.utf8
en_IE
en_IE@euro
en_IE.utf8
en_IL
en_IN
en_NG
en_NZ
en_NZ.utf8
en_PH
en_PH.utf8
en_SG
en_SG.utf8
en_US
en_US.utf8
en_ZA
en_ZA.utf8
en_ZM
en_ZW
en_ZW.utf8
POSIX
superboo07 commented 11 months ago

Replying to https://github.com/ValveSoftware/SteamOS/issues/794#issuecomment-1761148598

I had tried sudo in the past, it didn't make a difference in making it install the jp locale. The only thing it changed was how it asked for my sudo password, if I didn't specify sudo it would bring up a dialog box with a test input for me to put it in.