Documentation ¶
Index ¶
- Constants
- func CollectFromMap(dat map[string]interface{}) map[string]struct{}
- func CollectFromTempl(file_content string) map[string]struct{}
- func CreateExcerpts(res []interface{}, conf map[string]interface{})
- func Excerpt(s string, max_char_count int) string
- func ExtractLocName(s string) string
- func GetOnlyPair(c map[string]interface{}) (string, interface{})
- func IsLocString(s string) bool
- func Load(opt_i interface{}, root string, file []byte, ...) ([]byte, error)
- func LoadLocStrings(dat map[string]interface{}, user_langs []string, root, tplpath string, ...) (map[string]interface{}, error)
- func LoadLocTempl(file_content string, user_langs []string, root, tplpath string, ...) (map[string]interface{}, error)
- func ReadFiles(root, tplpath string, user_langs []string, locfiles map[string]struct{}, ...) (map[string]interface{}, error)
- func RunQueries(db *mgo.Database, queries map[string]interface{}, get map[string][]string, ...) map[string]interface{}
- func RunQuery(db *mgo.Database, query_name string, query map[string]interface{}, ...) map[string]interface{}
- type PagingInfo
Constants ¶
const Min_loc_len = 8 // $loc.a.b
Decides if a string should be localized.
Variables ¶
This section is empty.
Functions ¶
func CollectFromMap ¶
func CollectFromTempl ¶
Extracts used multilingual variables from a template with regexp.
func CreateExcerpts ¶
func CreateExcerpts(res []interface{}, conf map[string]interface{})
conf := map[string]interface{}{"content": Maybe we could modify this to be able to create excerpts from multiple fields.
func ExtractLocName ¶
Extracts the name of the localization file from the given loc string.
func GetOnlyPair ¶
Extracts the key value pair of a map which has a length of 1.
func IsLocString ¶
func Load ¶
func Load(opt_i interface{}, root string, file []byte, get func(string, string) ([]byte, error)) ([]byte, error)
Searches all {{load modname/filename.ext}} and replaces that with the proper requires then calls the require module on the file.
func LoadLocStrings ¶
func LoadLocStrings(dat map[string]interface{}, user_langs []string, root, tplpath string, loc_reader func(s string) (map[string]interface{}, error)) (map[string]interface{}, error)
tplpath is public/default or private/127.0.0.1/default
func LoadLocTempl ¶
func LoadLocTempl(file_content string, user_langs []string, root, tplpath string, loc_reader func(s string) (map[string]interface{}, error)) (map[string]interface{}, error)
tplpath is public/default or private/127.0.0.1/default
func ReadFiles ¶
func ReadFiles(root, tplpath string, user_langs []string, locfiles map[string]struct{}, loc_reader func(s string) (map[string]interface{}, error)) (map[string]interface{}, error)
Takes a list of localization filenames and tries to load every one of them, first from the template, then from the modules.
func RunQueries ¶
func RunQueries(db *mgo.Database, queries map[string]interface{}, get map[string][]string, path_n_query string) map[string]interface{}
c: collection string q: query map[string]interface{} p: page number key string This is used to extract the page nubver from get parameters. Also activates paging.
Only works with limit.
sk: skip float64/int Hardcoded value, barely useful (see p instead) l: limit float64/int so: sort string Example: "-created"
TODO: check for validity of type assertions.