T translates a string, possibly substituting arguments into it along the way. If len(args) is > 0, args1 is assumed to be the plural value and plural translation is used.
(defaultValue string, args ...int)
| 200 | // the way. If len(args) is > 0, args1 is assumed to be the plural value |
| 201 | // and plural translation is used. |
| 202 | func T(defaultValue string, args ...int) string { |
| 203 | lazyLoadTranslations() |
| 204 | if len(args) == 0 { |
| 205 | return gettext.PGettext("", defaultValue) |
| 206 | } |
| 207 | return fmt.Sprintf(gettext.PNGettext("", defaultValue, defaultValue+".plural", args[0]), |
| 208 | args[0]) |
| 209 | } |
| 210 | |
| 211 | // Errorf produces an error with a translated error string. |
| 212 | // Substitution is performed via the `T` function above, following |