deltaspike-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerhard Petracek (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DELTASPIKE-222) Add possibility to set base path
Date Sat, 07 Jul 2012 20:29:34 GMT

    [ https://issues.apache.org/jira/browse/DELTASPIKE-222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13408766#comment-13408766
] 

Gerhard Petracek commented on DELTASPIKE-222:
---------------------------------------------

i pushed a prototype for a type-safe message-source.

advantages:
 allows the type-safe usage with @MessageContextConfig and the fluent MessageContext api (and
to implement fine-grained message-interfaces which use the same message-source).

disadvantage:
 a bit more to do - but only once (and for easy prototyping we have the convention already)
-> shouldn't be a big issue

e.g.:

@MessageBundle
@MessageContextConfig(messageSource = AppResourceBundle.class)
public interface Messages
{
    String msgX(String name);
}
 
@MessageBundle
@MessageContextConfig(messageSource = {UiResourceBundle.class, AppResourceBundle.class})
public interface Labels
{
    String labelX();
}

//...
public class AppResourceBundle implements MessageSource
{
    @Override
    public String getKey()
    {
        return "company/app_messages.properties";
    }
}

//...
public class UiResourceBundle implements MessageSource
{
    @Override
    public String getKey()
    {
        return "app/ui/labels.properties";
    }
}

and you can also use it with the fluent-api easily (and in a type-safe way) - e.g.:


String messageText = this.messageContext.messageSource(AppResourceBundle.class)
                .message().template("{msgX}").toString();
                
> Add possibility to set base path
> --------------------------------
>
>                 Key: DELTASPIKE-222
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-222
>             Project: DeltaSpike
>          Issue Type: New Feature
>          Components: I18n-Module
>    Affects Versions: 0.2-incubating
>            Reporter: Thomas Herzog
>             Fix For: 0.3-incubating
>
>
> Add the possibility to set the base path, means the path to the properties file.
> Now they are assumed to be at same level as the @MessageResource annotated interface
is, in fact within the same package.
> Maybe someone wants to put his resource bundles at /META-INF/resources/*.properties.
> With cal10n it was possible to set the Base with @Base("/META-INF/resources")

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message