KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > util > DateStrings


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.util;
11
12 import java.text.DateFormatSymbols JavaDoc;
13 import java.util.Locale JavaDoc;
14
15 /**
16  * The DateString class provides constant text strings for the weekday, month etc.
17  *
18  * @deprecated FIX dutch days
19  * @version $Id: DateStrings.java,v 1.10 2005/08/31 11:46:55 nklasens Exp $
20  */

21 public class DateStrings {
22
23     /**
24      * Dutch short week day names
25      */

26     public static final String JavaDoc Dutch_days[]={"", "zon","maa","din","woe","don","vry","zat","zon" };
27
28     public static final DateStrings DUTCH_DATESTRINGS = new DateStrings("nl");
29     public static final DateStrings ENGLISH_DATESTRINGS = new DateStrings("en");
30
31     /**
32      * Short week day names (value deoends on chosen language)
33      */

34     private String JavaDoc day[];
35     /**
36      * Long week day names (value deoends on chosen language)
37      */

38     private String JavaDoc longday[];
39     /**
40      * Long short month names (value deoends on chosen language)
41      */

42     private String JavaDoc month[];
43     /**
44      * Long month names (value deoends on chosen language)
45      */

46     private String JavaDoc longmonth[];
47
48     /**
49      * Creates a DateString insatnce, configured for the specified language.
50      * The name of the language has to be an ISO 639 code.
51      */

52     public DateStrings(String JavaDoc language) {
53         Locale JavaDoc aLocale = new Locale JavaDoc(language);
54         DateFormatSymbols JavaDoc symbols = new DateFormatSymbols JavaDoc(aLocale);
55         
56         day = symbols.getShortWeekdays();
57         longday = symbols.getWeekdays();
58         month = symbols.getShortMonths();
59         longmonth = symbols.getMonths();
60         
61         if (language.equals("nl")) {
62             day=Dutch_days;
63         }
64     }
65
66     public String JavaDoc getMonth(int monthInt) {
67         return longmonth[monthInt];
68     }
69
70     public String JavaDoc getShortMonth(int monthInt) {
71         return month[monthInt];
72     }
73
74     public String JavaDoc getDay(int weekDayInt) {
75         return longday[weekDayInt + 1];
76     }
77
78     public String JavaDoc getShortDay(int weekDayInt) {
79         return day[weekDayInt + 1];
80     }
81     
82 }
Popular Tags