How to get i18n message_xx.properties from a service?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get i18n message_xx.properties from a service?

Pablo Pazos
Hi, I'm trying to make a search from the values on each message_xxx.properties file.

Now I'm loading directly the file into a Properties class instance:

Properties properties = new Properties();
properties.load( new FileInputStream("grails-app/i18n/messages" + lang + ".properties") );

for each lang in my app.

I need to know if I can access the bundle instances loaded in grails instead of loading them myself, and as you note, I load them every time, every search, so if grails loads them just one time and I can access them form my service, that's my solution ;)


Thanks,
Pablo.
Reply | Threaded
Open this post in threaded view
|

Re: How to get i18n message_xx.properties from a service?

Stand Trooper
I'm not entirely sure what context you're asking about... I will assume you have some sort of Controller, Bean or something that you're trying to access.

In taglibraries I access messages like this
def messageSource = grailsAttributes.getApplicationContext().getBean("messageSource")

def locale = RCU.getLocale(request)
def message = messageSource.getMessage('KEY_NAME', locale)

where KEY_NAME is the name of the key you're trying to access from the properties

By default the properties files are loaded when the server is started and not reloaded again (I do believe)

this is basically what you're talking about right?

timo

On Mon, Oct 6, 2008 at 5:11 PM, pablox <[hidden email]> wrote:

Hi, I'm trying to make a search from the values on each
message_xxx.properties file.

Now I'm loading directly the file into a Properties class instance:

Properties properties = new Properties();
properties.load( new FileInputStream("grails-app/i18n/messages" + lang +
".properties") );

for each lang in my app.

I need to know if I can access the bundle instances loaded in grails instead
of loading them myself, and as you note, I load them every time, every
search, so if grails loads them just one time and I can access them form my
service, that's my solution ;)


Thanks,
Pablo.
Reply | Threaded
Open this post in threaded view
|

Re: How to get i18n message_xx.properties from a service?

Pablo Pazos
Hi,

I need to access the message source from a service.

What I need to do is to search in all the messages for all the message sources (one for each available locale).
I the message values I search for some substring and then I get the matching keys, so the keys is what I need to find because I dont have them.

So, my question is if its possible to get all the key/value pair, for each locale, from the message source.

Now I'm doing it this way:

// I pass each available lang:
     Properties properties = new Properties();
     try {
       properties.load( new FileInputStream("grails-app/i18n/messages" + lang + ".properties") ); // load the message_xx.properties directly
     }
     catch (IOException e)
     {
       println e.message
     }
    
     def res = []
     properties.propertyNames().each() { key ->
                                        
                                         String value = properties.getProperty( key ).toLowerCase() // q viene el lower...
                                        
                                         if ( value.contains( q ))
                                         {
                                           res << key  // if q is substring of value, key is in my solution
                                         }
                                       }

The problem with this solution is that I have to load all the .properties each time and I want to get it from grails, if its possible.


Thanks,
Pablo.

On Mon, Oct 6, 2008 at 9:28 PM, Stand Trooper <[hidden email]> wrote:
I'm not entirely sure what context you're asking about... I will assume you have some sort of Controller, Bean or something that you're trying to access.

In taglibraries I access messages like this
def messageSource = grailsAttributes.getApplicationContext().getBean("messageSource")

def locale = RCU.getLocale(request)
def message = messageSource.getMessage('KEY_NAME', locale)

where KEY_NAME is the name of the key you're trying to access from the properties

By default the properties files are loaded when the server is started and not reloaded again (I do believe)

this is basically what you're talking about right?

timo

On Mon, Oct 6, 2008 at 5:11 PM, pablox <[hidden email]> wrote:

Hi, I'm trying to make a search from the values on each
message_xxx.properties file.

Now I'm loading directly the file into a Properties class instance:

Properties properties = new Properties();
properties.load( new FileInputStream("grails-app/i18n/messages" + lang +
".properties") );

for each lang in my app.

I need to know if I can access the bundle instances loaded in grails instead
of loading them myself, and as you note, I load them every time, every
search, so if grails loads them just one time and I can access them form my
service, that's my solution ;)


Thanks,
Pablo.

Reply | Threaded
Open this post in threaded view
|

Re: How to get i18n message_xx.properties from a service?

