Extracting i18n functionality to i18n core library (#16914)

* extracting i18n functionality to i18n core library

* Removing utils.T

* Adding documentation and changing one function name for better explanation

* Changing other missing utils.T

* Adding license string

* Renaming corelibs to pkg

* Renaming corelibs to pkg (moving directory)

* Renaming from pkg to shared

* Fixing bodyPage.Html casing

* Fixing merges

* Fixing merge problem

* Fixing tests
Этот коммит содержится в:
Jesús Espino
2021-02-26 08:12:49 +01:00
коммит произвёл GitHub
родитель 85293fcf41
Коммит 5dd2e75c10
90 изменённых файлов: 596 добавлений и 568 удалений

Просмотреть файл

@@ -35,8 +35,8 @@ import (
"github.com/mattermost/mattermost-server/v5/einterfaces"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/shared/i18n"
"github.com/mattermost/mattermost-server/v5/store"
"github.com/mattermost/mattermost-server/v5/utils"
)
type migrationDirection string
@@ -1322,7 +1322,7 @@ func (me mattermConverter) FromDb(target interface{}) (gorp.CustomScanner, bool)
binder := func(holder, target interface{}) error {
s, ok := holder.(*string)
if !ok {
return errors.New(utils.T("store.sql.convert_string_map"))
return errors.New(i18n.T("store.sql.convert_string_map"))
}
b := []byte(*s)
return json.Unmarshal(b, target)
@@ -1332,7 +1332,7 @@ func (me mattermConverter) FromDb(target interface{}) (gorp.CustomScanner, bool)
binder := func(holder, target interface{}) error {
s, ok := holder.(*string)
if !ok {
return errors.New(utils.T("store.sql.convert_string_map"))
return errors.New(i18n.T("store.sql.convert_string_map"))
}
b := []byte(*s)
return json.Unmarshal(b, target)
@@ -1342,7 +1342,7 @@ func (me mattermConverter) FromDb(target interface{}) (gorp.CustomScanner, bool)
binder := func(holder, target interface{}) error {
s, ok := holder.(*string)
if !ok {
return errors.New(utils.T("store.sql.convert_string_array"))
return errors.New(i18n.T("store.sql.convert_string_array"))
}
b := []byte(*s)
return json.Unmarshal(b, target)
@@ -1352,7 +1352,7 @@ func (me mattermConverter) FromDb(target interface{}) (gorp.CustomScanner, bool)
binder := func(holder, target interface{}) error {
s, ok := holder.(*string)
if !ok {
return errors.New(utils.T("store.sql.convert_string_interface"))
return errors.New(i18n.T("store.sql.convert_string_interface"))
}
b := []byte(*s)
return json.Unmarshal(b, target)
@@ -1362,7 +1362,7 @@ func (me mattermConverter) FromDb(target interface{}) (gorp.CustomScanner, bool)
binder := func(holder, target interface{}) error {
s, ok := holder.(*string)
if !ok {
return errors.New(utils.T("store.sql.convert_string_interface"))
return errors.New(i18n.T("store.sql.convert_string_interface"))
}
b := []byte(*s)
return json.Unmarshal(b, target)