From 9fd2ae290f5ba9836c3fd0e6f2e84071eb6836f1 Mon Sep 17 00:00:00 2001 From: Javier Manrique <> Date: Sat, 23 Nov 2024 18:32:52 +0100 Subject: [PATCH] adding context to strings in order to obtain more accurate translations --- .../composeResources/values/strings.xml | 20 +++++++++---------- .../main/view/parked/ParkedScreen.kt | 2 +- translator.py | 3 +++ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/shared/presentation/src/commonMain/composeResources/values/strings.xml b/shared/presentation/src/commonMain/composeResources/values/strings.xml index b98af5c..c3feef1 100644 --- a/shared/presentation/src/commonMain/composeResources/values/strings.xml +++ b/shared/presentation/src/commonMain/composeResources/values/strings.xml @@ -2,8 +2,8 @@ files/loading-lottie.json Lottie loading animation - GET STARTED - Nice to see you + GET STARTED + Nice to see you Title Refresh Close @@ -11,25 +11,25 @@ Lottie animation Take a note Camera - PARK + PARK Storing your parking location Scanning for UFOs... Nope, just your car Mapping the way back to your ride... Compass calibrated. You’ll never get lost! Where is my car? - Confirmation + Confirmation Are you sure you want to stop parking? - Accept - Cancel - You are parked + Accept + Cancel + You are parked Emoji Map Eye - Forward + Forward Here is your vehicle - files/location-pin-lottie.json + files/location-pin-lottie.json Since You got a note - STOP PARKING + stop parking diff --git a/shared/presentation/src/commonMain/kotlin/com/jmp/wayback/presentation/main/view/parked/ParkedScreen.kt b/shared/presentation/src/commonMain/kotlin/com/jmp/wayback/presentation/main/view/parked/ParkedScreen.kt index e83be2f..5b2c4f5 100644 --- a/shared/presentation/src/commonMain/kotlin/com/jmp/wayback/presentation/main/view/parked/ParkedScreen.kt +++ b/shared/presentation/src/commonMain/kotlin/com/jmp/wayback/presentation/main/view/parked/ParkedScreen.kt @@ -97,7 +97,7 @@ fun ParkedScreen( ) { Text( modifier = Modifier.padding(vertical = 8.dp), - text = stringResource(uiState.stopParkingButtonText), + text = stringResource(uiState.stopParkingButtonText).uppercase(), color = Color.Black, fontWeight = FontWeight.ExtraBold ) diff --git a/translator.py b/translator.py index 23a2610..6722c0f 100644 --- a/translator.py +++ b/translator.py @@ -80,6 +80,7 @@ def create_directories(dir_language): for i in range(len(root)): if 'translatable' not in root[i].attrib: value = root[i].text + context = root[i].comment if value is not None: params = { 'auth_key' : API_KEY, @@ -87,6 +88,8 @@ def create_directories(dir_language): 'source_lang' : languages_from_translate, "target_lang": language_to_translate } + if context is not None: + params['context'] = context request = requests.post("https://api.deepl.com/v2/translate", data=params) result = request.json()