locales

package
v0.0.0-...-0b524ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorMessages

type ErrorMessages map[string]string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL