Documentation ¶
Index ¶
- Constants
- func FormatFiat(locale language.Tag, code currency_lib.Code, amount float64, ofKin bool) (string, error)
- func GetAndroidLocalizationKey(key string) string
- func GetIosLocalizationKey(key string) string
- func GetLocalizationKeyForUserAgent(ctx context.Context, key string) string
- func LoadKeys(directory string) error
- func LoadTestKeys(kvsByLocale map[language.Tag]map[string]string)
- func Localize(locale language.Tag, key string, args ...string) (string, error)
- func LocalizeFiatWithVerb(locale language.Tag, verb chatpb.ExchangeDataContent_Verb, ...) (string, error)
- func LocalizeWithFallback(locale language.Tag, defaultValue, key string, args ...string) string
- func ResetKeys()
Constants ¶
const ( PushTitleDepositReceived = "push.title.depositReceived" PushSubtitleDepositReceived = "push.subtitle.depositReceived" PushTitleKinReturned = "push.title.kinReturned" PushSubtitleKinReturned = "push.subtitle.kinReturned" CoreOfKin = "core.ofKin" CoreKin = "core.kin" ChatTitleCashTransactions = "title.chat.cashTransactions" ChatTitleCodeTeam = "title.chat.codeTeam" ChatTitleKinPurchases = "title.chat.kinPurchases" ChatTitlePayments = "title.chat.payments" ChatMessageReferralBonus = "subtitle.chat.referralBonus" ChatMessageWelcomeBonus = "subtitle.chat.welcomeBonus" ChatMessageUsdcDeposited = "subtitle.chat.usdcDeposited" ChatMessageUsdcBeingConverted = "subtitle.chat.usdcBeingConverted" ChatMessageKinAvailableForUse = "subtitle.chat.kinAvailableForUse" VerbGave = "subtitle.youGave" VerbReceived = "subtitle.youReceived" VerbWithdrew = "subtitle.youWithdrew" VerbDeposited = "subtitle.youDeposited" VerbSent = "subtitle.youSent" VerbSpent = "subtitle.youSpent" VerbPaid = "subtitle.youPaid" VerbPurchased = "subtitle.youPurchased" VerbReturned = "subtitle.wasReturnedToYou" )
Variables ¶
This section is empty.
Functions ¶
func FormatFiat ¶ added in v1.6.0
func FormatFiat(locale language.Tag, code currency_lib.Code, amount float64, ofKin bool) (string, error)
FormatFiat formats a currency amount into a string in the provided locale
func GetAndroidLocalizationKey ¶
GetAndroidLocalizationKey gets a localization string in the Android format
func GetIosLocalizationKey ¶
GetIosLocalizationKey gets a localization string in the iOS format
func GetLocalizationKeyForUserAgent ¶
GetLocalizationKeyForUserAgent gets a localization key in the format for the device as provided in the user agent header. If an unknown device type, or the user- gent header isn't available, then the original key is returned.
func LoadKeys ¶ added in v1.6.0
LoadKeys loads localization key-value pairs from the provided directory.
todo: we'll want to improve this, but just getting something quick up to setup his localization package.
func LoadTestKeys ¶ added in v1.6.0
LoadTestKeys is a utility for injecting test localization keys
func Localize ¶ added in v1.6.0
Localize localizes a key to the corresponding string in the provided locale. An optional set of string parameters can be provided to be replaced in the string. Currenctly, these arguments must be localized outside of this function.
todo: Generic argument handling, so all localization can happen in here
func LocalizeFiatWithVerb ¶ added in v1.6.0
func LocalizeFiatWithVerb(locale language.Tag, verb chatpb.ExchangeDataContent_Verb, code currency_lib.Code, amount float64, ofKin bool) (string, error)
LocalizeFiatWithVerb is like FormatFiat, but includes a verb for the interaction with the currency amount
func LocalizeWithFallback ¶ added in v1.6.0
LocalizeWithFallback is like Localize, but returns defaultValue on error.
Types ¶
This section is empty.