Stand Trooper
I'm going to guess that nothing I posted was any help and reposting almost the same exact message to the same thread is going to benefit you.  So, let's start there.

Where are you wanting to use the message key/values at?  Is this inside a Grails app, I assume?  Is this inside of POJOs or POGOs?  Are you trying to use them inside of Controllers, Domain Objects, TagLibraries, someplace else?

I've given you a way to load these via grails... is there a reason that getting the Grails Application Context won't work?

timo

On Tue, Oct 7, 2008 at 3:12 PM, Pablo Pazos <[hidden email]> wrote:
Hi,

I need to access the message source from a service.

What I need to do is to search in all the messages for all the message sources (one for each available locale).
I the message values I search for some substring and then I get the matching keys, so the keys is what I need to find because I dont have them.

So, my question is if its possible to get all the key/value pair, for each locale, from the message source.

Now I'm doing it this way:

// I pass each available lang:
     Properties properties = new Properties();
     try {
       properties.load( new FileInputStream("grails-app/i18n/messages" + lang + ".properties") ); // load the message_xx.properties directly
     }
     catch (IOException e)
     {
       println e.message
     }
    
     def res = []
     properties.propertyNames().each() { key ->
                                        
                                         String value = properties.getProperty( key ).toLowerCase() // q viene el lower...
                                        
                                         if ( value.contains( q ))
                                         {
                                           res << key  // if q is substring of value, key is in my solution
                                         }
                                       }

The problem with this solution is that I have to load all the .properties each time and I want to get it from grails, if its possible.


Thanks,
Pablo.


On Mon, Oct 6, 2008 at 9:28 PM, Stand Trooper <[hidden email]> wrote:
I'm not entirely sure what context you're asking about... I will assume you have some sort of Controller, Bean or something that you're trying to access.

In taglibraries I access messages like this
def messageSource = grailsAttributes.getApplicationContext().getBean("messageSource")

def locale = RCU.getLocale(request)
def message = messageSource.getMessage('KEY_NAME', locale)

where KEY_NAME is the name of the key you're trying to access from the properties

By default the properties files are loaded when the server is started and not reloaded again (I do believe)

this is basically what you're talking about right?

timo

On Mon, Oct 6, 2008 at 5:11 PM, pablox <[hidden email]> wrote:

Hi, I'm trying to make a search from the values on each
message_xxx.properties file.

Now I'm loading directly the file into a Properties class instance:

Properties properties = new Properties();
properties.load( new FileInputStream("grails-app/i18n/messages" + lang +
".properties") );

for each lang in my app.

I need to know if I can access the bundle instances loaded in grails instead
of loading them myself, and as you note, I load them every time, every
search, so if grails loads them just one time and I can access them form my
service, that's my solution ;)


Thanks,
Pablo.
Reply | Threaded
Open this post in threaded view
|

Re: How to get i18n message_xx.properties from a service?

Pablo Pazos
Hi,

again, I'm trying to use the key/value parts in a SERVICE, a grails service.

I can't use this code to access them

def message = messageSource.getMessage('KEY_NAME', locale)

where KEY_NAME is the name of the key you're trying to access from the properties

because, as I've said, I don't have the keys. I want to search in the values for a substring match, then I add the key of that value to my solution. This is exactly what my code does, I don't know if it's understandable, but as you can see, I need to load messages_xx.porperties every time I do the search.


I've given you a way to load these via grails... is there a reason that getting the Grails Application Context won't work?

You can paste some code where I can access the values form messageSource without a key?
I don't know if it's possible to do. Again, I don't have the keys I and need all the values.

Thanks again and sorry for my english.
Pablo.

On Tue, Oct 7, 2008 at 9:32 PM, Stand Trooper <[hidden email]> wrote:
I'm going to guess that nothing I posted was any help and reposting almost the same exact message to the same thread is going to benefit you.  So, let's start there.

Where are you wanting to use the message key/values at?  Is this inside a Grails app, I assume?  Is this inside of POJOs or POGOs?  Are you trying to use them inside of Controllers, Domain Objects, TagLibraries, someplace else?

I've given you a way to load these via grails... is there a reason that getting the Grails Application Context won't work?

timo

On Tue, Oct 7, 2008 at 3:12 PM, Pablo Pazos <[hidden email]> wrote:
Hi,

I need to access the message source from a service.

