Mod Switch – Localizing the Main Menu is not that hard

UT3 LogoPushing forward with the mod switch tutorial, We currently have the UI replaced and can step into the more interesting aspects of building our game. Before we get too far into the meat and potatoes of the process though it will be good to get Localization under our wings, as it really builds upon the processes that we are already familiar with and will make our game appeal to a larger audience. (The more people who can READ what is being presented in your game the more will be able to help you mold it into something that is actually interesting).

So where do we start?

This section of the tutorial will begin with explaining how to localize a string within your game, allowing you to configure your messages to actually make sense to your friends, and will end with the walkthrough of how to localize our main menu. Once that is completed you will be free to do as you wish to make your game as fun or boring as you choose.

Localization in Unreal 3 is handled by a series of files, each within their respective language subdirectory. In following my tutorial you have allowed yourself to have a dev location for your localization, [End3r]/Unpublished/CookedPC/Localization, and under this directory are five folders…

Directory Language Suffix Example
DEU German deu EUI.deu
ESN Spanish esn EUI.esn
FRA French fra EUI.fra
INT English/International int EUI.int
ITA Italian ita EUI.ita

Within each of these directories Unreal looks for files with the proper suffix and loads them into its localization system. The File is a text file, so it is quite easy to format or edit, and requires no software to register them. All we need to do is let Unreal know where this directory is located.

Inside DefaultEngine.ini

[Core.System]
+SeekFreePCPaths=..End3rCookedPC
+LocalizationPaths=..End3rCookedPCLocalization

Make sure you rebuild your configurations and from this point forward when you run UT3 it will, on its own, go through this directory and load the proper file for your local, depending on the installed version of UT3. For those of you who are observant you may have seen a previous post of mine with the keys for UT3 that are useful in tracking down the install location for the game. You should note that there are five Local’s and there are really only five keys (and then the 64 bit editions). This will be useful when i step out of UT3 development and into the section on how to distribute the mod.

Go ahead and create the UI localization file for your language. From this point forward i will be resuming the standards prescribed in the first section of this tutorial. [Localization]/EUI.int has been created and as yet has no contents. Looking at the localization files distributed by epic you should see the following format:

[SectionTitle]
EntryName=String or explanatory details put here.

This pattern will be very important as everything we do from this point forward will be in respect to this. Each section can have as many entries below it as you feel necessary, but shouldn’t have spaces in them. The section title should also be without spaces. It is common place for variables and class names to not have spaces within them, so you should probably stick to that as a standard.

Add a section in here as follows:

[TitleScreen]
Copyright=Copyright © 2008-2009 Gneu.org Some Rights Reserved.

Please do feel free to replace the actual copyright notice if you wish. The text itself is completely irrelevant, as we are just trying to update our title page with some text value. With this entry in here you can open up Unreal Ed and Open up your UIScene. Once there select the copyright label (lblCopyright) and on the right should be a list of properties for it. If you go up to the very top under the Data > DataSource > MarkupString entry is a string that follows the format <Strings:FileName.SectionTitle.EntryName>. Within my setup i will be making an entry like this <Strings:EUI.TitleScreen.Copyright>. You may or may not see it update in your editor, but when you load it up in your game you should now see your localization message. I would include a screen but it really seems like a waste of time, since you have already seen my localized messages are the same as the ones already shared.

Localizing the Main Menu is a bit more involved, primarily because we are using the menu list for the functionality to be consistent with the way Epic has already created it. Below is a checklist of items, and mind you ill be glossing over much of this because the Datastore is already registered, it just needs to be modified to use a DataProvider.

  1. Create DataProvider Class
  2. Update our Datastore to respect new DataProvider, instead of defaulted strings
  3. Make proper entries in the localization files to respect the DataProvider

The DataProvider class is a binding between the Localized data and the Datastore. Lets start with that class, as it is really quite simple and straight forward.

Inside EUIDataProvider_MainMenuItems.uc

class EUIDataProvider_MainMenuItems extends UTUIResourceDataProvider
    PerObjectConfig;

/** Friendly displayable name to the player. */
var localized string FriendlyName;

/** Localized description of the map */
var localized string Description;

This is essentially copied from the UTUIDataProvider_MainMenuItems. You may think i am breaking a law here, since i was harping on all of the other developers earlier about their use of derivation. The reason this works here is because the entries are bound by the class, and that derivation of the class caused some quirky issues. Epic seems to have used the same standard (not deriving DataProvider classes) and so i have stuck to it as well. All that really matters is that the underlying native code is derived.

