From 6e964c96e13622592b7a3fa994982af0413d85c7 Mon Sep 17 00:00:00 2001 From: Artem Chepurnyi Date: Tue, 23 Apr 2024 21:33:50 +0300 Subject: [PATCH] improvement: Localize Select a file phrase when picking a file --- .../keyguard/feature/filepicker/FilePickerEffect.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/src/desktopMain/kotlin/com/artemchep/keyguard/feature/filepicker/FilePickerEffect.kt b/common/src/desktopMain/kotlin/com/artemchep/keyguard/feature/filepicker/FilePickerEffect.kt index c5b62189..96922854 100644 --- a/common/src/desktopMain/kotlin/com/artemchep/keyguard/feature/filepicker/FilePickerEffect.kt +++ b/common/src/desktopMain/kotlin/com/artemchep/keyguard/feature/filepicker/FilePickerEffect.kt @@ -6,7 +6,10 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberUpdatedState import com.artemchep.keyguard.common.usecase.ShowMessage import com.artemchep.keyguard.desktop.util.showFilePicker +import com.artemchep.keyguard.feature.localization.textResource +import com.artemchep.keyguard.platform.LocalLeContext import com.artemchep.keyguard.platform.leParseUri +import com.artemchep.keyguard.res.Res import com.artemchep.keyguard.ui.CollectedEffect import com.artemchep.keyguard.ui.LocalComposeWindow import kotlinx.coroutines.flow.Flow @@ -23,6 +26,7 @@ actual fun FilePickerEffect( } val composeWindow by rememberUpdatedState(LocalComposeWindow.current) + val context by rememberUpdatedState(LocalLeContext) val showMessage: ShowMessage by rememberInstance() CollectedEffect(flow) { intent -> @@ -41,9 +45,10 @@ actual fun FilePickerEffect( } } val filters = if (extensions.isNotEmpty()) { + val title = textResource(Res.strings.select_file, context) listOf( FileDialog.Filter( - title = "Select a file", + title = title, extensions = extensions, ), )