Internationalization - MissingResourceException

Hey guys.

I’m working on a Vaadin Touchkit application (with maven). I want to add a function which makes it possible for the user to change default language (for example, if default is English, user should be able to change it to something else, like norwegian). I want to use properties (no xml) and ResourceBundle, making something easy from scratch.
I was thinking about a login form, with a button on the navigationbar which the user can toggle and swap between languages. The language he choose should be the default for the application.

I think I’ve implemented something that should work, but I’m getting an error:

java.util.MissingResourceException: Can't find bundle for base name no.example.testapp.languages.language, locale no
        at java.util.ResourceBundle.throwMissingResourceException(
        at java.util.ResourceBundle.getBundleImpl(
        at java.util.ResourceBundle.getBundle(
        at no.example.testapp.ui.Constant.initBundle(
        at no.example.testapp.ui.LoginView.<init>(
        at no.example.testapp.MyUIProvider.init(

I can’t seem to fix this error. I’ve checked a lot on the Internet, tried different methods without luck. Same error always.

So my structure look like this:

no.example.testapp →
no.example.testapp.ui → and
no.example.testapp.languages → and

This is what my file looks like:

package no.example.testapp.ui

import java.util.Locale;
import java.util.ResourceBundle;

public class Constant 
    public static ResourceBundle _BUNDLE = null;
    public static Integer _LANGUAGE = 0; // 0 = norsk, 1 = engelsk
    static ClassLoader cl = Thread.currentThread().getContextClassLoader();
    public static void initBundle()
        if(_LANGUAGE == 0)
            _BUNDLE = ResourceBundle.getBundle("no.example.testapp.languages.language", new Locale("no"), cl);
        else if(_LANGUAGE == 1)
            _BUNDLE = ResourceBundle.getBundle("no.example.testapp.languages.language", new Locale("en"), cl);

This is how I set the text on a label on my LoginView class. This is not the whole class, just some of the importants parts (Constant.initBundle fails for example, line 32).

public LoginView()
        setCaption(Constant._BUNDLE.getString("LoginView.title")); //$NON-NLS-1$

        Button toggleButton = new Button("Toggle");
        toggleButton.addClickListener(new ClickListener()
            public void buttonClick(ClickEvent event)
                if(Constant._LANGUAGE == 0) 
                    Constant._LANGUAGE = 1;
                else if(Constant._LANGUAGE == 1) 
                    Constant._LANGUAGE = 0;
                MyUIProvider.setView(new LoginView());

I’ve tried to follow this method:

AS you see, I still get the error.

I tried to follow this guide as well:
Still same error.

Does anyone see why I keep getting this error? Any other ways to solve this problem?

I’ve seen the GasProvider project, but it was kinda hard.

2 years laters and noone knows how to load the ResourceBundle on Vaadin 7, or where to place the properties

For a maven project:

  • Place your properties file into src/main/resources/VAADIN
  • Default behavior of maven places this resources into …/target/classes (you can examine this in the war)
  • To get the properties file you just have to use “VAADIN.filename”

If you want to keep your structure and thus change the folder location of the resources in maven, follow this guide: