001/*- 002 * #%L 003 * Smile CDR - CDR 004 * %% 005 * Copyright (C) 2016 - 2024 Smile CDR, Inc. 006 * %% 007 * All rights reserved. 008 * #L% 009 */ 010package ca.cdr.api.i18n; 011 012import ca.cdr.api.annotations.CdrPublicAPI; 013import jakarta.annotation.Nonnull; 014 015import java.util.Date; 016 017/** 018 * This interface permits you to fetch messages out of the cdr-messages.properties file for localization 019 */ 020@CdrPublicAPI 021public interface ILocalizer { 022 023 String formatDateDaysElapsed(Date theDate); 024 025 @Nonnull 026 String formatDateTime(Date theDate); 027 028 @Nonnull 029 String formatTime(Date theDate); 030 031 @SuppressWarnings("unused") 032 /** 033 * Used in Thymeleaf templates - Returns an empty string if the parameter is null 034 */ 035 @Nonnull 036 String formatDate(Date theDate); 037 038 @SuppressWarnings("unused") 039 /** 040 * Used in Thymeleaf templates - Returns an empty string if the parameter is null 041 */ 042 @Nonnull 043 String formatDateTimeMillis(Date theDate); 044 045 String getMessage(Class<?> theType, String theKey, Object... theParameters); 046 047 @SuppressWarnings("null") 048 @Nonnull 049 String getMessage(String theQualifiedKey, Object... theParameters); 050 051 String getMessageAndEvaluateAsMarkdown(String theQualifiedKey, Object... theParameters); 052 053 boolean hasKey(String theKey); 054 055 default Date convertServerTimeToUserTime(Date theDate) { 056 return theDate; 057 } 058}