MCPcopy Index your code
hub / github.com/apache/answer / TrWithData

Function TrWithData

internal/base/translator/provider.go:156–165  ·  view source on GitHub ↗

TrWithData translate key with template data, it will replace the template data {{ .PlaceHolder }} in the translation.

(lang i18n.Language, key string, templateData any)

Source from the content-addressed store, hash-verified

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 {
157 if GlobalTrans == nil {
158 return key
159 }
160 translation := GlobalTrans.TrWithData(lang, key, templateData)
161 if translation == key {
162 return GlobalTrans.TrWithData(i18n.DefaultLanguage, key, templateData)
163 }
164 return translation
165}
166
167// reportTranslatorFormatError re-parses the YAML file to locate the invalid entry
168// when go-i18n fails to add the translator.

Callers 15

TranslateWithDataFunction · 0.92
VoteUpMethod · 0.92
VoteDownMethod · 0.92
AddQuestionMethod · 0.92
UpdateQuestionMethod · 0.92
ImportQuestionMethod · 0.92
convertToReactionRespMethod · 0.92
ListPagedMethod · 0.92
GetBadgeInfoMethod · 0.92
RegisterTemplateMethod · 0.92
PassResetTemplateMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected