Search code examples
javarhino

Locale is always French on mozilla Rhino (at least on French platforms)


I have a PC for which default Locale is "fr", and even if I set context.setLocale(<some locale") to any other locale, I still have messages in French.


Solution

  • It work if I do this:

    Locale locale = new Locale("");
    context.setLocale(locale);
    

    The reason is that there is only the following resource files on Rhino 1.712: - org.mozilla.javascript.resources.Messages - org.mozilla.javascript.resources.Messages_fr And the code in Rhino does:

    ResourceBundle rb = ResourceBundle.getBundle("org.mozilla.javascript.resources.Messages", locale);
    

    Which means that Rhino can only find the "fr" resource.