FWGS / xash3d-fwgs

Xash3D FWGS engine
1.56k stars 235 forks source link

Not suport to language and hd folders #1319

Open LambdaLuke87 opened 1 year ago

LambdaLuke87 commented 1 year ago

the engine not load folder_hd and languague folders like folder_spanish Since we are here it would be interesting if you can select the languages ​​from within the game instead of game read automatically.

TheKingFireS commented 1 year ago

just copy all files inside folder_hd/folder_lang to valve/custom

a1batross commented 1 year ago

So there is the problem.

Adding such folders isn't a big issue. However, at the time when these folders are being mounted, we don't read game config yet. So we don't know exactly whether user wants to activate HD content or not.

GoldSrc resolves this by writing into system registry (on Windows), or writing .ini file (on Linux).

mmillar-bolis commented 1 year ago

What about supporting new options in liblist.gam and gameinfo.txt? These files are read ahead of time to parse other relative mount paths, like fallback_dir. Some additional options to mount hd and language directories could be:

hdmodels "1"
language "english"

Another optional idea is that the language entry could also be used to set the default value for the ui_language cvar.

A side suggestion is optionally mounting languages from a path within the <gamedir>, like <gamedir>/localization/<language>. I know this is not how GoldSrc has traditionally functioned, but being able to place optional language (and hd) files into the <gamedir> would help clean up the <basedir> for users with many mods.

a1batross commented 1 year ago

@mmillar-bolis I don't like the idea of using liblist.gam or gameinfo.txt as a configuration files.

This is something that game developer writes and user isn't supposed to touch that, many of the options may horribly break the game, like changing the DLL paths or basedir directory.

In GoldSrc, many of these options are meant to configure the UI. hdmodels controls the visibility of a checkbox in the game settings, rather than connect the _hd addon.

I can probably add another Xash-specific game config that could be read after game directory was scanned. But this better be discussed with all pros and cons considered, as such changes can be made only once, and then it turns into a legacy burden.

StenApp commented 1 year ago

I‘d like to see a multilingual option for xash3d. Today i tried valve_german with no luck, it got ignored. I had to overwrite the soundfiles in valve. No idea of getting the menus in german.

a1batross commented 1 year ago

@StenApp for now, you can move valve_german/ contents to valve/custom folder, so you don't have to replace any file.

Every string in the menu is translatable, but we do not have various translations. We do keep compatibility with Valve's GameUI translations and legacy WON strings.lst, but you can override them too with https://github.com/FWGS/mainui_cpp/blob/master/translations/mainui_skeleton_everything.txt. You have to go through every string here, translate it, rename the file to mainui_german.txt and move it resource/ folder. Then you need to set ui_language german in console and after restart menu will try to load the strings from that file.

StenApp commented 1 year ago

Thank you for the answer, i will try. I like to use the steampipe version of Half Life German with Blue shift and opposing force. And in another run Gunman chronicles german

StenApp commented 1 year ago

Why don't you use Half-Life\valve\resource\gameui_german.txt and valve_german.txt? They seem to contain a good sum of your mainui_german.txt gameui_german.txt valve_german.txt

i find them there with *_english.txt too gameui_english.txt valve_english.txt

a1batross commented 1 year ago

@StenApp what do you mean we're not?

    Localize_InitLanguage( "english" );

    const char *language = EngFuncs::GetCvarString( "ui_language" );

    if( language[0] && strcmp( language, "english" ))
        Localize_InitLanguage( language );

Menu at first tries to load _english.txtljknjkl files. After that it checks if ui_language have a specific value and IS NOT english, it loads language file on top of it.

Not only that, Localize_InitLanguage function loads these files:

    // if gamedir isn't gameui, then load standard gameui strings
    if( strcmp( gamedir, "gameui" ))
        Localize_AddToDictionary( "gameui", language );

    // if gamedir isn't valve, then load standard HL1 strings
    if( strcmp( gamedir, "valve" ))
        Localize_AddToDictionary( "valve",  language );

    // if gamedir isn't mainui, then load standard mainui strings
    if( strcmp( gamedir, "mainui" ))
        Localize_AddToDictionary( "mainui", language );

    // mod strings override default ones
    Localize_AddToDictionary( gamedir,  language );

It has some dumb checks against malicious game directory names but it loads gameui and valve files, overriding them with our mainui file, which then can be overriden by mod specific translation file.

a1batross commented 1 year ago

So we do in fact have logic to load valve_german.txt and gameui_german.txt.

It's just poorly documented, as everything else. :(

StenApp commented 1 year ago

Mhhh, maybe i rename valve_german.txt and gameui_german.txt to _english.txt. I tried it but the menu was only partly translated.

a1batross commented 1 year ago

Just set ui_language to german.

It will still be partially translated because we have custom strings. But nobody translated them to German.

DavidMacalister commented 3 months ago

Related to: #1742