How to translate/localize the default UDK GFX Main Menu

Hello my friends.

Now I want to add localization for my game, I have been reading through this

https://docs.unrealengine.com/udk/Three/LocalizedTextFiles.html

But the explanations are very poor, there is no a step by step tutorial.

I understood the folders structure and localized text files, however I am not being able to get the most basic which is to translate the main game menu.

Since I am using the default UDK UI, so all the text strings it loads from the DefaultUI.ini. From what I understood is that the localized text must be inside the localized text files which are located at \UDKGame\Localization\INT.

For example, my game’s main menu items are loaded from these strings, from the DefaultUI.ini

[UTGame.GFxUDKFrontEnd_MainMenu]
+ViewTitle=“MAIN MENU”

+ListOptions=(OptionName=“InstantAction”,OptionLabel=“PLAY GAME”,OptionDesc=“Play the Single Player Missions, Split-Screen Multiplayer and other Game Modes.”)
+ListOptions=(OptionName=“PerformanceMode”,OptionLabel=“PERFORMANCE MODE”,OptionDesc=“Run the game with all Lighting and Shading Effects turned off.”)
+ListOptions=(OptionName=“MasterVolume”,OptionLabel=“MASTER VOLUME”,OptionDesc=“Adjust the master volume.”)
+ListOptions=(OptionName=“GameOptionsAudio”,OptionLabel=“MUSIC VOLUME”,OptionDesc=“Adjust the music volume.”)
+ListOptions=(OptionName=“Exit”,OptionLabel=“EXIT”,OptionDesc=“Exit Game.”)

However, you can not translate ini files, because this I tried to cut all these strings from the defaultUI.ini and paste inside the utgame.int. It did not work, instead now my game’s main menu is empty. So that means the game will not read these strings from the INT file, only from the DefaultUI.ini

So how can I translate these menu option labels? I already made a custom game launcher which changes values on the ini files, so I can easily change in example, the engine language like this

Language=PTB

So in theory, it would load now the localized text files from \UDKGame\Localization\PTB, but how could I change the label, in example from PLAY GAME to JOGAR O JOGO (portuguese language), since the game does not load the strings from the localized text files, it loads only from the DefaultUI.ini

Please any help is very welcome.

By taking a closer look to GFxUDKFrontEnd_MainMenu.uc, I have seen that it uses an UpdateListDataProvider() function to draw the menu items, so it was not designed to have localization, I suppose.

It’s midnight where I am and I’m going to bed right now, but I just thought I would take a look here before turning in. I don’t have time to answer in detail right now, but you should take a look at this old post of mine:

For your specific situation, I think you’ll have to make your own class that extends GFxUDKFrontEnd_MainMenu, and give it localized string instead of config string for all of the text you’d like localized. Then you’ll need to create your localization file. I think that should point you in the right direction for now. I’ll check back tomorrow and see how you’re doing.

Thanks my friend, you are awesome, always supportive. I will try to create manually new click widget menus and add a localized string, instead of drawing the items as a list, which is the default for this menu. However, I think it is a shame that UDK does not have a basic working template for the localization and not even options menu. I was able to make a complete options menu by programming a custom game launcher in Visual Studio using the vb.net language, which changes values in ini files. It works perfectly, however, I think UDK should have come with a working options menu template.

Cheers.

After thinkering a lot, I think I have found the easiest solution. Since the default UDK Scaleform Menu gets it’s strings from ini files, mainly the DefaultUI.ini, and since I already can edit ini files using my custom game launcher, I will simply add a new menu selector on my custom gamelauncher to change language and in the same function i can add a simple text replace function, just like I have done for many custom game options in this same game launcher.

I know it may not be the best way, however it does the job for my game.

And about the custom mission briefing menus, which are a swf movie called in the kismet using the open gfx node, I will just create a function to read the value of the Language String from UDKEngine.ini in kismet and according to the value (EN, PTB, CH), I will make it load the related swf movie.

Ok, I was able to embed arabic characters and an arabic font, AdvertisingMedium, inside the fonts_en.fla and gfxfontlib.fla, however 2 problems occured now.

The first of all is that in flash the arabic characters are not being merged together to form the words:

And the second problem is that inside the game, it is not rendering correctly:

Is it ever possible to use arabic/hebrew characters in scaleform? By the way, my custom UDK build is from May 2011, so maybe this outdated build does not have support for arabic/hebrew characters?

I don’t think Scaleform ever supported right-to-left text. In the Scaleform window, not only are the characters not being connected, they’re being written left-to-right. Probably the only way you’re going to get Arabic text to display in the game is to create image files of the correct Arabic, and then put the images in the game.

Edit: Yeah, it looks like getting Arabic to work in Scaleform has the potential to be a major headache. Help

Exactly, I think this is the best way, use image files instead of text, and I would set these image files on the defaultui.ini, and from there it is very easy to change these strings using my custom game launcher, which edits the strings on ini files, so changing the language will be a breeze.

So now, how can I get image to display instead of text on the options label in DefaultUI.ini

