Hi Ceki

I'm sorry. I'm working to 22 pm in Japan time(14 pm in French time).
I'll update it until tomorrow morning.

On 2009/08/28, at 6:11, Ceki Gulcu <ceki@qos.ch> wrote:


Hi Takeshi,

Thank you for sharing your new ideas. I just cloned http://github.com/takeshi/cai18n/tree/master.

It looks like MessageDefinitionConveyor is referencing the class ch.qos.cai18n.sample.ColorMessageConfiguration (part of the tests). This causes the maven build to fail for me.

I'll look at the code some more tomorrow morning and come back to you with comments.

Cheers,

Takeshi Kondo wrote:
Hi Ceki
I have two type safe message definition idea.
I've committed draft code to my cai18n project clone.
(http://github.com/takeshi/cai18n/tree/master)
Please take it in cai18n project, if you like it,.
My ideas is as follows.
1. Message definition by annotation
for instance,
public enum LocalizedColors {
   @Message("green")
   GREEN {
       @Message("vert")
       Locale fr = Locale.FRANCE;
       @Message("midori")
       Locale ja = Locale.JAPAN;
   }
}
Using enum field declaration with annotation, we can define localized message. It is simple , but we can't add other locale.
2. Message definition by switch case
for instance,
public class ColorDef_fr extends MessageDefinition<Colors> {
   public Locale getLocale() {
       return Locale.FRANCE;
   }
   public String getMessage(Colors e) {
       switch (e) {
       case BLUE:
           return "blue";
       case GREEN:
           return "vert";
       case RED:
           return "rouge";
       }
       return null;
   }
}
Using method return, we can define localized message.
It is not simple, but this we can define it per locale._______________________________________________


--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
_______________________________________________
cai18n-dev mailing list
cai18n-dev@qos.ch
http://qos.ch/mailman/listinfo/cai18n-dev