diff options
author | Elias Nahum <nahumhbl@gmail.com> | 2016-01-25 00:49:19 -0300 |
---|---|---|
committer | Elias Nahum <nahumhbl@gmail.com> | 2016-01-25 00:57:16 -0300 |
commit | 7b3be6c77e622dedab0b8d8c1d5fd0e7aa76de46 (patch) | |
tree | 77dc7737757fa0623fa0171dbe6a3f854b53266c /utils/config.go | |
parent | e880835fbbeea4c26fc9a94b1b0a92f7692b0b82 (diff) | |
download | chat-7b3be6c77e622dedab0b8d8c1d5fd0e7aa76de46.tar.gz chat-7b3be6c77e622dedab0b8d8c1d5fd0e7aa76de46.tar.bz2 chat-7b3be6c77e622dedab0b8d8c1d5fd0e7aa76de46.zip |
PLT-7: Refactoring manuatesting & utils to use translations (chunk 5)
- Add spanish translations
- Skip tests
Diffstat (limited to 'utils/config.go')
-rw-r--r-- | utils/config.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/utils/config.go b/utils/config.go index c2ae1f7a0..9d2c2f588 100644 --- a/utils/config.go +++ b/utils/config.go @@ -118,12 +118,14 @@ func GetLogFileLocation(fileLocation string) string { func SaveConfig(fileName string, config *model.Config) *model.AppError { b, err := json.MarshalIndent(config, "", " ") if err != nil { - return model.NewAppError("SaveConfig", "An error occurred while saving the file to "+fileName, err.Error()) + return model.NewLocAppError("SaveConfig", "utils.config.save_config.saving.app_error", + map[string]interface{}{"Filename": fileName}, err.Error()) } err = ioutil.WriteFile(fileName, b, 0644) if err != nil { - return model.NewAppError("SaveConfig", "An error occurred while saving the file to "+fileName, err.Error()) + return model.NewLocAppError("SaveConfig", "utils.config.save_config.saving.app_error", + map[string]interface{}{"Filename": fileName}, err.Error()) } return nil @@ -138,18 +140,21 @@ func LoadConfig(fileName string) { file, err := os.Open(fileName) if err != nil { - panic("Error opening config file=" + fileName + ", err=" + err.Error()) + panic(T("utils.config.load_config.opening.panic", + map[string]interface{}{"Filename": fileName, "Error": err.Error()})) } decoder := json.NewDecoder(file) config := model.Config{} err = decoder.Decode(&config) if err != nil { - panic("Error decoding config file=" + fileName + ", err=" + err.Error()) + panic(T("utils.config.load_config.decoding.panic", + map[string]interface{}{"Filename": fileName, "Error": err.Error()})) } if info, err := file.Stat(); err != nil { - panic("Error getting config info file=" + fileName + ", err=" + err.Error()) + panic(T("utils.config.load_config.getting.panic", + map[string]interface{}{"Filename": fileName, "Error": err.Error()})) } else { CfgLastModified = info.ModTime().Unix() CfgFileName = fileName @@ -158,7 +163,8 @@ func LoadConfig(fileName string) { config.SetDefaults() if err := config.IsValid(); err != nil { - panic("Error validating config file=" + fileName + ", err=" + err.Message) + panic(T("utils.config.load_config.validating.panic", + map[string]interface{}{"Filename": fileName, "Error": err.Message})) } configureLog(&config.LogSettings) |