Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/kotlin/cc/modlabs/klassicx/tools/Environment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,6 @@ object Environment {
return getFloatOrNull(key) ?: default
}

internal val isDevLoggingEnabled: Boolean
get() = getString("DEBUG_LOGS")?.toBoolean() == true
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package cc.modlabs.klassicx.translation.sources

import cc.modlabs.klassicx.extensions.getInternalKlassicxLogger
import cc.modlabs.klassicx.tools.Environment.isDevLoggingEnabled
import cc.modlabs.klassicx.translation.Translation
import cc.modlabs.klassicx.translation.interfaces.TranslationSource
import cc.modlabs.klassicx.translation.live.HelloEvent
Expand Down Expand Up @@ -83,6 +85,10 @@ class TransForgeTranslationSource(
val type = object : TypeToken<List<LocaleResponse>>() {}.type
val locales: List<LocaleResponse> = gson.fromJson(response.body(), type)

if (isDevLoggingEnabled) {
getInternalKlassicxLogger().info("Discovered languages for translationId $translationId: ${locales.joinToString { "${it.locale}(enabled: ${it.enabled} - id: ${it.id} - ${it.createdAt})" }}")
}

locales
.filter { it.enabled }
.map { it.locale }
Expand Down Expand Up @@ -115,7 +121,10 @@ class TransForgeTranslationSource(
val data: Map<String, String> = gson.fromJson(response.body(), type) ?: emptyMap()

data.map { (key, value) ->
Translation(
if(isDevLoggingEnabled) {
getInternalKlassicxLogger().info("Translating $key to $value in $language")
}
Translation (
languageCode = language,
messageKey = key,
message = value
Expand Down
Loading