+ListOptions=(OptionName=“InstantAction”,OptionLabel=“PLAY GAME”,OptionDesc=“Play the Single Player Missions, Split-Screen Multiplayer and other Game Modes.”)

You would have to change the button class in your fla/swf. This is the button class I created:

package  {
	
	import scaleform.clik.controls.Button;
	import flash.external.ExternalInterface;
	
	public class ButtonHTML extends Button {
		
		
		public function ButtonHTML() {
			super();
		}
		
		override protected function updateText():void {
            if (_label != null && textField != null) {
				if(_data != null && _data.label != null) {
					textField.htmlText = _data.label;
				}
				else {
					textField.htmlText = _label;
				}
            }
        }
		
	}
	
}

That’s valid AS 3. I think the UT menus are written in AS 2 and I don’t know if my code will work in AS 2.

Basically what you do is create a new file called ButtonHTML.as, and copy that code into it. Tell Flash Pro or Adobe Animate where to find additional .as files, and select the folder where you saved ButtonHTML.as. Then the Flash Pro Library tab, change your button class to ButtonHTML. Then whenever you would send a string of text to label the buttons (such as from DefaultUI.ini), send a string of html instead.

"<img src=\"img://PackageName.TextureName\" width=\"200\" height=\"17\" />"

Set that to whatever image you want to use. Make sure you import the image with SRGB unchecked, or else it will look too dark.

1 Like

EUREKA :grin:

I found a solution to get arabic text showing up perfectly on my game’s menu

I had to change the way default UTGame menu works in scaleform. Instead of showing up a dynamic text which it reads the string from DefaultUI.ini, I simply opened the udk_assets.fla, and edited the menus there

Instead of a text label, I added a new layer and simply added a transparent png image, exported from photoshop. Since all the menus are instanced from the menu item object, I simply duplicated this menu, renamed them to menu item 2, menu item 3 and so on, and made each menu an unique instance, then I manually added for each menu a png image as a label, like Play Game, Music Options, Start Mission, Select Mission and so on. Another advantage is that I can use any font I want.

And about the localization, it is a breeze. I just duplicate the upk file which contains these menus, add a sufix according to the language, like UDKFrontEnd_ptb, UDKFrontEnd_ar, UDKFrontEnd_cn, and UDK Engine automatically loads the correct language version, according to player’s selection.

In my custom game launcher I just added a simple drop down list selector, and each language simply sets the Language= string key from UDKEngine.ini to the right language.

Something very cool, I was not aware, is that UDK trully looks for the localized package even if you call a swf movie from kismet, which is what I have done for the mission briefing, in the beginning of each map.

However, for it to work, all the files inside the upk package (in my case are images and swf files) must have the same name, just the package name will be different.

So I am very happy ane excited for the release of my game, which will be very soon, in sha Allah (God’s willing)

2 Likes

Now something strange is happenning. I made a copy of the UDKFrontEnd.upk and renamed it UDKFrontEnd_ptb.upk (for portuguese language). Then I simply edited the udk_assets by replacing the button labels by the buttons in portuguese language. I then reimported to udk this swf movie, udk_assets, to the portuguese version package UDKFrontEnd_ptb.upk. Now when I run the game, the portuguese menus show correctly, however, I dont know why, nothing happens when I click on these button. It stops to work. But whenever I change the language to defalut, INT, it works normally.

Any help?

The only thing which works now is just pressing ESC it opens the exit dialog, but the exit button in the main menu is not working anymore, after I changed the language.

That’s interesting. I didn’t realize that there was already a localization setting that would look for different swf resources based on language.

I’m not sure why the Portuguese menu isn’t working. Does the menu work in all other languages? How are you opening the menu? Do all of the menus use the same UnrealScript class and ActionScript class?

1 Like

Hello Nathaniel.

Yes, here is the info

https://docs.unrealengine.com/udk/Three/LocalizedTextFiles.html

‘’ Binary Data

For binary data, localization just involves having different packages with an additional extension using the three letter code of the target language. So, for instance, if you have a package called Art.upk with a texture in it that needs to be localized, if the language you’re currently running is Japanese (as specified in Engine.ini), the engine will automatically first look for a package called Art_jpn.upk to find the texture before it looks for it in Art.upk.’’

The problem here is not only on portuguese, it happens with any other language, it seems something like, I don’t know, you should not localize the UDKFrontEnd.upk. In example, UDKHUD.upk contains all my custom mission briefing swf movies. I made a copy of this package for the portuguese language, called it UDKHUD_ptb.upk, and replaced the english mission briefing menus by the portuguese ones, and it worked perfectly. If the player chooses portuguese language, the engine will automatically load the portuguese swf mission briefing menus.

But, with the UDKFrontEnd.upk, it is not working, because this I said that maybe UDKFrontEnd should not be localized. I don’t know, I am just guessing it.

As I told before, I am using the default UDK Engine menu, which opens the udk_manager.swf, udk_main_menu.swf, udk_instant_action.swf, udk_dialog_exit.swf, udk_game_mode.swf, udk_map.swf. Everything is called by UTGame.GFxUDKFrontEnd class.

