Documentation ¶
Index ¶
- Variables
- func CountApplicability(cfg *setting.Configuration, ld *data.LocaleData, str string, ...) (int, int)
- func DetectLanguage(cfg *setting.Configuration, str string, languages []string, ...) (string, error)
- func GetLanguages(locales []string, languages []string, useGivenOrder bool) ([]string, error)
- func GetLocale(code string) (*data.LocaleData, error)
- func GetLocales(locales []string, languages []string, region string, useGivenOrder bool, ...) ([]*data.LocaleData, error)
- func GetUniqueCharsets(languages []string) map[string][]rune
- func IsApplicable(cfg *setting.Configuration, ld *data.LocaleData, str string, ...) bool
- func Simplify(ld *data.LocaleData, str string) string
- func Split(ld *data.LocaleData, str string, keepFormatting bool, ...) []string
- func SplitSentence(ld *data.LocaleData, str string) []string
- func Translate(cfg *setting.Configuration, ld *data.LocaleData, str string, ...) []string
- func TranslateSearch(cfg *setting.Configuration, ld *data.LocaleData, str string) ([]string, []string)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CountApplicability ¶
func CountApplicability(cfg *setting.Configuration, ld *data.LocaleData, str string, stripTimezone bool) (int, int)
func DetectLanguage ¶
func GetLanguages ¶
func GetLocale ¶
func GetLocale(code string) (*data.LocaleData, error)
GetLocale returns a single locale instance based on the specified locale `code`, e.g. 'fr-PF', 'qu-EC', 'af-NA'.
func GetLocales ¶
func GetLocales(locales []string, languages []string, region string, useGivenOrder bool, allowConflictingLocales bool) ([]*data.LocaleData, error)
GetLocales returns list of locale data based on the specified `locales`, `languages` and `region`.
Parameter `locales` is a list of codes of locales which are to be loaded e.g. ['fr-PF', 'qu-EC', 'af-NA'], `languages` is a list of language codes e.g. ['en', 'es', 'zh-Hant'], and `region` is a region code, e.g. 'IN', '001', 'NE'. If `locales` are empty, languages and region are used to construct locales to load.
If `useGivenOrder` is true, the returned list is ordered in the order locales are given. If set to false, the list will be sorted by how common the locale is used in the world.
If `allowConflictingLocales` is set to true, locales with same language and different region can be loaded.
func GetUniqueCharsets ¶
func IsApplicable ¶
func IsApplicable(cfg *setting.Configuration, ld *data.LocaleData, str string, stripTimezone bool) bool
IsApplicable checks the specified locale data is applicable to translate the date string `str`. The `str` parameter is a string representing date and/or time in a recognizably valid format. If `stripTimezone` set to true, timezone will be stripped and ignored.
func Split ¶
func Split(ld *data.LocaleData, str string, keepFormatting bool, skippedTokens strutil.Dict) []string
Split splits the date string `str` using translations in locale data. If `keepFormatting` is set to true, it will retaing the formatting of date string.
func SplitSentence ¶
func SplitSentence(ld *data.LocaleData, str string) []string
func Translate ¶
func Translate(cfg *setting.Configuration, ld *data.LocaleData, str string, keepFormatting bool) []string
Translate the date string `str` to its English equivalent using information from the locale data. If `keepFormatting` is set to true, retain formatting of the date string after translation.
func TranslateSearch ¶
func TranslateSearch(cfg *setting.Configuration, ld *data.LocaleData, str string) ([]string, []string)
Types ¶
This section is empty.