Hello Everyone,
It looks like I could paraphrase my question in following way:
Where exactly am I supposed to put .properties files so I could access them
from my class files in Magnolia Module?
I tried following approach to access local .properties file:
public static URL getResource(String fileName, Class className) {
URL url =
Thread.currentThread().getContextClassLoader().getResource(fileName);
if (url == null) {
url = Helper.class.getClassLoader().getResource(fileName);
}
if (url == null) {
ClassLoader cl = className.getClassLoader();
if (cl != null) {
url = cl.getResource(fileName);
}
}
if ((url == null) && (fileName != null) && ((fileName.length() == 0)
|| (fileName.charAt(0) != '/'))) {
return getResource('/' + fileName, className);
}
return url;
}
it seems it doesn't find my local .properties even if I put them in my
module folder.
I.e.
module:
/META-INF
/magnolia
abc-template.xml
/mgnl-bootstrap
/mgnl-files
/mgnl-resources
/com.abc
MyClass.class
messages.properties
I'd really appreciate any help on this issue. Thank you in advance!
Regards,
Denis
On Tue, Oct 6, 2009 at 1:12 PM, Denis Demichev <[email protected]> wrote:
> Hello All!
>
> I'd like to ask one more question on Magnolia.
> Recently I was trying to create a custom JSP template with the support of
> several languages.
> I18N how-to on Magnolia's content is pretty good and clear, but
> unfortunately I didn't find any best practices or how-tos on JSP template
> I18n.
>
> There's a support of ${I18N[""]} syntax in ftl, however I'm trying to build
> JSP as its much faster in my case.
> I was trying JSTL tags to implement language dependent messages inside
> JSPs:
> <%@ page pageEncoding="UTF-8" %>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
> <html>
> <fmt:bundle basename="app">
> <head>
> <title><fmt:message key="newTitle"/></title>
> </head>
>
> I put app.properties into module.jar file (both in root module and in
> com/abc/ folders) together with my custom template jsp.
> When I'm trying to access JSP I have ???newTitle??? message instead of
> localized one - that's usually happens when tomcat cannot find .properties
> file.
> Another I18N approach I saw was MessageManager class but that's not really
> I want because I don't want to mess Magnolia's bundles with mine.
>
> So my question is: where am I supposed to put localized .properties files
> in my module in case I need to access them in custom jsp template?
>
> Regards,
> Denis
>
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------