1package tui
2
3import "github.com/floatpane/matcha/i18n"
4
5// t translates a message key to the current language.
6// Example: t("composer.title") -> "Compose New Email"
7func t(key string) string {
8 return i18n.GetManager().T(key)
9}
10
11// tn translates a message with plural support.
12// Example: tn("inbox.emails", 5, nil) -> "5 emails"
13func tn(key string, count int, data map[string]interface{}) string {
14 return i18n.GetManager().Tn(key, count, data)
15}
16
17// tpl translates a message and applies template variables.
18// Example: tpl("welcome.message", map[string]interface{}{"name": "John"}) -> "Welcome, John!"
19func tpl(key string, data map[string]interface{}) string {
20 return i18n.GetManager().Tpl(key, data)
21}
22
23// tfs formats a file size using the active UI locale.
24// Example: tfs(1258291) -> "1.2 MB" in English.
25func tfs(bytes int64) string {
26 return i18n.GetManager().GetNumberFormatter().FormatFileSize(bytes)
27}