Next, we will step back into our Datastore and will be rewriting it to make reference to our DataProvider from here on out.

Inside EUIDataStore_MenuItems

class EUIDataStore_MenuItems extends UTUIDataStore_MenuItems
    Config( EUI );

defaultproperties
{
   ElementProviderTypes(0)=(ProviderTag="MainMenu",ProviderClassName="End3r.EUIDataProvider_MainMenuItems")

   Tag="EMenuItems"
}

Once this is completed you really only have a couple further additions to make the Main menu localized. Since we already pointed our Menu List to this Datastore that doesn’t need to be updated. but if you run it right now UT3 is going to think you are out of your mind and will display blank entries in the Menu List. It is looking for the localization entries and we haven’t made them yet.

Inside EUI.int

; Main Menu UI =================================================================
[InstantAction EUIDataProvider_MainMenuItems]
FriendlyName=Instant Action
Description=Jump right into the action with some bots.

[Multiplayer EUIDataProvider_MainMenuItems]
FriendlyName=Multiplayer
Description=Host or join a multiplayer game.

[Community EUIDataProvider_MainMenuItems]
FriendlyName=Community
Description=See your stats, demos, and the latest news and downloads from the Unreal community.

[Settings EUIDataProvider_MainMenuItems]
FriendlyName=Settings
Description=Configure your game settings.

[Exit EUIDataProvider_MainMenuItems]
FriendlyName=Exit
Description=Exit to the desktop.

And with that you should be green to go forward with the rest of your game. Localizing the UI has some interesting things to learn from it. I hope you enjoyed this walk through, because from this point forward things are going to become more fun and interesting in terms of building a mod. The next section of this guide will relate to the background Matinee configuration. Rest assured that it will go smoothly, because its really not too difficult.

Best of luck.

As a quick side note i would like to say thank you to the many of you who have read this tutorial. Much of the feedback has helped me mold the guide into a much more useful format. I would like to make a request that if you are using this guide as a part of your mod you provide some form of attribution back here and or to my own mod, because without both of these hobbies of mine this guide would not at all have been possible.

Thank you all =) And as always – please take care.

  • Hello Bob,

    First off, thanks a lot for these tutorials, they are a HUGE help to me. I am new to scripting, been in graphics design for awhile, so I am trying to enhance my skill set with some programming. I have followed all the tutorials with success until I got to this one. Everything is working fine until I try to use the Menu system from the localization int file. I triple checked all of my code with yours on this page and tried many variations of things, but it will not load up the Menu, it just shows blanks. I saw where you mentioned it is looking for the localization entries and we haven’t made them yet, so I should add them. I have made them and I have updated my EUIDataStore_MenuItems adding the data provider, but it still is not showing up. I know my localization file is being read because it shows my copyright text I added in the previous tutorial.
    Do you have any suggestions?

  • Bob

    Actually, yes, I do.

    This is a very frustrating issue, because it is not entirely clear from my previous tutorials, but you will need to have the appropriate elements in the SimpleList > List section. Ten to one, that is the issue. The List is used to provide the elements, and the localization just hooks into them.

    If you need it, I am on AIM/Gtalk more often than not. Hit me up and we can work through it.

  • Thanks, I tried all of that before in the other tutorial, my issue is I can not seem to get the SimpleList/List to save my changes. I make them, refresh the UIScene and it just resets back. Even with the markup in the datasource, when I try to delete the Campaign Menu Item, it comes right back when I refresh the UIScene or exit it. Thanks for any help!

  • F

    Hello Bob,
    Thank for tutorial it’s great for help me to mod, i follow your tutorial and have some problem the same
    a dataprovider in listmenu not appear but when i test in label it’s work
    Can you give me more explain for this problem?

    Thank you ( sorry for my english i’m thai people 🙂 )

    • Bob

      I will need to talk to you more to figure out what you mean exactly. Please feel free to add me to your MSN and contact me there.

      [email protected]

  • Hi Bob,
    I like your tutorial. It is very useful and it really helped me to mod. As soon as I finish watching the tutorial, I immediately followed the instructions. And fortunately, it worked. Thanks!

  • Jay Ingersoll

    Hi Bob,

    Thank you for this very informative post, I am still a newcomer to scripting. I will definitely watch the tutorial and I believe that it will improve my capabilities of making scripts. Thank you a lot and I’m taking a look ahead to touch you.