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 удалений

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

@@ -16,6 +16,7 @@ import (
"unicode/utf8"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/shared/i18n"
)
func CheckOrigin(r *http.Request, allowedOrigins string) bool {
@@ -121,9 +122,9 @@ func RenderMobileAuthComplete(w http.ResponseWriter, redirectURL string) {
<div class="icon text-success" style="font-size: 4em">
<i class="fa fa-check-circle" title="Success Icon"></i>
</div>
<h2> `+T("api.oauth.auth_complete")+` </h2>
<p id="redirecting-message"> `+T("api.oauth.redirecting_back")+` </p>
<p id="close-tab-message" style="display: none"> `+T("api.oauth.close_browser")+` </p>
<h2> `+i18n.T("api.oauth.auth_complete")+` </h2>
<p id="redirecting-message"> `+i18n.T("api.oauth.redirecting_back")+` </p>
<p id="close-tab-message" style="display: none"> `+i18n.T("api.oauth.close_browser")+` </p>
<noscript><meta http-equiv="refresh" content="2; url=`+template.HTMLEscapeString(redirectURL)+`"></noscript>
<script>
window.onload = function() {
@@ -142,10 +143,10 @@ func RenderMobileError(config *model.Config, w http.ResponseWriter, err *model.A
<div class="icon" style="color: #ccc; font-size: 4em">
<span class="fa fa-warning"></span>
</div>
<h2> `+T("error")+` </h2>
<h2> `+i18n.T("error")+` </h2>
<p> `+err.Message+` </p>
<a href="`+redirectURL+`">
`+T("api.back_to_app", map[string]interface{}{"SiteName": config.TeamSettings.SiteName})+`
`+i18n.T("api.back_to_app", map[string]interface{}{"SiteName": config.TeamSettings.SiteName})+`
</a>
`)
}