Add i18n module: MessageSource, LocaleResolver and localized ProblemDetail
English, Marathi and Hindi bundles behind one small web app, with tests that run it on a real port and write the transcripts (01-11) quoted in the article, plus a jar-metadata capture (12). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Uu7q8vPeREyT4218EJPzz1
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
# Three kinds of exception: an ErrorResponse, an ordinary exception handled through the MessageSource, and one handled with English text in the source
|
||||
|
||||
|
||||
--- an ErrorResponse (OrderNotFoundException) ---
|
||||
Accept-Language: en
|
||||
status=404 Content-Type=application/problem+json
|
||||
title: Order not found
|
||||
detail: No order with id 7 exists.
|
||||
Accept-Language: mr
|
||||
status=404 Content-Type=application/problem+json
|
||||
title: ऑर्डर सापडली नाही
|
||||
detail: ७ क्रमांकाची ऑर्डर अस्तित्वात नाही.
|
||||
Accept-Language: hi
|
||||
status=404 Content-Type=application/problem+json
|
||||
title: ऑर्डर नहीं मिला
|
||||
detail: क्रमांक 7 वाला ऑर्डर मौजूद नहीं है।
|
||||
|
||||
--- an ordinary exception, translated in the handler (PaymentDeclinedException) ---
|
||||
Accept-Language: en
|
||||
status=402 Content-Type=application/problem+json
|
||||
title: Payment declined
|
||||
detail: Payment of 499.00 was declined.
|
||||
Accept-Language: mr
|
||||
status=402 Content-Type=application/problem+json
|
||||
title: पेमेंट नाकारले
|
||||
detail: 499.00 चे पेमेंट नाकारले गेले.
|
||||
Accept-Language: hi
|
||||
status=402 Content-Type=application/problem+json
|
||||
title: भुगतान अस्वीकृत
|
||||
detail: 499.00 का भुगतान अस्वीकार कर दिया गया।
|
||||
|
||||
--- an ordinary exception, English in the handler (LegacyStateException) ---
|
||||
Accept-Language: en
|
||||
status=409 Content-Type=application/problem+json
|
||||
title: Conflict
|
||||
detail: The order is in a state that does not allow this.
|
||||
Accept-Language: mr
|
||||
status=409 Content-Type=application/problem+json
|
||||
title: Conflict
|
||||
detail: The order is in a state that does not allow this.
|
||||
Accept-Language: hi
|
||||
status=409 Content-Type=application/problem+json
|
||||
title: Conflict
|
||||
detail: The order is in a state that does not allow this.
|
||||
Reference in New Issue
Block a user