What I need to do is to search in all the messages for all the message sources (one for each available locale).
I the message values I search for some substring and then I get the matching keys, so the keys is what I need to find because I dont have them.

So, my question is if its possible to get all the key/value pair, for each locale, from the message source.

Now I'm doing it this way:

// I pass each available lang:
     Properties properties = new Properties();
     try {
       properties.load( new FileInputStream("grails-app/i18n/messages" + lang + ".properties") ); // load the message_xx.properties directly
     }
     catch (IOException e)
     {
       println e.message
     }
    
     def res = []
     properties.propertyNames().each() { key ->
                                        
                                         String value = properties.getProperty( key ).toLowerCase() // q viene el lower...
                                        
                                         if ( value.contains( q ))
                                         {
                                           res << key  // if q is substring of value, key is in my solution
                                         }
                                       }

The problem with this solution is that I have to load all the .properties each time and I want to get it from grails, if its possible.


Thanks,
Pablo.


On Mon, Oct 6, 2008 at 9:28 PM, Stand Trooper <[hidden email]> wrote:
I'm not entirely sure what context you're asking about... I will assume you have some sort of Controller, Bean or something that you're trying to access.

In taglibraries I access messages like this
def messageSource = grailsAttributes.getApplicationContext().getBean("messageSource")

def locale = RCU.getLocale(request)
def message = messageSource.getMessage('KEY_NAME', locale)

where KEY_NAME is the name of the key you're trying to access from the properties

By default the properties files are loaded when the server is started and not reloaded again (I do believe)

this is basically what you're talking about right?

timo

On Mon, Oct 6, 2008 at 5:11 PM, pablox <[hidden email]> wrote:

Hi, I'm trying to make a search from the values on each
message_xxx.properties file.

Now I'm loading directly the file into a Properties class instance:

Properties properties = new Properties();
properties.load( new FileInputStream("grails-app/i18n/messages" + lang +
".properties") );

for each lang in my app.

I need to know if I can access the bundle instances loaded in grails instead
of loading them myself, and as you note, I load them every time, every
search, so if grails loads them just one time and I can access them form my
service, that's my solution ;)


Thanks,
Pablo.

Reply | Threaded
Open this post in threaded view
|

Re: How to get i18n message_xx.properties from a service?

Stand Trooper
ok, now I understand.  I'm not exactly sure why you're doing it, but at least I understand it now.  That is all my bad.  I wasn't reading something somewhere.  you can still use the key value in a service.  However, in this case, the way you're doing them is probably the easiest way.  Since your keys aren't going to change during the lifecycle of your application, you can load them with your service call on a one time basis.  I've done this for you using the same logic you provided in a different manner.  Grails does not provide the lookup for the values.  I'm not sure why you would need this and that was probably what threw me off.  My apologies.

This isn't the prettiest thing I've written, but it does what you're looking for... at least in Latin character sets... this won't always work for other character sets, but from the comments in the code you posted I'm going to guess Spanish, it will work

timo

import org.springframework.web.servlet.support.RequestContextUtils as RCU

class IndexController {
    def tempService
    def index = {
        def locale = RCU.getLocale(request)
        def g = tempService.serviceMethod("Previous", locale)

        g.each {
            println it
        }
    }
}

class TempService {
    static def propsMap = [:]

    boolean transactional = false

    def serviceMethod(String val, Locale locale) {
        if (propsMap.isEmpty()) {
            loadProps()
        }

        def res = []
        def langVal = determineLangVal(locale)
        if (langVal == "") {
            langVal = "en"
        }

        def properties = propsMap[langVal]
        properties.propertyNames().each() {key ->
            String value = properties.getProperty(key).toLowerCase() // q viene el lower...

            if (value.contains(val.toLowerCase())) {
                res << key  // if q is substring of value, key is in my solution
            }
        }

        return res
    }

    def loadProps = {
        List locales = []
        new File('./grails-app/i18n').eachFile {
            def arr = it.name.split("[_.]")

            locales << (arr.length > 3 ? new Locale(arr[1], arr[2]) : arr.length > 2 ? new Locale(arr[1]) : new Locale(""))
        }
        locales.each {
            def properties = new Properties();
            try {
                def langVal = determineLangVal(it)
                def fileName = "grails-app/i18n/messages${langVal}.properties"
                println fileName

                properties.load(new FileInputStream(fileName)); // load the message_xx.properties directly
                if (langVal == "") {
                    langVal = "en"
                }
                propsMap.put(langVal, properties)
            } catch (IOException e) {
                println e.message
                properties = null
            }
        }
    }

