Class ModelTranslations
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.service.ModelTranslations
-
- All Implemented Interfaces:
IModelTranslationService
@Service @Lazy @DependentInitialisation(StartNewGameBean.class) public class ModelTranslations extends java.lang.Object implements IModelTranslationService
Service that provides the proper translations for enumeration values and constants.- Author:
- Andi Hotz, (c) Sahits GmbH, 2014 Created on Nov 26, 2014
-
-
Constructor Summary
Constructors Constructor Description ModelTranslations()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getEndOfWeek(java.time.LocalDateTime date)
Retrieve the date of the end of the week in the form {Day of month}.private java.time.LocalDateTime
getEndOfWeekInternal(java.time.LocalDateTime date)
Retrieve the date of the of the Sunday of last week.java.lang.String
getLocalDisplayDistinctArticle(boolean male, boolean uppercase)
java.lang.String
getLocalDisplayName(IBuilding building)
Localize the name of the buildingjava.lang.String
getLocalDisplayName(ESocialRank rank)
java.lang.String
getLocalDisplayName(ICareer career)
java.lang.String
getLocalDisplayName(IWare ware)
Retrieve the localized display name forid
.java.lang.String
getLocalDisplayName(EShipType type)
java.lang.String
getLocalDisplayName(EWeapon weapon)
Retrieve the localized display name forid
.java.lang.String
getLocalDisplayNameWithArticle(EShipType type, boolean upperCaseArticle)
java.lang.String
getStartOfWeek(java.time.LocalDateTime date)
Retrieve the date of the start of the week in the form {Day of month}.private java.time.LocalDateTime
getStartOfWeekInternal(java.time.LocalDateTime date)
Retrieve the date of the start of the last weekjava.lang.String
toDisplayString(int day, int month, int year)
Retrieve the date in long form {Day of month}.java.lang.String
toDisplayString(java.time.LocalDateTime date)
Create a string representation for the user interface of the form {Day of month}.private java.lang.String
toDisplayStringLongFormat(int day, int month, int year)
java.lang.String
toDisplayStringLongFormat(java.time.LocalDateTime date)
Create a string representation for the user interface of the form {Day of month}.java.lang.String
toShortDate(java.time.LocalDateTime c)
Convert the date into the form {Day in month}.
-
-
-
Field Detail
-
locale
@Autowired private Locale locale
-
messages
@Autowired @Qualifier("messageSource") private org.springframework.context.MessageSource messages
-
-
Method Detail
-
getLocalDisplayName
public java.lang.String getLocalDisplayName(EWeapon weapon)
Retrieve the localized display name forid
.- Parameters:
weapon
- ennumeration- Returns:
- localized weapon name.
-
getLocalDisplayName
public java.lang.String getLocalDisplayName(IWare ware)
Retrieve the localized display name forid
.- Parameters:
ware
- to be localized- Returns:
- localized ware name
-
getLocalDisplayName
public java.lang.String getLocalDisplayName(ICareer career)
-
getLocalDisplayName
public java.lang.String getLocalDisplayName(ESocialRank rank)
-
getLocalDisplayName
public java.lang.String getLocalDisplayName(EShipType type)
-
getLocalDisplayNameWithArticle
public java.lang.String getLocalDisplayNameWithArticle(EShipType type, boolean upperCaseArticle)
-
getLocalDisplayDistinctArticle
public java.lang.String getLocalDisplayDistinctArticle(boolean male, boolean uppercase)
-
toShortDate
public java.lang.String toShortDate(java.time.LocalDateTime c)
Convert the date into the form {Day in month}. {Month}- Parameters:
c
- date to be localized- Returns:
- localized short date format
-
getEndOfWeekInternal
private java.time.LocalDateTime getEndOfWeekInternal(java.time.LocalDateTime date)
Retrieve the date of the of the Sunday of last week.- Parameters:
date
- for which to calculate the end of week- Returns:
- local date of the last Sunday
-
getEndOfWeek
public java.lang.String getEndOfWeek(java.time.LocalDateTime date)
Retrieve the date of the end of the week in the form {Day of month}. {Month}. The week ends with Sunday- Parameters:
date
- from which to calculate the last Sunday- Returns:
- localized short date of the last Sunday.
-
toDisplayString
public java.lang.String toDisplayString(int day, int month, int year)
Retrieve the date in long form {Day of month}. {Month} {Year}.- Parameters:
day
- of monthmonth
- of yearyear
- to be displayed- Returns:
- localized long date.
-
toDisplayStringLongFormat
private java.lang.String toDisplayStringLongFormat(int day, int month, int year)
-
toDisplayString
public java.lang.String toDisplayString(java.time.LocalDateTime date)
Create a string representation for the user interface of the form {Day of month}. {Month} {Year}.- Specified by:
toDisplayString
in interfaceIModelTranslationService
- Parameters:
date
- to be localized in the long form- Returns:
- localized long date of
date
-
toDisplayStringLongFormat
public java.lang.String toDisplayStringLongFormat(java.time.LocalDateTime date)
Create a string representation for the user interface of the form {Day of month}. {Month} {Year} with long month format.- Parameters:
date
- to be localized in the long form- Returns:
- localized long date of
date
-
getStartOfWeek
public java.lang.String getStartOfWeek(java.time.LocalDateTime date)
Retrieve the date of the start of the week in the form {Day of month}. {Month}. The week starts with Monday.- Parameters:
date
- from which to calculate the last Monday- Returns:
- localized short date of the last Monday per
date
-
getStartOfWeekInternal
private java.time.LocalDateTime getStartOfWeekInternal(java.time.LocalDateTime date)
Retrieve the date of the start of the last week- Returns:
- Date of the Monday of the previous week.
-
getLocalDisplayName
public java.lang.String getLocalDisplayName(IBuilding building)
Localize the name of the building- Parameters:
building
- to be localized- Returns:
- localized building name.
-
-