-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/DRAW-357' into sandbox
- Loading branch information
Showing
15 changed files
with
99 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
adapter/firebase/src/main/resources/i18n/messages_en.properties
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
adapter/firebase/src/main/resources/i18n/messages_ko.properties
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
app/support/exception/src/main/resources/application-exception.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import org.springframework.boot.gradle.tasks.bundling.BootJar | ||
|
||
plugins { | ||
id("org.springframework.boot") | ||
kotlin("plugin.spring") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":domain")) | ||
implementation(project(":support:logging")) | ||
|
||
implementation("org.springframework.boot:spring-boot-starter:${Versions.SPRING_BOOT}") | ||
} | ||
|
||
tasks { | ||
withType<Jar> { enabled = true } | ||
withType<BootJar> { enabled = false } | ||
} |
17 changes: 17 additions & 0 deletions
17
app/support/i18n/src/main/kotlin/com/xorker/draw/i18n/MessageConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.xorker.draw.i18n | ||
|
||
import org.springframework.context.MessageSource | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.context.support.ResourceBundleMessageSource | ||
|
||
@Configuration | ||
class MessageConfig { | ||
@Bean | ||
fun messageSource(): MessageSource { | ||
val messageSource = ResourceBundleMessageSource() | ||
messageSource.setDefaultEncoding("UTF-8") | ||
messageSource.setBasename("i18n/messages") | ||
return messageSource | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/support/i18n/src/main/kotlin/com/xorker/draw/i18n/MessageService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.xorker.draw.i18n | ||
|
||
import com.xorker.draw.exception.NotDefinedMessageCodeException | ||
import com.xorker.draw.support.logging.logger | ||
import java.util.Locale | ||
import org.springframework.context.MessageSource | ||
import org.springframework.context.NoSuchMessageException | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class MessageService( | ||
private val messageSource: MessageSource, | ||
) { | ||
private val logger = logger() | ||
|
||
fun getMessage(code: String, locale: Locale): String { | ||
try { | ||
return messageSource.getMessage(code, null, locale) | ||
} catch (e: NoSuchMessageException) { | ||
logger.error("i18n Error - $code", e) | ||
throw NotDefinedMessageCodeException(code, locale, e) | ||
} | ||
} | ||
|
||
fun getMessageOrNull(code: String, locale: Locale): String? { | ||
try { | ||
return messageSource.getMessage(code, null, locale) | ||
} catch (e: NoSuchMessageException) { | ||
logger.warn("i18n Error - $code", e) | ||
return null | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...ain/resources/i18n/messages_en.properties → ...ain/resources/i18n/messages_en.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...ain/resources/i18n/messages_ko.properties → ...ain/resources/i18n/messages_ko.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters