diff --git a/localization.go b/localization.go index 49e1815..4cf0df6 100644 --- a/localization.go +++ b/localization.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "io/ioutil" + "path" "strings" "sync" ) @@ -36,11 +37,11 @@ func (d *Dictionary) AddTranslations(directory string) error { return err } - fmt.Println(fName, path) + loc := stripFileExtension(fName) - break + fmt.Println(fName, path, loc) - loc := stripFileExtension(fName) + break var data interface{} err = json.Unmarshal(file, &data) @@ -108,5 +109,7 @@ func (d *Dictionary) parseAcceptedLanguageHeader(acceptedLanguages string) (lang } func stripFileExtension(full string) (stripped string) { - return + extension := path.Ext(full) + stripped = strings.TrimSuffix(full, extension) + return stripped }