func loadLanguages(languages ...language.Tag) error {
	if translator.bundle == nil {
		return fmt.Errorf("please call Setup function first")
	}

	var exit bool
	for _, lang := range languages {
		exit = false
		for _, langString := range translator.addedLanguages {
			if lang.String() == langString {
				exit = true
			}
		}
		if !exit {
			translator.addedLanguages = append(translator.addedLanguages, lang.String())
			var err error = nil
			var atLeastOneExists bool = false
			for _, format := range supportedFormats {
				_, e := translator.bundle.LoadMessageFile(fmt.Sprintf(path+fileFormat, lang.String(), format))
				if atLeastOneExists {
					err = nil
				} else if e == nil {
					atLeastOneExists = true
				} else {
					err = e
				}

			}
			if err != nil {
				return fmt.Errorf("'%s' language has no file to read, create one like "+fileFormat+" in %s\n\t\t     supported formats: %s", lang.String(), lang.String(), "json", path, supportedFormats)
			}
		}
	}
	loadLocalizers()

	return nil
}
// Loads translation files and if no file for language determined
// in specified address in `address` variable, return error
//
// Also appends new languages to addedLanguages variable
//
// After that it calls loadLocalizers to create localizers for translation
// to different languages
//
// You can get your language Tag with using "golang.org/x/text/language"
// library like: language.English
Loads translation files and if no file for language determined
in specified address in `address` variable, return error

Also appends new languages to addedLanguages variable

After that it calls loadLocalizers to create localizers for translation
to different languages

You can get your language Tag with using "golang.org/x/text/language"
library like: language.English
// Loads translation files and if no file for language determined // in specified address in ` address ` variable return error // // Also appends new languages to addedLanguages variable // // After that it calls loadLocalizers to create localizers for translation // to different languages // // You can get your language Tag with using " golang . org / x / text / language " // library like : language . English
func loadLanguages(languages ...language.Tag) error {
	if translator.bundle == nil {
		return fmt.Errorf("please call Setup function first")
	}
	var exit bool
	for _, lang := range languages {
		exit = false
		for _, langString := range translator.addedLanguages {
			if lang.String() == langString {
				exit = true
			}
		}
		if !exit {
			translator.addedLanguages = append(translator.addedLanguages, lang.String())
			var err error = nil
			var atLeastOneExists bool = false
			for _, format := range supportedFormats {
				_, e := translator.bundle.LoadMessageFile(fmt.Sprintf(path+fileFormat, lang.String(), format))
				if atLeastOneExists {
					err = nil
				} else if e == nil {
					atLeastOneExists = true
				} else {
					err = e
				}
			}
			if err != nil {
				return fmt.Errorf("'%s' language has no file to read, create one like "+fileFormat+" in %s\n\t\t     supported formats: %s", lang.String(), lang.String(), "json", path, supportedFormats)
			}
		}
	}
	loadLocalizers()
	return nil
}
func loadLanguages ( languages ... language . Tag ) error { if translator . bundle == nil { return fmt . Errorf ( " " ) } var exit bool for _ , lang := range languages { exit = false for _ , langString := range translator . addedLanguages { if lang . String ( ) == langString { exit = true } } if ! exit { translator . addedLanguages = append ( translator . addedLanguages , lang . String ( ) ) var err error = nil var atLeastOneExists bool = false for _ , format := range supportedFormats { _ , e := translator . bundle . LoadMessageFile ( fmt . Sprintf ( path + fileFormat , lang . String ( ) , format ) ) if atLeastOneExists { err = nil } else if e == nil { atLeastOneExists = true } else { err = e } } if err != nil { return fmt . Errorf ( " " + fileFormat + " \n \t \t " , lang . String ( ) , lang . String ( ) , " " , path , supportedFormats ) } } } loadLocalizers ( ) return nil }
Loads translation files and if no file for language determined
in specified address in `address` variable, return error
Loads translation files and if no file for language determined in specified address in ` address ` variable return error