    def determineLangVal = {
        def langVal

        if (it) {
            if (it.language == "en") {
                langVal = ""
            } else if (it.language == "pt") {
                langVal = "_pt_BR"
            } else if (it.language == 'zh') {
                langVal = '_zh_CN'
            } else if (it.language == "") {
                langVal = ""
            } else {
                langVal = "_${it.language}"
            }
        } else {
            langVal = ""
        }

        return langVal
    }
}





On Tue, Oct 7, 2008 at 8:25 PM, Pablo Pazos <[hidden email]> wrote:
Hi,

again, I'm trying to use the key/value parts in a SERVICE, a grails service.

I can't use this code to access them


def message = messageSource.getMessage('KEY_NAME', locale)

where KEY_NAME is the name of the key you're trying to access from the properties

because, as I've said, I don't have the keys. I want to search in the values for a substring match, then I add the key of that value to my solution. This is exactly what my code does, I don't know if it's understandable, but as you can see, I need to load messages_xx.porperties every time I do the search.


I've given you a way to load these via grails... is there a reason that getting the Grails Application Context won't work?

You can paste some code where I can access the values form messageSource without a key?
I don't know if it's possible to do. Again, I don't have the keys I and need all the values.

Thanks again and sorry for my english.
Pablo.


On Tue, Oct 7, 2008 at 9:32 PM, Stand Trooper <[hidden email]> wrote:
I'm going to guess that nothing I posted was any help and reposting almost the same exact message to the same thread is going to benefit you.  So, let's start there.

Where are you wanting to use the message key/values at?  Is this inside a Grails app, I assume?  Is this inside of POJOs or POGOs?  Are you trying to use them inside of Controllers, Domain Objects, TagLibraries, someplace else?

I've given you a way to load these via grails... is there a reason that getting the Grails Application Context won't work?

timo

On Tue, Oct 7, 2008 at 3:12 PM, Pablo Pazos <[hidden email]> wrote:
Hi,

I need to access the message source from a service.

What I need to do is to search in all the messages for all the message sources (one for each available locale).
I the message values I search for some substring and then I get the matching keys, so the keys is what I need to find because I dont have them.

So, my question is if its possible to get all the key/value pair, for each locale, from the message source.

Now I'm doing it this way:

// I pass each available lang:
     Properties properties = new Properties();
     try {
       properties.load( new FileInputStream("grails-app/i18n/messages" + lang + ".properties") ); // load the message_xx.properties directly
     }
     catch (IOException e)
     {
       println e.message
     }
    
     def res = []
     properties.propertyNames().each() { key ->
                                        
                                         String value = properties.getProperty( key ).toLowerCase() // q viene el lower...
                                        
                                         if ( value.contains( q ))
                                         {
                                           res << key  // if q is substring of value, key is in my solution
                                         }
                                       }

The problem with this solution is that I have to load all the .properties each time and I want to get it from grails, if its possible.


Thanks,
Pablo.


On Mon, Oct 6, 2008 at 9:28 PM, Stand Trooper <[hidden email]> wrote:
I'm not entirely sure what context you're asking about... I will assume you have some sort of Controller, Bean or something that you're trying to access.

In taglibraries I access messages like this
def messageSource = grailsAttributes.getApplicationContext().getBean("messageSource")

def locale = RCU.getLocale(request)
def message = messageSource.getMessage('KEY_NAME', locale)

where KEY_NAME is the name of the key you're trying to access from the properties

By default the properties files are loaded when the server is started and not reloaded again (I do believe)

this is basically what you're talking about right?

timo

On Mon, Oct 6, 2008 at 5:11 PM, pablox <[hidden email]> wrote:

Hi, I'm trying to make a search from the values on each
message_xxx.properties file.

Now I'm loading directly the file into a Properties class instance:

Properties properties = new Properties();
properties.load( new FileInputStream("grails-app/i18n/messages" + lang +
".properties") );

for each lang in my app.

I need to know if I can access the bundle instances loaded in grails instead
of loading them myself, and as you note, I load them every time, every
search, so if grails loads them just one time and I can access them form my
service, that's my solution ;)


