All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tairitsu.ignotus.translation.TranslatorMessageSource.kt Maven / Gradle / Ivy

There is a newer version: 1.0.32
Show newest version
//package com.tairitsu.ignotus.translation.service
//
//import org.slf4j.Logger
//import org.slf4j.LoggerFactory
//import org.springframework.context.HierarchicalMessageSource
//import org.springframework.context.MessageSource
//import org.springframework.context.MessageSourceResolvable
//import org.springframework.context.support.MessageSourceSupport
//import org.springframework.stereotype.Component
//import java.util.*
//
//@Component
//class TranslatorMessageSource(private val messageSource: MessageSource)  : MessageSourceSupport(), HierarchicalMessageSource {
//    private val log: Logger = LoggerFactory.getLogger(this::class.java)
//
//    private var parentMessageSource: MessageSource? = null
//
//    init {
//        if (messageSource is HierarchicalMessageSource) {
//            parentMessageSource = messageSource.parentMessageSource
//            messageSource.parentMessageSource = this
//        } else {
//            log.warn("Can not set Ignotus Message Source to DelegatingMessageSource")
//        }
//    }
//
//    override fun setParentMessageSource(parent: MessageSource?) {
//        this.parentMessageSource = parent
//    }
//
//    override fun getParentMessageSource(): MessageSource? {
//        return this.parentMessageSource
//    }
//
//    override fun getMessage(code: String, args: Array?, defaultMessage: String?, locale: Locale): String? {
//        return parentMessageSource?.getMessage(code, args, defaultMessage, locale)
//    }
//
//    override fun getMessage(code: String, args: Array?, locale: Locale): String {
//        return parentMessageSource?.getMessage(code, args, locale) ?: ""
//    }
//
//    override fun getMessage(resolvable: MessageSourceResolvable, locale: Locale): String {
//        return parentMessageSource?.getMessage(resolvable, locale) ?: ""
//    }
//}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy