generated from snivilised/astrolib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathli18ngo-api.go
93 lines (73 loc) · 3.57 KB
/
li18ngo-api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package li18ngo
import (
"github.com/snivilised/li18ngo/internal/translate"
nef "github.com/snivilised/nefilim"
)
var (
// 🌐 translate
// 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
)
type (
// 🌐 nfs
// ExistsInFS provides the facility to check the existence
// of a path in the underlying file system.
ExistsInFS = nef.ExistsInFS
// MakeDirFS is a file system with a MkDirAll method.
MakeDirFS = nef.MakeDirFS
// 🌐 translate
// LoadFrom denotes where to load the translation file from
LoadFrom = translate.LoadFrom
// LocalisableError is an error that is translate-able (Localisable)
LocalisableError = translate.LocalisableError
// 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
LanguageInfo = translate.LanguageInfo
// LocalizerCreatorFn represents the signature of the function that can
// optionally be provided to override how an i18n Localizer is created.
LocalizerCreatorFn = translate.LocalizerCreatorFn
// SupportedLanguages is a collection of the language Tags that a module
// can define to express what languages it contains translations for.
SupportedLanguages = translate.SupportedLanguages
// 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.
TranslationSource = translate.TranslationSource
// TranslationFiles maps a source id to a TranslationSource
TranslationFiles = translate.TranslationFiles
// UseOptions the options provided to the Use function
UseOptions = translate.UseOptions
// UseOptionFn functional options function required by Use.
UseOptionFn = translate.UseOptionFn
)