This is something I hate in UDK, whenever you become stuck on something and you can’t find a solution :pensive:

1 Like

Im sorry i cant be of any help here.For my self I was planning as a back up plan as im sure i will screw something up to use sound nodes wave with kismet as they I think have a property field named subtitles which basically is an array of texts to show at some time. I suspect it will work with any language you paste??(haven’t tried) and maybe use the save system just to store with which kismet sound nodes wave the level starts in order to get a language or 2 for the game?
For the menu i was planing to just change the textures of the texts as its a simple menu.And store that setting again with he save menu .
Quite poor idea actually for it all.

Another 2 things to come to mind, bare with my madness :smile:
Is to see if the kismet script node called Render Text Box from here is of some use:

I also see hourences had something called Improved FrontEnd from here to cook non-standard languages.

The download link doesn’t work but after checking it with the wayback machine, it shows me that is this thread that you may already know.From there the download links DO work.

1 Like

Thanks for your help my brother. Now I realized that my biggest problem is that all my game classes are extended from UTGame Class, and the majority of UDK devs make a game from scratch, so they don’t need to deal with these UTGame limitations. Now I realized that if I have made a custom scaleform menu from scratch would be much better than trying to mod the default UDK/UTGame Scaleform menus. However, since I am in the last phase my game’s development, I don’t think it is worth to trash out all my menus. In the worse of cases, I will let the main game menu fully localized to portuguese and english, and let the arabic and chinese only for inside the game, which I already got working, like the Mission Briefing Menus, in example. Even on steam I have the option to inform players that my game is partially localized to Chinese and Arabic, because some parts could not be translated due technical limitations. For non english players, just having the mission briefing menus fully localized, which I already have got it working, is enough for them being able to play the game and understand the history. Also everything in-game, besided the main game menu, I got it fully localized, like the cutscenes dialogs, the tutorial messages and so on.

Today I will try a last thing to get the main game menus fully localized in flash. I will add an action script function on the main menu to read a variable from an external text file, I will try to make the flash menu read the UDKEngine.ini file, the key Language, like

Language=INT
Language=PTB
Language=CHN

And according the value, I will make it load the apropriate image inside the movie clip which I will create in place of the text label. It will need to make this check for every button, which are in total just 8.

So, if in example the language key is CHN, I will make it load the menu-start-game-CN.png over the button.

I don’t know if the swf compressed inside the upk file can read an external text file. But this will be my last try.

After a lot of headaches and watching some action scripts tutorials on youtube, I think I am on the right way.

I found that swf inside upk packages can read variables from ini files using the LoadVars class, however, the ini file must have an absolute path, not a relative one.

So I made this test flash file just to see if I can change the png menus labels by reading the ini files.

This is a simple flash file with 3 elements. The first dynamic text box will print the Language= variable value from the ini file. By the way I made new ini file just for this menu, and since my custom game launcher can edit many ini files at once, so I dont need to use the UDKEngine.ini files, since it has tons of variables and action script may hang trying to read all of these.

I made a new ini file called ScaleformLanguage.ini and placed it in my game’s engine folder D:\AnaIrhabiGame

Inside the flash file, I added the menu labels. For this test I made only one button, Play Game, as a movie clip.

I placed inside this movie clip all 4 versions of the play game button, which are EN, BR, AR and CN, one on each frame.

And on this flash file, in the root level I added this action script which reads the variable of the new custom ini file I created, and it changes the button label image according the value of this ini file variable

var myLV:LoadVars;
myLV = new LoadVars();

myLV.onLoad = function(p_success:Boolean):Void  {
	if (p_success) {

		txt_info.text = myLV.Language;

		if (myLV.Language == "SLO") {
			txt_language.text = "ARABIC";
			btn_play_game_MC.gotoAndStop(1);
		}

		if (myLV.Language == "PTB") {
			txt_language.text = "PORTUGUESE";
			btn_play_game_MC.gotoAndStop(2);
		}

		if (myLV.Language == "CHN") {
			txt_language.text = "CHINESE";
			btn_play_game_MC.gotoAndStop(3);
		}

		if (myLV.Language == "INT") {
			txt_language.text = "INTERNATIONAL";
			btn_play_game_MC.gotoAndStop(4);
		}

	} else {
		txt_info.text = "Error loading file!";
	}
};

myLV.load("D:\\AnaIrhabiGame\\ScaleformLanguage.ini");

And for my surprise, it is working in game :grin:

Each time I change the language value on the ini file, and reload the map, the menu label changes correctly, according the language selected!!!

Now next step will be copy this action script and menus labels to udk assets.fla, which controls the game’s main menu.

Finally, after 3 days of almost going crazy, it worked. The solution, as mentioned before, I did use a custom action script function to read the selected language variable from a new ini file I made just for this. My custom game launcher can edit any ini file on the player PC, so it can edit both the UDKEngine.ini, to set the engine language and also set the game language in ScaleformLanguage.ini, and the udk menu will detect the player choice, and according the player choice, it will load the correct png file for the button label.