Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import io.redlink.more.app.android.R
import io.redlink.more.app.android.activities.dashboard.schedule.ScheduleViewModel
import io.redlink.more.app.android.activities.tasks.ObservationActionButton
import io.redlink.more.app.android.extensions.getStringResource
import io.redlink.more.app.android.extensions.getStringResourceByName
import io.redlink.more.app.android.extensions.jvmLocalDateTime
import io.redlink.more.app.android.shared_composables.BasicText
import io.redlink.more.app.android.shared_composables.SmallTitle
Expand Down Expand Up @@ -81,7 +82,7 @@ fun ScheduleListItem(
modifier = Modifier.fillMaxWidth()
) {
BasicText(
text = scheduleModel().observationType,
text = getStringResourceByName(scheduleModel().observationType.replace("-", "_")),
color = MoreColors.Secondary
)
Row(horizontalArrangement = Arrangement.End) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ class NotificationViewModel(private val coreFilterViewModel: CoreNotificationFil
if (!coreFilterViewModel.filterActive()) {
return stringResource(R.string.more_filter_notification_all)
}
return coreFilterViewModel.activeTypes.value.joinToString(", ")
return coreFilterViewModel.activeTypes.value.joinToString(", ") { it }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,4 @@ fun NotificationFilterView(coreViewModel: CoreNotificationFilterViewModel) {
MoreDivider(modifier = Modifier.padding(vertical = 10.dp))
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ package io.redlink.more.app.android.extensions
import android.content.Context
import android.os.Build
import android.provider.Settings
import dev.icerock.moko.resources.StringResource
import io.redlink.more.Shared.Companion.getSharedResource
import io.redlink.more.app.android.BuildConfig
import io.redlink.more.app.android.MoreApplication

Expand All @@ -30,4 +32,7 @@ fun getSecureID(context: Context) =

fun getProductName() = Build.PRODUCT

fun sharedResource(id: StringResource): String =
getSharedResource(id).toString(context = MoreApplication.appContext!!)

const val applicationId = BuildConfig.APPLICATION_ID
10 changes: 10 additions & 0 deletions androidApp/src/main/res/values-de/observation-type-strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="question_observation">Frage</string>
<string name="questionnaire_observation">Fragebogen</string>
<string name="multiple_choice_question_observation">Multiple Choice</string>
<string name="gps_mobile_observation">GPS</string>
<string name="acc_mobile_observation">Accelerometer</string>
<string name="app_usage_observation">App Nutzung</string>
<string name="polar_verity_observation">Polar Verity</string>
</resources>
10 changes: 10 additions & 0 deletions androidApp/src/main/res/values/observation-type-strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="question_observation">Question</string>
<string name="questionnaire_observation">Questionnaire</string>
<string name="multiple_choice_question_observation">Multiple Choice</string>
<string name="gps_mobile_observation">GPS</string>
<string name="acc_mobile_observation">Accelerometer</string>
<string name="app_usage_observation">App Usage</string>
<string name="polar_verity_observation">Polar Verity</string>
</resources>
5 changes: 3 additions & 2 deletions iosApp/iosApp/Extensions/NavigationScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ enum NavigationScreen: CaseIterable, Equatable, Identifiable {
case .questionObservationThanks:
return NavigationScreenValues(screenName: "Question Thanks", navigationLink: .questionnaireResponse, fullScreen: true)
case .dashboardFilter:
return NavigationScreenValues(screenName: "Dashboard Filter", navigationLink: .dashboard)
return NavigationScreenValues(screenName: "Dashboard Filter", navigationLink: .observationFilter)
case .notificationFilter:
return NavigationScreenValues(screenName: "Notification Filter", navigationLink: .notificationFilter)
case .pastObservations:
Expand Down Expand Up @@ -142,7 +142,8 @@ extension NavigationScreen {
}

func localize() -> String {
return values.screenName
let localizedKey = String.LocalizationValue(stringLiteral: values.screenName)
return String(localized: localizedKey)
}

func generateURL(withParameters params: [NavigationRouteParameter: String]) -> URL? {
Expand Down
108 changes: 99 additions & 9 deletions iosApp/iosApp/Resources/Strings/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,23 @@
}
}
},
"app-usage-observation" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "App Nutzung"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "App usage"
}
}
}
},
"back_to_settings" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -563,19 +580,19 @@
}
}
},
"enter_study_url" : {
"enter_study_endpoint_placeholder" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "URL der Studie eigeben"
"value" : "URL der Studie eingeben"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Enter study URL"
"value" : "Enter Study URL"
}
}
}
Expand Down Expand Up @@ -744,13 +761,13 @@
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Nur wichtige"
"value" : "Wichtig"
Comment thread
FlorentinPosch marked this conversation as resolved.
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Only Important"
"value" : "Important"
}
}
}
Expand Down Expand Up @@ -959,6 +976,23 @@
}
}
},
"multiple-choice-question-observation" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mehrfachauswahl"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Multiple Choice"
}
}
}
},
"No devices connected" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -1113,6 +1147,17 @@
}
}
},
"Notification Filter" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Nachrichten Filter"
}
}
}
},
"Notification Permissions Not Granted" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -1382,6 +1427,34 @@
}
}
},
"participation_key_entry_placeholder" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "Token eingeben"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Enter Token"
}
}
}
},
"Past Observations" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Vergangene Aufzeichnungen"
}
}
}
},
"pause_observation" : {
"comment" : "A label for a button that pauses an observation.",
"isCommentAutoGenerated" : true,
Expand Down Expand Up @@ -1851,6 +1924,23 @@
}
}
},
"Select Filter" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Wähle einen Filter"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Select Filter"
}
}
}
},
"Select Time" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -2008,7 +2098,7 @@
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Starte den Fragebogen"
"value" : "Starte den Fragebogen"
}
},
"en" : {
Expand Down Expand Up @@ -2536,14 +2626,14 @@
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Nicht gelesene"
"state" : "needs_review",
"value" : "Ungelesen"
Comment thread
FlorentinPosch marked this conversation as resolved.
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Not read"
"value" : "Unread"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions iosApp/iosApp/Views/Components/ExpandableInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ struct ExpandableInput: View {

if expanded {
if isSmTextfield {
MoreTextFieldSmBottom(titleKey: .constant(inputPlaceholder), inputText: $input, capitalization: capitalization, autoCorrectDisabled: true, textType: textType)
MoreTextFieldSmBottom(titleKey: $inputPlaceholder, inputText: $input, capitalization: capitalization, autoCorrectDisabled: true, textType: textType)
} else {
MoreTextField(titleKey: .constant(inputPlaceholder), inputText: $input, capitalization: capitalization, autoCorrectDisabled: true, textType: textType)
MoreTextField(titleKey: $inputPlaceholder, inputText: $input, capitalization: capitalization, autoCorrectDisabled: true, textType: textType)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion iosApp/iosApp/Views/Components/MoreTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct MoreTextField: View {
var textType: UITextContentType? = nil

var body: some View {
TextField(titleKey, text: $inputText)
TextField(LocalizedStringKey(titleKey), text: $inputText)
.textFieldAutoCapitalizataion(capitalization: capitalization)
.autocorrectionDisabled(autoCorrectDisabled)
.textContentType(textType)
Expand Down
4 changes: 2 additions & 2 deletions iosApp/iosApp/Views/Components/MoreTextFieldHL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ struct MoreTextFieldHL: View {
.padding(3)

if isSmTextfield {
MoreTextFieldSmBottom(titleKey: .constant(inputPlaceholder), inputText: $input, capitalization: capitalization, autoCorrectDisabled: autoCorrectDisabled, textType: textType)
MoreTextFieldSmBottom(titleKey: $inputPlaceholder, inputText: $input, capitalization: capitalization, autoCorrectDisabled: autoCorrectDisabled, textType: textType)
} else {
MoreTextField(titleKey: .constant(inputPlaceholder), inputText: $input, capitalization: capitalization, autoCorrectDisabled: autoCorrectDisabled, textType: textType)
MoreTextField(titleKey: $inputPlaceholder, inputText: $input, capitalization: capitalization, autoCorrectDisabled: autoCorrectDisabled, textType: textType)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion iosApp/iosApp/Views/Components/MoreTextFieldSmBottom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct MoreTextFieldSmBottom: View {
var autoCorrectDisabled: Bool = false
var textType: UITextContentType? = nil
var body: some View {
TextField(titleKey, text: $inputText)
TextField(LocalizedStringKey(titleKey), text: $inputText)
.textFieldAutoCapitalizataion(capitalization: capitalization)
.autocorrectionDisabled(autoCorrectDisabled)
.textContentType(textType)
Expand Down
4 changes: 2 additions & 2 deletions iosApp/iosApp/Views/Login/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct LoginView: View {
MoreTextFieldHL(
isSmTextfield: .constant(false),
headerText: "participation_key_entry",
inputPlaceholder: .constant("participation_key_entry"),
inputPlaceholder: .constant("participation_key_entry_placeholder"),
input: $model.token,
capitalization: .uppercase,
autoCorrectDisabled: true,
Expand Down Expand Up @@ -121,7 +121,7 @@ struct LoginView: View {
expanded: $showEndpoint,
isSmTextfield: .constant(true),
headerText: .constant("study_endpoint_headling"),
inputPlaceholder: .constant("enter_study_endpoint"),
inputPlaceholder: .constant("enter_study_endpoint_placeholder"),
input: $model.endpoint,
capitalization: .lowercase,
textType: .URL
Expand Down
15 changes: 10 additions & 5 deletions iosApp/iosApp/Views/Notification/NotificationViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ class NotificationViewModel: ObservableObject {
.store(in: &cancellables)

createPublisher(for: filterViewModel.activeTypes)
.map { (types: Set<String>) -> String in
guard !types.isEmpty else {
return ""
.map { (types: Set<String>) -> String in
guard !types.isEmpty else {
return ""
}

let localized = types
.sorted()
.map { String(localized: String.LocalizationValue($0)) }

return ListFormatter.localizedString(byJoining: localized)
}
return types.sorted().joined(separator: ", ")
}
.removeDuplicates()
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { _ in }) { [weak self] text in
Expand Down
2 changes: 1 addition & 1 deletion iosApp/iosApp/Views/Schedule/List/ObservationDetails.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct ObservationDetails: View {
.font(Font.more.headline)
.foregroundColor(Color.more.primary)
.padding(.bottom, 1)
Text(observationType)
Text(LocalizedStringKey(observationType))
.foregroundColor(Color.more.secondary)
}
.padding(4)
Expand Down
3 changes: 3 additions & 0 deletions shared/src/commonMain/kotlin/io/redlink/more/Shared.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
package io.redlink.more

import dev.icerock.moko.resources.StringResource
import dev.icerock.moko.resources.desc.Resource
import dev.icerock.moko.resources.desc.StringDesc
import dev.tmapps.konnection.Konnection
Expand Down Expand Up @@ -418,5 +419,7 @@ open class Shared(
val HOST = StringDesc.Resource(SharedRes.strings.deeplink_host)

fun konnectionInstance() = Konnection.instance

fun getSharedResource(id: StringResource): StringDesc = StringDesc.Resource(id)
}
}
Loading
Loading