Should Localization Ever Be Part of Domain or Business Logic?

0
4
Asked By MellowPine42 On

I was taught that localization should stay limited to the presentation layer, but I'm wondering how this works in real applications. Do developers ever use locale or language data inside core business logic, or should the domain remain completely independent of how information is displayed?

3 Answers

Answered By CrispOrbit7 On

Localization should generally stay at the presentation boundary. If the core logic starts depending on values like “en-US” or translated strings, changing languages can unexpectedly affect business behavior and make testing much harder. For rules involving geography, taxes, or compliance, use an explicit country code, region, or domain-specific enum instead of the user’s display locale.

Answered By VividNook31 On

A good separation is for the domain to return structured results, error codes, or validation keys, while the UI or document-generation layer turns those into localized text. That keeps translations from being scattered through service code and makes adding another language much easier.

Answered By NorthCedar8 On

There can be an exception when the domain itself is fundamentally tied to a particular language. Some industries use specialized terms that do not translate cleanly, so modeling those concepts in the language used by the subject-matter experts can be practical. That is more about choosing the domain’s terminology than ordinary UI localization.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.