=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java 2014-04-25 13:14:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java 2014-04-27 07:19:41 +0000 @@ -36,6 +36,56 @@ */ public abstract class AbstractCalendar implements Calendar { + protected static final String[] DEFAULT_I18N_MONTH_NAMES = new String[]{ + "month.january", + "month.february", + "month.march", + "month.april", + "month.may", + "month.june", + "month.july", + "month.august", + "month.september", + "month.october", + "month.november", + "month.december" + }; + + protected static final String[] DEFAULT_I18N_MONTH_SHORT_NAMES = new String[]{ + "month.short.january", + "month.short.february", + "month.short.march", + "month.short.april", + "month.short.may", + "month.short.june", + "month.short.july", + "month.short.august", + "month.short.september", + "month.short.october", + "month.short.november", + "month.short.december" + }; + + protected static final String[] DEFAULT_I18N_DAY_NAMES = new String[]{ + "weekday.monday", + "weekday.tuesday", + "weekday.wednesday", + "weekday.thursday", + "weekday.friday", + "weekday.saturday", + "weekday.sunday" + }; + + protected static final String[] DEFAULT_I18N_DAY_SHORT_NAMES = new String[]{ + "weekday.short.monday", + "weekday.short.tuesday", + "weekday.short.wednesday", + "weekday.short.thursday", + "weekday.short.friday", + "weekday.short.saturday", + "weekday.short.sunday" + }; + @Override public DateUnit toIso( int year, int month, int day ) { @@ -66,4 +116,48 @@ { return 7; } + + @Override + public String nameOfMonth( int month ) + { + if ( month > DEFAULT_I18N_MONTH_NAMES.length || month <= 0 ) + { + return null; + } + + return DEFAULT_I18N_MONTH_NAMES[month - 1]; + } + + @Override + public String shortNameOfMonth( int month ) + { + if ( month > DEFAULT_I18N_MONTH_SHORT_NAMES.length || month <= 0 ) + { + return null; + } + + return DEFAULT_I18N_MONTH_SHORT_NAMES[month - 1]; + } + + @Override + public String nameOfDay( int day ) + { + if ( day > DEFAULT_I18N_DAY_NAMES.length || day <= 0 ) + { + return null; + } + + return DEFAULT_I18N_DAY_NAMES[day - 1]; + } + + @Override + public String shortNameOfDay( int day ) + { + if ( day > DEFAULT_I18N_DAY_SHORT_NAMES.length || day <= 0 ) + { + return null; + } + + return DEFAULT_I18N_DAY_SHORT_NAMES[day - 1]; + } } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java 2014-04-27 02:45:02 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java 2014-04-27 07:19:41 +0000 @@ -152,4 +152,36 @@ * @see http://en.wikipedia.org/wiki/ISO_week_date */ int weekday( DateUnit dateUnit ); + + /** + * Gets the (untranslated) I18n key for local month + * @param month Month to fetch key for + * @return I18n Key for this month + * @see http://en.wikipedia.org/wiki/Internationalization_and_localization + */ + String nameOfMonth( int month ); + + /** + * Gets the (untranslated) I18n short key for local month + * @param month Month to fetch key for + * @return I18n Key for this month + * @see http://en.wikipedia.org/wiki/Internationalization_and_localization + */ + String shortNameOfMonth( int month ); + + /** + * Gets the (untranslated) I18n key for local day + * @param day Day to fetch key for + * @return I18n Key for this day + * @see http://en.wikipedia.org/wiki/Internationalization_and_localization + */ + String nameOfDay( int day ); + + /** + * Gets the (untranslated) I18n short key for local day + * @param day Day to fetch key for + * @return I18n Key for this day + * @see http://en.wikipedia.org/wiki/Internationalization_and_localization + */ + String shortNameOfDay( int day ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/NepaliCalendar.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/NepaliCalendar.java 2014-04-27 02:45:02 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/NepaliCalendar.java 2014-04-27 07:19:41 +0000 @@ -226,6 +226,50 @@ return "nepali"; } + @Override + public String nameOfMonth( int month ) + { + if ( month > DEFAULT_I18N_MONTH_NAMES.length || month <= 0 ) + { + return null; + } + + return "nepali." + DEFAULT_I18N_MONTH_NAMES[month - 1]; + } + + @Override + public String shortNameOfMonth( int month ) + { + if ( month > DEFAULT_I18N_MONTH_SHORT_NAMES.length || month <= 0 ) + { + return null; + } + + return "nepali." + DEFAULT_I18N_MONTH_SHORT_NAMES[month - 1]; + } + + @Override + public String nameOfDay( int day ) + { + if ( day > DEFAULT_I18N_DAY_NAMES.length || day <= 0 ) + { + return null; + } + + return "nepali." + DEFAULT_I18N_DAY_NAMES[day - 1]; + } + + @Override + public String shortNameOfDay( int day ) + { + if ( day > DEFAULT_I18N_DAY_SHORT_NAMES.length || day <= 0 ) + { + return null; + } + + return "nepali." + DEFAULT_I18N_DAY_SHORT_NAMES[day - 1]; + } + private int getYearTotal( int year ) { // if year total index is uninitialized, calculate and set in array === modified file 'dhis-2/dhis-services/dhis-service-i18n/src/main/resources/i18n_global.properties' --- dhis-2/dhis-services/dhis-service-i18n/src/main/resources/i18n_global.properties 2014-04-26 09:34:05 +0000 +++ dhis-2/dhis-services/dhis-service-i18n/src/main/resources/i18n_global.properties 2014-04-27 07:19:41 +0000 @@ -279,6 +279,49 @@ weekday.short.saturday=Sat weekday.short.sunday=Sun +#-- Nepali Calendar Month/Day names -------------------------------------------# +nepali.month.january=Chaitra +nepali.month.february=Baishakh +nepali.month.march=Jetha +nepali.month.april=Asar +nepali.month.may=Saaun +nepali.month.june=Bhadau +nepali.month.july=Asoj +nepali.month.august=Kartik +nepali.month.september=Mangsir +nepali.month.october=Paush +nepali.month.november=Magh +nepali.month.december=Phalgun + +nepali.month.short.january=Chaitra +nepali.month.short.february=Baishakh +nepali.month.short.march=Jetha +nepali.month.short.april=Asar +nepali.month.short.may=Saaun +nepali.month.short.june=Bhadau +nepali.month.short.july=Asoj +nepali.month.short.august=Kartik +nepali.month.short.september=Mangsir +nepali.month.short.october=Paush +nepali.month.short.november=Magh +nepali.month.short.december=Phalgun + +nepali.weekday.monday=Monday +nepali.weekday.tuesday=Tuesday +nepali.weekday.wednesday=Wednesday +nepali.weekday.thursday=Thursday +nepali.weekday.friday=Friday +nepali.weekday.saturday=Saturday +nepali.weekday.sunday=Sunday + +nepali.weekday.short.monday=Mon +nepali.weekday.short.tuesday=Tue +nepali.weekday.short.wednesday=Wed +nepali.weekday.short.thursday=Thu +nepali.weekday.short.friday=Fri +nepali.weekday.short.saturday=Sat +nepali.weekday.short.sunday=Sun + #-- The translation page ------------------------------------------------------# translation_translate=Translate