Thanks,
Pablo.
Reply | Threaded
Open this post in threaded view
|

Re: How to get i18n message_xx.properties from a service?

Stephen Cresswell
In reply to this post by Pablo Pazos
Make your service implement MessageSourceAware. Spring will inject the
message source for you

2008/10/6 pablox <[hidden email]>:

>
> Hi, I'm trying to make a search from the values on each
> message_xxx.properties file.
>
> Now I'm loading directly the file into a Properties class instance:
>
> Properties properties = new Properties();
> properties.load( new FileInputStream("grails-app/i18n/messages" + lang +
> ".properties") );
>
> for each lang in my app.
>
> I need to know if I can access the bundle instances loaded in grails instead
> of loading them myself, and as you note, I load them every time, every
> search, so if grails loads them just one time and I can access them form my
> service, that's my solution ;)
>
>
> Thanks,
> Pablo.
> --
> View this message in context: http://www.nabble.com/How-to-get-i18n-message_xx.properties-from-a-service--tp19847411p19847411.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: How to get i18n message_xx.properties from a service?

Pablo Pazos
In reply to this post by Stand Trooper
Hi, that's a good approach, I'll play around with it a little.

To clarify, I need to do a text search by some fields that are i18n. What the user see on the web is the translated term, but the value in the class field has a i18n key, so I need to search on the values defined in messages_locale.properties, for the actual locale, and get a matching key to match the field. I don't know if it's more clear this way, here is some code:

// List of keys from messages_locale.properties where the values match the query.
List stateKeys = propertiesService.getMessageKeys( session.locale, query )

// Search by state field, state is a string field on Log class, values of state are i18n keys.
def res = Log.withCriteria {
                 ...
                 stateKeys.each() { key ->
                    eq('state', key)
                 }
              }

So, res has all the logs that the i18n term form state matches an user query.


Another problem I have is, when the app is deployed in production, the messages_xxx.properties could be located in other context than the webapp, so if I try to load the messages files from /grails-app/i18n it may fail. Any sugestions?


Thanks again!
Pablo.


On Wed, Oct 8, 2008 at 1:33 AM, Stand Trooper <[hidden email]> wrote:
ok, now I understand.  I'm not exactly sure why you're doing it, but at least I understand it now.  That is all my bad.  I wasn't reading something somewhere.  you can still use the key value in a service.  However, in this case, the way you're doing them is probably the easiest way.  Since your keys aren't going to change during the lifecycle of your application, you can load them with your service call on a one time basis.  I've done this for you using the same logic you provided in a different manner.  Grails does not provide the lookup for the values.  I'm not sure why you would need this and that was probably what threw me off.  My apologies.

This isn't the prettiest thing I've written, but it does what you're looking for... at least in Latin character sets... this won't always work for other character sets, but from the comments in the code you posted I'm going to guess Spanish, it will work

timo

import org.springframework.web.servlet.support.RequestContextUtils as RCU

class IndexController {
    def tempService
    def index = {
        def locale = RCU.getLocale(request)
        def g = tempService.serviceMethod("Previous", locale)

        g.each {
            println it
        }
    }
}

class TempService {
    static def propsMap = [:]

    boolean transactional = false

    def serviceMethod(String val, Locale locale) {
        if (propsMap.isEmpty()) {
            loadProps()
        }

        def res = []
        def langVal = determineLangVal(locale)
        if (langVal == "") {
            langVal = "en"
        }

        def properties = propsMap[langVal]
        properties.propertyNames().each() {key ->
            String value = properties.getProperty(key).toLowerCase() // q viene el lower...

            if (value.contains(val.toLowerCase())) {
                res << key  // if q is substring of value, key is in my solution
            }
        }

        return res
    }

    def loadProps = {
        List locales = []
        new File('./grails-app/i18n').eachFile {
            def arr = it.name.split("[_.]")

            locales << (arr.length > 3 ? new Locale(arr[1], arr[2]) : arr.length > 2 ? new Locale(arr[1]) : new Locale(""))
        }
        locales.each {
            def properties = new Properties();
            try {
                def langVal = determineLangVal(it)
                def fileName = "grails-app/i18n/messages${langVal}.properties"
                println fileName

                properties.load(new FileInputStream(fileName)); // load the message_xx.properties directly
                if (langVal == "") {
                    langVal = "en"
                }
                propsMap.put(langVal, properties)
            } catch (IOException e) {
                println e.message
                properties = null
            }
        }
    }

