Skip to content

Commit

Permalink
Use methods to receive holiday and country description from Resource …
Browse files Browse the repository at this point in the history
…Util
  • Loading branch information
derTobsch committed Jan 3, 2025
1 parent b4fe326 commit aee7bf8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package de.focus_shift.jollyday.core;

import de.focus_shift.jollyday.core.util.ResourceUtil;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import static de.focus_shift.jollyday.core.util.ResourceUtil.UNDEFINED;
import static de.focus_shift.jollyday.core.util.ResourceUtil.getCountryDescription;

/**
* Bean class for describing the configuration hierarchy.
*/
Expand Down Expand Up @@ -45,18 +46,18 @@ public String getId() {
* @return the description
*/
public String getDescription() {
return getDescription(Locale.getDefault());
return getCountryDescription(getPropertiesKey());
}

/**
* Returns the hierarchies description text from the resource bundle.
*
* @param l Locale to return the description text for.
* @param locale Locale to return the description text for.
* @return Description text
*/
public String getDescription(Locale l) {
String descr = ResourceUtil.getCountryDescription(l, getPropertiesKey());
if (ResourceUtil.UNDEFINED.equals(descr) && fallbackDescription != null) {
public String getDescription(Locale locale) {
String descr = getCountryDescription(locale, getPropertiesKey());
if (UNDEFINED.equals(descr) && fallbackDescription != null) {
descr = fallbackDescription;
}
return descr;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package de.focus_shift.jollyday.core;

import de.focus_shift.jollyday.core.util.ResourceUtil;

import java.time.LocalDate;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;

import static de.focus_shift.jollyday.core.util.ResourceUtil.getHolidayDescription;

/**
* Represents the holiday and contains the actual date and an localized
* description.
Expand Down Expand Up @@ -118,7 +118,7 @@ public String getPropertiesKey() {
* @return Description for this holiday
*/
public String getDescription() {
return ResourceUtil.getHolidayDescription(Locale.getDefault(), getPropertiesKey());
return getHolidayDescription(getPropertiesKey());
}

/**
Expand All @@ -128,7 +128,7 @@ public String getDescription() {
* @return Description for this holiday
*/
public String getDescription(Locale locale) {
return ResourceUtil.getHolidayDescription(locale, getPropertiesKey());
return getHolidayDescription(locale, getPropertiesKey());
}

@Override
Expand Down

0 comments on commit aee7bf8

Please sign in to comment.