MCPcopy Create free account
hub / github.com/pace/bricks / WithLocale

Function WithLocale

locale/context.go:16–18  ·  view source on GitHub ↗

WithLocale creates a new context with the passed locale

(ctx context.Context, locale *Locale)

Source from the content-addressed store, hash-verified

14
15// WithLocale creates a new context with the passed locale
16func WithLocale(ctx context.Context, locale *Locale) context.Context {
17 return context.WithValue(ctx, tokenKey, locale)
18}
19
20// FromCtx returns the locale from the context.
21// The returned locale is always not nil.

Callers 8

mainFunction · 0.92
TestLocaleRoundTripFunction · 0.92
prepareContextFunction · 0.92
TestRun_transfersLocaleFunction · 0.92
TestStrategyWithCtxFunction · 0.85
TestContextFunction · 0.85
ServeHTTPMethod · 0.85
ContextTransferFunction · 0.85

Calls 1

WithValueMethod · 0.80

Tested by 4

TestLocaleRoundTripFunction · 0.74
TestRun_transfersLocaleFunction · 0.74
TestStrategyWithCtxFunction · 0.68
TestContextFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…