    def determineLangVal = {
        def langVal

        if (it) {
            if (it.language == "en") {
                langVal = ""
            } else if (it.language == "pt") {
                langVal = "_pt_BR"
            } else if (it.language == 'zh') {
                langVal = '_zh_CN'
            } else if (it.language == "") {
                langVal = ""
            } else {
                langVal = "_${it.language}"
            }
        } else {
            langVal = ""
        }

        return langVal
    }
}





On Tue, Oct 7, 2008 at 8:25 PM, Pablo Pazos <[hidden email]> wrote:
Hi,

again, I'm trying to use the key/value parts in a SERVICE, a grails service.

I can't use this code to access them


def message = messageSource.getMessage('KEY_NAME', locale)

where KEY_NAME is the name of the key you're trying to access from the properties

because, as I've said, I don't have the keys. I want to search in the values for a substring match, then I add the key of that value to my solution. This is exactly what my code does, I don't know if it's understandable, but as you can see, I need to load messages_xx.porperties every time I do the search.


I've given you a way to load these via grails... is there a reason that getting the Grails Application Context won't work?

You can paste some code where I can access the values form messageSource without a key?
I don't know if it's possible to do. Again, I don't have the keys I and need all the values.

Thanks again and sorry for my english.
Pablo.


On Tue, Oct 7, 2008 at 9:32 PM, Stand Trooper <[hidden email]> wrote:
I'm going to guess that nothing I posted was any help and reposting almost the same exact message to the same thread is going to benefit you.  So, let's start there.

Where are you wanting to use the message key/values at?  Is this inside a Grails app, I assume?  Is this inside of POJOs or POGOs?  Are you trying to use them inside of Controllers, Domain Objects, TagLibraries, someplace else?

I've given you a way to load these via grails... is there a reason that getting the Grails Application Context won't work?

timo

On Tue, Oct 7, 2008 at 3:12 PM, Pablo Pazos <[hidden email]> wrote:
Hi,

I need to access the message source from a service.

What I need to do is to search in all the messages for all the message sources (one for each available locale).
I the message values I search for some substring and then I get the matching keys, so the keys is what I need to find because I dont have them.

So, my question is if its possible to get all the key/value pair, for each locale, from the message source.

Now I'm doing it this way:

// I pass each available lang:
     Properties properties = new Properties();
     try {
       properties.load( new FileInputStream("grails-app/i18n/messages" + lang + ".properties") ); // load the message_xx.properties directly
     }
     catch (IOException e)
     {
       println e.message
     }
    
     def res = []
     properties.propertyNames().each() { key ->
                                        
                                         String value = properties.getProperty( key ).toLowerCase() // q viene el lower...
                                        
                                         if ( value.contains( q ))
                                         {
                                           res << key  // if q is substring of value, key is in my solution
                                         }
                                       }

The problem with this solution is that I have to load all the .properties each time and I want to get it from grails, if its possible.


Thanks,
Pablo.


On Mon, Oct 6, 2008 at 9:28 PM, Stand Trooper <[hidden email]> wrote:
I'm not entirely sure what context you're asking about... I will assume you have some sort of Controller, Bean or something that you're trying to access.

In taglibraries I access messages like this
def messageSource = grailsAttributes.getApplicationContext().getBean("messageSource")

def locale = RCU.getLocale(request)
def message = messageSource.getMessage('KEY_NAME', locale)

where KEY_NAME is the name of the key you're trying to access from the properties

By default the properties files are loaded when the server is started and not reloaded again (I do believe)

this is basically what you're talking about right?

timo

On Mon, Oct 6, 2008 at 5:11 PM, pablox <[hidden email]> wrote:

Hi, I'm trying to make a search from the values on each
message_xxx.properties file.

Now I'm loading directly the file into a Properties class instance:

Properties properties = new Properties();
properties.load( new FileInputStream("grails-app/i18n/messages" + lang +
".properties") );

for each lang in my app.

I need to know if I can access the bundle instances loaded in grails instead
of loading them myself, and as you note, I load them every time, every
search, so if grails loads them just one time and I can access them form my
service, that's my solution ;)


Thanks,
Pablo.