From c237dd3ef95ba6577e5559e41f5f917055633e11 Mon Sep 17 00:00:00 2001 From: Anthony Wittig Date: Wed, 21 Oct 2026 15:50:03 -0600 Subject: [PATCH 1/2] Make translation microservice case-insensitive and fix Zulu terms The testing-code exercise has learners change "Hello" to "Goodbye", but the microservice only accepted lowercase terms. Lowercase the term and language code before lookup. Also swap the Zulu hello/goodbye translations, which were reversed. Co-Authored-By: Claude Opus 5.5 --- utilities/microservice/microservice.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utilities/microservice/microservice.py b/utilities/microservice/microservice.py index 4dbd344..7e66973 100644 --- a/utilities/microservice/microservice.py +++ b/utilities/microservice/microservice.py @@ -16,7 +16,7 @@ "mi": {"hello": "kia ora", "goodbye": "poroporoaki", "thanks": "whakawhetai koe"}, "sk": {"hello": "ahoj", "goodbye": "zbohom", "thanks": "ďakujem"}, "tr": {"hello": "merhaba", "goodbye": "güle güle", "thanks": "teşekkür ederim"}, - "zu": {"hello": "hamba kahle", "goodbye": "sawubona", "thanks": "ngiyabonga"}, + "zu": {"hello": "sawubona", "goodbye": "hamba kahle", "thanks": "ngiyabonga"}, } @@ -30,13 +30,17 @@ def translate(): if not lang: return jsonify({"error": "Missing required 'lang' parameter"}), 500 - if lang not in translations: + # Match terms and language codes case-insensitively (e.g., "Hello" or "HELLO") + lang_key = lang.lower() + term_key = term.lower() + + if lang_key not in translations: return jsonify({"error": f"Invalid language code '{lang}'"}), 500 - if term not in translations[lang]: + if term_key not in translations[lang_key]: return jsonify({"error": f"Invalid translation term '{term}'"}), 500 - translation = translations[lang][term] + translation = translations[lang_key][term_key] capitalized_translation = translation.capitalize() print(f"{term} translated to {lang} with result {translation}") From eca168e39f9d589bb74722b2bb9d851045235b04 Mon Sep 17 00:00:00 2001 From: Anthony Wittig Date: Wed, 21 Oct 2026 15:50:03 -0600 Subject: [PATCH 2/2] Use lowercase terms in testing-code README to match test code Co-Authored-By: Claude Opus 5.5 --- exercises/testing-code/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/testing-code/README.md b/exercises/testing-code/README.md index 44a4a66..6024ffd 100644 --- a/exercises/testing-code/README.md +++ b/exercises/testing-code/README.md @@ -52,7 +52,7 @@ invoking properly. Now it is time to test if Goodbye is also working. 2. Copy the tuple in the `pytest.mark.parametrize` list and paste it into the list, effectively creating a second entry to test the method on. 3. Change the term for the `TranslationActivityInput` object in this second - tuple from `Hello` to `Goodbye` + tuple from `hello` to `goodbye` 4. Change the language code for the `TranslationActivityInput` object in this second tuple from `de` (German) to `lv` (Latvian) 5. Change the translation for the `TranslationActivityOutput` object in this second