Documentation ¶
Overview ¶
Package translation provides an i18n implementation for the back- and frontend.
Index ¶
Constants ¶
View Source
const ( COMMON = "COMMON." CTRL = "CONTROLLER." ORM = "ORM." NAV = "NAVIGATION." GRID = "GRID." HISTORY = "HISTORY." )
Translation groups.
View Source
const (
DB = "db"
)
predefined translation providers.
View Source
const RAW = "raw"
RAW language.
Variables ¶
View Source
var ( ErrWrap = "translation: %w" ErrProvider = errors.New("translation: provider is not set") )
Error messages.
Functions ¶
func AddRawMessage ¶
AddRawMessage provides an option to define all the RAW messages of the application. This can be used in the init() function for the packages. Raw messages will be sorted by ID.
Types ¶
type Config ¶
type Config struct { // Controller - if enabled, translations will be available in the controller. Controller bool // JSONFilePath - if not zero, JSON files will be generated for each defined language. JSONFilePath string // DefaultLanguage - Default language of the application. DefaultLanguage string `frontend:""` }
Config for the translation.
type Locale ¶
type Locale interface { Translate(messageID string, template ...map[string]interface{}) (string, error) TranslatePlural(messageID string, pluralCount interface{}, template ...map[string]interface{}) (string, error) }
Locale interface.
Click to show internal directories.
Click to hide internal directories.