localization

package
v1.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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

func GetAndroidLocalizationKey(key string) string

GetAndroidLocalizationKey gets a localization string in the Android format

func GetIosLocalizationKey

func GetIosLocalizationKey(key string) string

GetIosLocalizationKey gets a localization string in the iOS format

func GetLocalizationKeyForUserAgent

func GetLocalizationKeyForUserAgent(ctx context.Context, key string) string

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

func LoadKeys(directory string) error

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

func LoadTestKeys(kvsByLocale map[language.Tag]map[string]string)

LoadTestKeys is a utility for injecting test localization keys

func Localize added in v1.6.0

func Localize(locale language.Tag, key string, args ...string) (string, error)

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

func LocalizeWithFallback(locale language.Tag, defaultValue, key string, args ...string) string

LocalizeWithFallback is like Localize, but returns defaultValue on error.

func ResetKeys added in v1.6.0

func ResetKeys()

ResetKeys resets localization to an empty mapping

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL