Compare commits

..

1 Commits

Author SHA1 Message Date
renovate[bot]
2eafd8f288 Update dependency org.jetbrains.kotlin.plugin.compose to v2.2.21 2025-10-23 13:25:12 +00:00
18 changed files with 3 additions and 168 deletions

View File

@@ -1,7 +1,5 @@
# Changelog
## 0.26.7
## 0.26.6
* `Versions`:

View File

@@ -18,5 +18,5 @@ crypto_js_version=4.1.1
# Project data
group=dev.inmo
version=0.26.7
android_code_version=306
version=0.26.6
android_code_version=305

View File

@@ -1,6 +1,6 @@
[versions]
kt = "2.2.20"
kt = "2.2.21"
kt-serialization = "1.9.0"
kt-coroutines = "1.10.2"

View File

@@ -1,3 +0,0 @@
package dev.inmo.micro_utils.language_codes
expect val currentIetfLang: IetfLang?

View File

@@ -1,6 +0,0 @@
package dev.inmo.micro_utils.language_codes
import kotlinx.browser.window
actual val currentIetfLang: IetfLang?
get() = window.navigator.language.unsafeCast<String?>() ?.let { IetfLang(it) }

View File

@@ -1,6 +0,0 @@
package dev.inmo.micro_utils.language_codes
import java.util.Locale
actual val currentIetfLang: IetfLang?
get() = Locale.getDefault() ?.toIetfLang()

View File

@@ -1,27 +0,0 @@
package dev.inmo.micro_utils.language_codes
import dev.inmo.micro_utils.language_codes.IetfLang
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.allocArray
import kotlinx.cinterop.memScoped
import kotlinx.cinterop.toKString
import platform.posix.getenv
import platform.windows.GetUserDefaultLocaleName
import platform.windows.LOCALE_NAME_MAX_LENGTH
import platform.windows.WCHARVar
@OptIn(ExperimentalForeignApi::class)
actual val currentIetfLang: IetfLang?
get() {
val rawLocale = memScoped {
val buffer = allocArray<WCHARVar>(LOCALE_NAME_MAX_LENGTH)
val result = GetUserDefaultLocaleName(buffer, LOCALE_NAME_MAX_LENGTH)
if (result > 0) {
// Convert WCHAR* to String
buffer.toKString()
}
"en-US" // fallback
}
return IetfLang(rawLocale)
}

View File

@@ -1,12 +0,0 @@
package dev.inmo.micro_utils.language_codes
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.toKString
import platform.posix.getenv
@OptIn(ExperimentalForeignApi::class)
actual val currentIetfLang: IetfLang?
get() {
val localeStr = getenv("LANG") ?.toKString() ?.replace("_", "-") ?: "en-US"
return IetfLang(localeStr)
}

View File

@@ -1,10 +0,0 @@
package dev.inmo.micro_utils.language_codes
external interface Navigator {
val language: String
}
external val navigator: Navigator
actual val currentIetfLang: IetfLang?
get() = IetfLang(navigator.language)

View File

@@ -1,20 +0,0 @@
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
alias(libs.plugins.jb.compose)
alias(libs.plugins.kt.jb.compose)
}
apply from: "$mppComposeJvmJsWasmJsAndroidLinuxMingwLinuxArm64Project"
kotlin {
sourceSets {
commonMain {
dependencies {
api libs.kt.coroutines
api project(":micro_utils.resources")
}
}
}
}

View File

@@ -1,24 +0,0 @@
package dev.inmo.micro_utils.resources.compose
import android.os.Build
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalConfiguration
import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.micro_utils.language_codes.toIetfLang
@Composable
actual fun getCurrentLocale(): IetfLang? {
val configuration = LocalConfiguration.current
val locale = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
if (configuration.locales.isEmpty) {
return null
}
configuration.locales.get(0)
} else {
@Suppress("DEPRECATION")
configuration.locale
}
return locale.toIetfLang()
}

View File

@@ -1,7 +0,0 @@
package dev.inmo.micro_utils.resources.compose
import androidx.compose.runtime.Composable
import dev.inmo.micro_utils.language_codes.IetfLang
@Composable
expect fun getCurrentLocale(): IetfLang?

View File

@@ -1,10 +0,0 @@
package dev.inmo.micro_utils.resources.compose
import androidx.compose.runtime.Composable
import dev.inmo.micro_utils.strings.StringResource
@Suppress("unused")
@Composable
fun StringResource.composeTranslation(): String {
return translation(getCurrentLocale())
}

View File

@@ -1,9 +0,0 @@
package dev.inmo.micro_utils.resources.compose
import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.micro_utils.language_codes.currentIetfLang
@androidx.compose.runtime.Composable
actual fun getCurrentLocale(): IetfLang? {
return currentIetfLang
}

View File

@@ -1,10 +0,0 @@
package dev.inmo.micro_utils.resources.compose
import androidx.compose.ui.text.intl.Locale
import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.micro_utils.language_codes.currentIetfLang
@androidx.compose.runtime.Composable
actual fun getCurrentLocale(): IetfLang? {
return currentIetfLang
}

View File

@@ -1,9 +0,0 @@
package dev.inmo.micro_utils.resources.compose
import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.micro_utils.language_codes.currentIetfLang
@androidx.compose.runtime.Composable
actual fun getCurrentLocale(): IetfLang? {
return currentIetfLang
}

View File

@@ -1,9 +0,0 @@
package dev.inmo.micro_utils.resources.compose
import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.micro_utils.language_codes.currentIetfLang
@androidx.compose.runtime.Composable
actual fun getCurrentLocale(): IetfLang? {
return currentIetfLang
}

View File

@@ -50,7 +50,6 @@ String[] includes = [
":colors:common",
":resources",
":resources:compose",
":fsm:common",
":fsm:repos:common",