Class McpLocalizer
java.lang.Object
com.soklet.McpLocalizer
Immutable server-wide MCP localization behavior and policy.
The configured fallback locale is the language of every canonical annotation and builder string hosted by the server and the locale of canonical default text. It is independent of a provider or localization library's terminal fallback locale. The application-owned context provider performs request-specific locale selection and fallback resolution and captures one immutable translation snapshot.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classSingle-threaded builder for an immutable localizer. -
Method Summary
Modifier and TypeMethodDescriptionReturns the whole-response framework-catalog failure policy.Returns the maximum number of provider text lookups permitted while rendering one framework response.static @NonNull McpLocalizer.BuilderwithFallbackLocale(@NonNull Locale fallbackLocale, @NonNull McpLocalizationContextProvider localizationContextProvider) Vends a builder primed with the canonical non-root fallback locale and application-owned context provider.
-
Method Details
-
withFallbackLocale
public static @NonNull McpLocalizer.Builder withFallbackLocale(@NonNull Locale fallbackLocale, @NonNull McpLocalizationContextProvider localizationContextProvider) Vends a builder primed with the canonical non-root fallback locale and application-owned context provider.- Parameters:
fallbackLocale- canonical BCP 47 fallback localelocalizationContextProvider- request context provider- Returns:
- localizer builder
- Throws:
NullPointerException- if an argument is nullIllegalArgumentException- iffallbackLocaleis not a canonical, non-root BCP 47 locale of at most 255 ASCII bytes
-
getFallbackLocale
- Returns:
- configured canonical non-root fallback locale
-
getContextProvider
- Returns:
- application-owned request context provider
-
getFailurePolicy
Returns the whole-response framework-catalog failure policy. It does not authorize a synthetic context when application context creation fails.- Returns:
- framework-catalog localization failure policy
-
getMaximumLocalizableTextCountPerResponse
Returns the maximum number of provider text lookups permitted while rendering one framework response.- Returns:
- positive bounded response-local lookup limit
-