Nifty - problem with properties file

Dear all,

I have three properties files located at “Interface/Properties/”:
menu.properties
menu_en.properties
menu_fr.properties

When I add the following code to my nifty xml file
[java]<resourceBundle id=“menu” filename=“Interface/Properties/menu” />[/java]

An error is occurred:
[java]java.lang.RuntimeException: java.util.MissingResourceException: Can’t find bundle for base name Interface/Properties/menu, locale fr[/java]

Can someone tell me why ???

Thank a lot !

Just tried on my own project and it works without errors , could you provide some simple code that reproduce this issue ? :slight_smile: . As I can see it should work…

Here is my code to initialize the Nifty object :
[java]private Nifty nifty;

@Override
public void initState(AppStateManager stateManager, Application app) {
// Init menu
guiViewPort = this.app.getGuiViewPort();
flyCam = this.app.getFlyByCamera();

NiftyJmeDisplay niftyDisplay = 
		new NiftyJmeDisplay(app.getAssetManager(),
							app.getInputManager(),
							app.getAudioRenderer(),
							app.getViewPort());
nifty = niftyDisplay.getNifty();
nifty.setLocale(Locale.FRENCH);
nifty.fromXml("Interface/Menus/screen.xml", "index", 
		new MenuGUIController(this.app, settings, nifty));
guiViewPort.addProcessor(niftyDisplay);
flyCam.setEnabled(false);

}[/java]

And this is the Nifty XML:
[java]<?xml version=“1.0” encoding=“UTF-8” standalone=“no”?>
<nifty xmlns=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>

&lt;useStyles filename="nifty-default-styles.xml" /&gt;
&lt;useControls filename="nifty-default-controls.xml" /&gt;
&lt;resourceBundle id="menu" filename="Interface/Properties/menu" /&gt;

&lt;screen id="index" controller="mygame.guicontroller.MenuGUIController"&gt;
    &lt;!-- Background image --&gt;
    &lt;layer id="background" childLayout="center"&gt;
        &lt;image filename="Interface/Menus/IndexNifty-small.jpg"&gt;&lt;/image&gt;
    &lt;/layer&gt;
&lt;/screen&gt;

</nifty>[/java]

And the asset:

Thank you in advance

your Properties folder is not under Interface folder , the right path to the bundle is : Properties/menu , so change the register bundle tag in :
[xml]
<resourceBundle id=”menu” filename=”Properties/menu” />
[/xml]

:slight_smile: , I hope it works now :smiley:

1 Like
@relucri said: your Properties folder is not under Interface folder , the right path to the bundle is : Properties/menu , so change the register bundle tag in : [xml] <resourceBundle id=”menu” filename=”Properties/menu” /> [/xml]

:slight_smile: , I hope it works now :smiley:

Yes ! This is it… I’m feeling dummy now :facepalm: I don’t know why I didn’t see that simple error…

Thank a lot !

your welcome! :slight_smile: ihih don’t worry it happens! :smiley: