MCPcopy
hub / github.com/apache/answer / Tr

Function Tr

internal/base/translator/provider.go:144–153  ·  view source on GitHub ↗

Tr use language to translate data. If this language translation is not available, return default english translation.

(lang i18n.Language, data string)

Source from the content-addressed store, hash-verified

142
143// Tr use language to translate data. If this language translation is not available, return default english translation.
144func Tr(lang i18n.Language, data string) string {
145 if GlobalTrans == nil {
146 return data
147 }
148 translation := GlobalTrans.Tr(lang, data)
149 if translation == data {
150 return GlobalTrans.Tr(i18n.DefaultLanguage, data)
151 }
152 return translation
153}
154
155// TrWithData translate key with template data, it will replace the template data {{ .PlaceHolder }} in the translation.
156func TrWithData(lang i18n.Language, key string, templateData any) string {

Callers 15

TranslateFunction · 0.92
EditUserProfileMethod · 0.92
AddCommentMethod · 0.92
RemoveCommentMethod · 0.92
UpdateCommentMethod · 0.92
SearchMethod · 0.92
VoteUpMethod · 0.92
VoteDownMethod · 0.92
RemoveQuestionMethod · 0.92
AddQuestionMethod · 0.92
AddQuestionByAnswerMethod · 0.92
UpdateQuestionMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected