mainui_cpp icon indicating copy to clipboard operation
mainui_cpp copied to clipboard

Create an interface for language switching.

Open davidmacalister opened this issue 11 months ago • 7 comments

For some time now, there has been the ui_language command. I would like to propose the idea of native interface translations for Xash. Currently, most of the strings in Xash are translatable, but it's not very simple for users to apply translations, such as my Portuguese translation.

To address this, we need to consider a few things:

  • A native interface for language switching in the settings.

https://github.com/user-attachments/assets/2f774ffd-8f4e-4e88-b825-3be563b1ef01

  • A way to distribute translations along with Xash.
  • A way to have an extras.pk3 for other languages.

davidmacalister avatar Mar 04 '25 22:03 davidmacalister

Woah, how did you reload all the strings in mainui_cpp? Or it's just a mockup?

a1batross avatar Mar 04 '25 22:03 a1batross

Woah, how did you reload all the strings in mainui_cpp? Or it's just a mockup?

Well, this is a really bad and totally hacked-together code because I don't know how Mainui works. But basically, these are just text strings since I set render_picbutton_text 1 in gameinfo.txt, as there is no way to support multiple extras.pk3 files for different languages.

davidmacalister avatar Mar 04 '25 22:03 davidmacalister

What this code does is simply execute the command ui_language "selected language", and that's it :(

davidmacalister avatar Mar 04 '25 22:03 davidmacalister

MainUI only fetches strings of ones and then uses translated strings for rendering. Reloading them on the fly would be tricky.

I think if the proposed Language page (which I totally approve btw, it's awesome) would just ask to restart the game to apply settings, that would be a technically correct solution. Many games do this anyway.

a1batross avatar Mar 04 '25 23:03 a1batross