Changeset 446 for tapas/common


Ignore:
Timestamp:
04/02/12 17:01:12 (12 years ago)
Author:
vmipsl
Message:

getMessage récup du texte ds messages.properties

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tapas/common/implementation/com/ether/EtherHelper.java

    r423 r446  
    1717import java.util.ArrayList; 
    1818import java.util.List; 
     19import java.util.Locale; 
    1920import java.util.Random; 
     21import java.util.ResourceBundle; 
    2022 
    2123/** 
     
    226228        } 
    227229    } 
     230 
     231    /** 
     232     * This method return the text corresponding to the code in the files messages**.properties 
     233     * 
     234     * @param code 
     235     * @param locale 
     236     * @return 
     237     */ 
     238    public static String getMessage( @NotNull final String code, @Nullable final Locale locale ) 
     239    { 
     240        ResourceBundle bundle = ResourceBundle.getBundle( "messages", Locale.ENGLISH ); 
     241        if( null != locale ) 
     242            bundle = ResourceBundle.getBundle( "messages", locale ); 
     243 
     244        return bundle.getString( code ); 
     245    } 
     246 
    228247} 
Note: See TracChangeset for help on using the changeset viewer.