File tree Expand file tree Collapse file tree 3 files changed +87
-2
lines changed
src/main/java/org/codehaus/plexus/i18n Expand file tree Collapse file tree 3 files changed +87
-2
lines changed Original file line number Diff line number Diff line change 77 <modelVersion >4.0.0</modelVersion >
88 <artifactId >plexus-i18n</artifactId >
99 <name >Plexus I18N Component</name >
10- <version >1.0-beta-8-SNAPSHOT</version >
10+ <version >1.0-beta-9-SNAPSHOT</version >
11+ <build >
12+ <plugins >
13+ <plugin >
14+ <groupId >org.codehaus.plexus</groupId >
15+ <artifactId >plexus-maven-plugin</artifactId >
16+ <version >1.3.5</version >
17+ <executions >
18+ <execution >
19+ <goals >
20+ <goal >descriptor</goal >
21+ </goals >
22+ </execution >
23+ </executions >
24+ </plugin >
25+ <plugin >
26+ <artifactId >maven-compiler-plugin</artifactId >
27+ <configuration >
28+ <source >1.5</source >
29+ <target >1.5</target >
30+ </configuration >
31+ </plugin >
32+ </plugins >
33+ </build >
1134 <dependencies >
1235 <dependency >
1336 <groupId >org.codehaus.plexus</groupId >
1437 <artifactId >plexus-utils</artifactId >
15- <version >1.4.1 </version >
38+ <version >1.4.5 </version >
1639 </dependency >
1740 </dependencies >
1841</project >
Original file line number Diff line number Diff line change 1+ package org .codehaus .plexus .i18n ;
2+
3+ import java .util .Locale ;
4+ import java .util .ResourceBundle ;
5+
6+ public class Language
7+ {
8+ public static String DEFAULT_NAME = "Messages" ;
9+
10+ private Class clazz ;
11+ ResourceBundle rb ;
12+
13+ public Language ()
14+ {
15+ }
16+
17+ public Language ( Class clazz )
18+ {
19+ this ( clazz , Locale .getDefault () );
20+ }
21+
22+ public Language ( Class clazz , Locale locale )
23+ {
24+ this .clazz = clazz ;
25+ rb = ResourceBundle .getBundle ( clazz .getPackage ().getName ()+"." +DEFAULT_NAME , locale , clazz .getClassLoader () );
26+ }
27+
28+ public String getMessage ( String key )
29+ throws LanguageException
30+ {
31+ if ( rb == null )
32+ throw new LanguageException ("resourceBundle not initialized for " +(clazz ==null ?"null" :clazz .getName () ) );
33+
34+ return rb .getString (key );
35+ }
36+
37+ }
Original file line number Diff line number Diff line change 1+ package org .codehaus .plexus .i18n ;
2+
3+ public class LanguageException extends Exception
4+ {
5+
6+ public LanguageException ()
7+ {
8+ }
9+
10+ public LanguageException (String message )
11+ {
12+ super (message );
13+ }
14+
15+ public LanguageException (Throwable cause )
16+ {
17+ super (cause );
18+ }
19+
20+ public LanguageException (String message , Throwable cause )
21+ {
22+ super (message , cause );
23+ }
24+
25+ }
You can’t perform that action at this time.
0 commit comments