Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorMessages ¶
ErrorMessages represents a collection of error messages.
func LoadMessagesFromJSON ¶
func LoadMessagesFromJSON(lang string) (ErrorMessages, error)
LoadMessagesFromJSON loads error messages from a JSON file based on the specified language. It reads the JSON file located in the "internal/validator/locales" directory and unmarshal it into an ErrorMessages map. The language parameter specifies the language code (e.g., "en" for English).
If the messages for the specified language are already loaded, it returns them from the cache. Otherwise, it loads the messages from the JSON file, caches them, and returns.
Click to show internal directories.
Click to hide internal directories.