- ABP Framework version: v6.0.1
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Exception message and stack trace:
- Steps to reproduce the issue:"
I have a solution with several modules (CoreModule, CrmModule, etc.). I have a need to access localization from CrmModule within CoreModule. When I attempt to do so, the error code is not found. What do I need to do to be able to access localization across all modules?
Below is details regarding my scenario.
BusinessException (in CrmModule):
public class ContactDoesNotExistException : BusinessException { public ContactDoesNotExistException() : base(CrmErrorCodes.ContactDoesNotExistException) { } }
ErrorCode (in CrmModule):
public const string ContactDoesNotExistException = "Contact:00001";
en.json (in CrmModule):
"Contact:00001": "Contact does not exist",
Write exception message to a string (in CoreModule):
exceptionMessage = L[((BusinessException)row.Exception).Code];
I want exceptionMessage to display "Contact does not exist" but instead I'm getting "Contact:00001."
2 Answer(s)
-
0
hi
You can create a shared module(
CoreLocalizationModule, CoreLocalizationResource
) for localization. -
0
Thanks for the suggestion. Instead of creating a shared module, we decided to use the business exception code namespace to lookup the correct localization resource.