Menu

#435 Load properties from location (internationalization)

undecided
closed-out-of-date
nobody
5
2015-09-19
2015-08-13
No

Hi!
I have a problem when i'm trying to load a properties file to a template using resourceBundle.

I'm trying to load it using:

ResourceBundle rb = ResourceBundle.getBundle("com.freemarker", new Locale("es"));

the property file is called "message_es" locate at "com.freemarke". I'm sending the properties to the template using:

dataModel.put("local", rb);

When i'm trying to call a property from the template i'm calling this way:

${local.welcome}

But it doesn't work. I'm just getting this error

FreeMarker template error:
The following has evaluated to null or missing:
==> local [in template "helloWorld.ftl" at line 5, column 4]

I suppose it have to be on the way i'm calling the properties file. But i don't know how to fix it.

Plz let me know if i'm doing something wrong... and thanks :)

Discussion

  • Dániel Dékány

    • Group: 2.3.21 --> undecided
     
  • Dániel Dékány

    According the error message, local is either null or isn't present in the data model at all. The strange thing is that ResourceBundle.getBundle(...) should throw exception instead of returning null... Anyway, double check things, as it should work as far as I see.

     
  • Dániel Dékány

     
  • Dániel Dékány

    Was this solved, can this be closed, or there will be more information?

     
  • Dániel Dékány

    • status: open --> closed-out-of-date
     
  • Dániel Dékány

    I'm closing this as there was no answer regarding the suspected cause of this problem. (Repopen if think it's still a FreeMarker bug.)

     

    Last edit: Dániel Dékány 2015-09-19

Log in to post a comment.