Browse Source

update module to own version

master
Josef Fröhle 1 year ago
parent
commit
c8ac87a60c
1 changed files with 11 additions and 16 deletions
  1. +11
    -16
      locale.go

+ 11
- 16
locale.go View File

@@ -71,49 +71,44 @@ func NewLocale(p, l string) *Locale {
}
}

//SetLang ...
func (l *Locale) SetLang(lang string) {
l.lang = lang
}

//GetLang ...
func (l *Locale) GetLang() string {
return l.lang
}

//SetPath ...
func (l *Locale) SetPath(path string) {
l.path = path
}

func (l *Locale) findExt(dom, ext string) string {
filename := filepath.Join(l.path, l.lang, "LC_MESSAGES", dom+"."+ext)
_, err := os.Stat(filename)
if err == nil {
if _, err := os.Stat(filename); err == nil {
return filename
} else {
println(err)
}

if len(l.lang) > 2 {
filename = filepath.Join(l.path, l.lang[:2], "LC_MESSAGES", dom+"."+ext)
_, err = os.Stat(filename)
if err == nil {
if _, err := os.Stat(filename); err == nil {
return filename
} else {
println(err)
}
}

filename = filepath.Join(l.path, l.lang, dom+"."+ext)
_, err = os.Stat(filename)
if err == nil {
if _, err := os.Stat(filename); err == nil {
return filename
} else {
println(err)
}

if len(l.lang) > 2 {
filename = filepath.Join(l.path, l.lang[:2], dom+"."+ext)
_, err = os.Stat(filename)
if err == nil {
if _, err := os.Stat(filename); err == nil {
return filename
}
} else {
println(err)
}

return ""


Loading…
Cancel
Save