Graphic lumps localization?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom 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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Bilbö Bägginson
Posts: 27
Joined: Mon Nov 30, 2020 11:11 pm
Graphics Processor: nVidia with Vulkan support

Graphic lumps localization?

Post by Bilbö Bägginson »

Is there any possibility to change shown pic according to chosen language.
I want to localize patchItems in main menu and "read this" page.
User avatar
Enjay
 
 
Posts: 26540
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Graphic lumps localization?

Post by Enjay »

I don't know about graphics (I *think* the answer is probably no, but I don't know for sure). However, it is possible to redefine the menus using text instead of graphics lumps (in MENUDEF) and these could then probably be localised.
User avatar
Bilbö Bägginson
Posts: 27
Joined: Mon Nov 30, 2020 11:11 pm
Graphics Processor: nVidia with Vulkan support

Re: Graphic lumps localization?

Post by Bilbö Bägginson »

Ok, I think I could set my pics as symbols of custom font or something. But what about info-page localisation? Because it is just a single image and you can`t add any text there, as I know.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49130
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Graphic lumps localization?

Post by Graf Zahl »

There is an option for this, but with one caveat: The replacement graphic needs to be the same size as the original. The feature also hasn't seen much testing.
You have to put the localized versions of your graphics into "localized/textures/{texturename}.{languageid}.{extension}, e.g. 'localized/textures/titlepic.de.png'.
The whole feature is also under user control, if the 'cl_gfxlocalization' CVAR is set to 0, it will force use of the original graphic and there's other settings here when it comes to graphical menu entries - of course these are strongly discouraged when making a localization-aware mod.

The feature was never officially announced because it didn't really work as well as we wanted - but for text containing fullscreen graphics or in-game textures it should be ok.
User avatar
Bilbö Bägginson
Posts: 27
Joined: Mon Nov 30, 2020 11:11 pm
Graphics Processor: nVidia with Vulkan support

Re: Graphic lumps localization?

Post by Bilbö Bägginson »

It could translate full-screen credit image, but not the patches. But it`s ok, I could replace them with text. Thanks
User avatar
Bilbö Bägginson
Posts: 27
Joined: Mon Nov 30, 2020 11:11 pm
Graphics Processor: nVidia with Vulkan support

Re: Graphic lumps localization?

Post by Bilbö Bägginson »

Graf Zahl wrote: Tue Jun 07, 2022 12:37 am There is an option for this, but with one caveat: The replacement graphic needs to be the same size as the original. The feature also hasn't seen much testing.
You have to put the localized versions of your graphics into "localized/textures/{texturename}.{languageid}.{extension}, e.g. 'localized/textures/titlepic.de.png'.
Is there some way to use the feature with pictures defined in TEXTURES?
I need to scale them.
N00b
Posts: 12
Joined: Sat Mar 04, 2023 8:33 am

Re: Graphic lumps localization?

Post by N00b »

Sorry for bumping an old thread, just came across this feature (have dreamt for it for quite a long time). It does not seem to work for me however (I'm using g4.11-pre195). I attach a sample file with a 'localized' wall texture, the variant with a window should be shown by default, but a plain wall if the language is Russian. However I can never see the second behaviour, no matter how I change the 'cl_gfxlocalization' and 'language' CVARs or restart the level or game.
I just hope this problem occurs because of my wrongdoing or a code oversight, would be a great loss if it is discontinued... I'm able to trigger this warning by using a 4-letter code, so that gives me hope the localization code is not completely cut off.
I also tried this with PNG textures for BoA (which is my main incentive to use this feature), to no avail.
You do not have the required permissions to view the files attached to this post.
User avatar
AFADoomer
Posts: 1337
Joined: Tue Jul 15, 2003 4:18 pm

Re: Graphic lumps localization?

Post by AFADoomer »

I'm pretty sure the localized texture lookup for in-map textures was commented out in this commit.
N00b
Posts: 12
Joined: Sat Mar 04, 2023 8:33 am

Re: Graphic lumps localization?

Post by N00b »

Thank you very much, AFADoomer!
Graf, is there any possibility this gets reinstated in a not so distant future? Was it removed during debugging (or the feature caused problems in Raze)?
User avatar
ramon.dexter
Posts: 1558
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Graphic lumps localization?

Post by ramon.dexter »

This would be actually pretty useful feature to have :)
User avatar
Sir Robin
Posts: 537
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Graphic lumps localization?

Post by Sir Robin »

I haven't tried this out yet but I think you could also use the canvas feature to draw directly on a texture. It allows you to draw on a texture, so you could draw the texture as a blank without any localization and then draw the localization onto it in-game. Use an event handler to watch for a language change and update your textures there.
N00b
Posts: 12
Joined: Sat Mar 04, 2023 8:33 am

Re: Graphic lumps localization?

Post by N00b »

Thanks! The canvas might be a useful feature. I've also considered doing the replacement through a ZScript handler, just for modified copies of textures (because the English fonts that were originally used for them are most likely to have been lost, and adding a new in-game font for DrawText() would increase the burden on the already heavy BoA ZScript font system).
Even ACS has ReplaceTextures for "quite" a while. However I'm hesitant because 1) BoA is already bloated with handlers (around 30 so far), and 2) the handler will have to independently process every single image file in the localized/ directory; I doubt this would be anywhere near the native code in terms of speed.
I'll try this handler approach anyway. With ZScript pretty much everything is possible - if you are willing to pay with performance; hopefully in this case the price won't be too large.

Edit. Plus, of course, the textures will get replaced for all players, no matter the language setting they have; and we plan coop support.
Edit2. And GetFilesInFolder is not exported to ZScript, so I'll have to use a separate lump with all the filenames.
User avatar
Tormentor667
Posts: 13547
Joined: Wed Jul 16, 2003 3:52 am

Re: Graphic lumps localization?

Post by Tormentor667 »

@Graf Zahl, do you consider readding this feature again? I'd really like to test it for The City of the Damned 2 Remaster and also as N00b has already stated for Blade of Agony.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed

Re: Graphic lumps localization?

Post by wildweasel »

Tormentor667 wrote: Sun Oct 22, 2023 2:37 pm @Graf Zahl, do you consider readding this feature again? I'd really like to test it for The City of the Damned 2 Remaster and also as N00b has already stated for Blade of Agony.
If you'd really like the devs' attention you might try starting a ticket thread in Feature Suggestions.
User avatar
Tormentor667
Posts: 13547
Joined: Wed Jul 16, 2003 3:52 am

Re: Graphic lumps localization?

Post by Tormentor667 »

I will just do that, thank you

Return to “Scripting”