Documentation
ΒΆ
Index ΒΆ
- Variables
- type ExistsInFS
- type LanguageInfo
- type LoadFrom
- type LocalisableError
- type LocalizerCreatorFn
- type MakeDirFS
- type NotADirectoryError
- type NotADirectoryErrorBehaviourQuery
- type NotADirectoryTemplData
- type PathNotFoundError
- type PathNotFoundErrorBehaviourQuery
- type PathNotFoundTemplData
- type SupportedLanguages
- type TemplData
- type ThirdPartyError
- type ThirdPartyErrorTemplData
- type TranslationFiles
- type TranslationSource
- type UseOptionFn
- type UseOptions
Constants ΒΆ
This section is empty.
Variables ΒΆ
var ( // DefaultLanguage represents the default language of this module DefaultLanguage = translate.DefaultLanguage // ErrSafePanicWarning is the error raised as a panic if the client // has accidentally not called Use before working with li18ngo. ErrSafePanicWarning = translate.ErrSafePanicWarning // Li18ngoSourceID the id that represents this module. If a client want // to provides translations for languages that li18ngo does not, then // the localizer the 'create' created for this purpose should use this // SourceID. So whenever the Text function is used on templates defined // inside this module, the translation process is directed to use the // correct i18n.Localizer (identified by the SourceID). The Source is // statically defined for all templates defined in li18ngo. Li18ngoSourceID = translate.Li18ngoSourceID // Text is the function to use to obtain a string created from // registered Localizers. The data parameter must be a go template // defining the input parameters and the translatable message content. // Not threadsafe. Text = translate.Text // Use, must be called before any string data can be translated. // If requesting the default language, then only the language Tag // needs to be provided. If the requested language is not the default // and therefore requires translation from the translation file(s), then // the App and Path properties must be provided indicating // how the i18n bundle is created. // If only the Default language, then Use can even be called without // specifying the Tag and in this case the default language will be // used. The client MUST call Use before using any functionality in // this package. Use = translate.Use )
Functions ΒΆ
This section is empty.
Types ΒΆ
type ExistsInFS ΒΆ
type ExistsInFS = nef.ExistsInFS
ExistsInFS provides the facility to check the existence of a path in the underlying file system.
type LanguageInfo ΒΆ
type LanguageInfo = translate.LanguageInfo
LanguageInfo information pertaining to setting language. Auto detection is not supported. Any executable that supports i18n, should perform auto detection and then invoke Use, with the detected language tag
type LocalisableError ΒΆ
type LocalisableError = translate.LocalisableError
LocalisableError is an error that is translate-able (Localisable)
type LocalizerCreatorFn ΒΆ
type LocalizerCreatorFn = translate.LocalizerCreatorFn
LocalizerCreatorFn represents the signature of the function that can optionally be provided to override how an i18n Localizer is created.
type NotADirectoryError ΒΆ
type NotADirectoryError struct {
translate.LocalisableError
}
func NewNotADirectoryError ΒΆ
func NewNotADirectoryError(path string) NotADirectoryError
NewNotADirectoryError creates a NotADirectoryError
func (NotADirectoryError) NotADirectory ΒΆ
func (e NotADirectoryError) NotADirectory() bool
NotADirectory enables the client to check if error is NotADirectoryError via QueryNotADirectoryError
type NotADirectoryErrorBehaviourQuery ΒΆ
type NotADirectoryErrorBehaviourQuery interface {
NotADirectory() bool
}
NotADirectoryErrorBehaviourQuery used to query if an error is: "File system path is not a directory"
type NotADirectoryTemplData ΒΆ
type NotADirectoryTemplData struct {
locale.Li18ngoTemplData
Path string
}
NotADirectoryTemplData path is not a directory
func (NotADirectoryTemplData) Message ΒΆ
func (td NotADirectoryTemplData) Message() *i18n.Message
type PathNotFoundError ΒΆ
type PathNotFoundError struct {
translate.LocalisableError
}
func NewPathNotFoundError ΒΆ
func NewPathNotFoundError(name, path string) PathNotFoundError
NewPathNotFoundError creates a PathNotFoundError
func (PathNotFoundError) IsPathNotFound ΒΆ
func (e PathNotFoundError) IsPathNotFound() bool
PathNotFound enables the client to check if error is PathNotFoundError via QueryPathNotFoundError
type PathNotFoundErrorBehaviourQuery ΒΆ
type PathNotFoundErrorBehaviourQuery interface {
IsPathNotFound() bool
}
PathNotFoundErrorBehaviourQuery used to query if an error is: "File system foo is ..."
type PathNotFoundTemplData ΒΆ
type PathNotFoundTemplData struct {
locale.Li18ngoTemplData
Name string
Path string
}
PathNotFoundTemplData is
func (PathNotFoundTemplData) Message ΒΆ
func (td PathNotFoundTemplData) Message() *i18n.Message
type SupportedLanguages ΒΆ
type SupportedLanguages = translate.SupportedLanguages
SupportedLanguages is a collection of the language Tags that a module can define to express what languages it contains translations for.
type ThirdPartyError ΒΆ
type ThirdPartyError struct {
translate.LocalisableError
}
ThirdPartyError represents an error received by a dependency that does not support i18n.
func NewThirdPartyErr ΒΆ
func NewThirdPartyErr(err error) ThirdPartyError
NewThirdPartyErr creates a ThirdPartyErr
type ThirdPartyErrorTemplData ΒΆ
type ThirdPartyErrorTemplData struct {
locale.Li18ngoTemplData
Error error
}
ThirdPartyErrorTemplData third party un-translated error
func (ThirdPartyErrorTemplData) Message ΒΆ
func (td ThirdPartyErrorTemplData) Message() *i18n.Message
type TranslationFiles ΒΆ
type TranslationFiles = translate.TranslationFiles
TranslationFiles maps a source id to a TranslationSource
type TranslationSource ΒΆ
type TranslationSource = translate.TranslationSource
TranslationSource Name: core name of dependency's translation file. The actual file is derived from this name in the form: <name>.active.<lang>.json; eg li18ngo.active.en-GB.json. Path: file system path to the translation file. If missing, then it will default to the location of the executable file.
type UseOptionFn ΒΆ
type UseOptionFn = translate.UseOptionFn
UseOptionFn functional options function required by Use.
type UseOptions ΒΆ
type UseOptions = translate.UseOptions
UseOptions the options provided to the Use function


