Package com.veeva.vault.sdk.api.localization
package com.veeva.vault.sdk.api.localization
This package provides interfaces to format locale-aware dates, numbers, and currencies
consistent with Vault locale settings.
Learn more about localization in Vault Help.
Format a List of Numbers
The following example formats a List of numbers using the German locale:
LocalizationService localizationService = ServiceLocator.locate(LocalizationService.class);
LocalizedDisplayRequest request = localizationService.newLocalizedDisplayRequestBuilder()
.withLocaleCode("de_DE")
.withBaseValues(ValueType.NUMBER, VaultCollections.asList(new BigDecimal("1234.50"), new BigDecimal("9876.00")))
.build();
List<String> formatted = localizationService.getLocalizedDisplay(request).getFormattedValues();
// formatted: ["1.234,50", "9.876,00"]
Format a List of Percentages
The following example formats a List of fractional values as percentages:
LocalizationService localizationService = ServiceLocator.locate(LocalizationService.class);
LocalizedDisplayRequest request = localizationService.newLocalizedDisplayRequestBuilder()
.withLocaleCode("en_US")
.withBaseValues(ValueType.NUMBER, VaultCollections.asList(new BigDecimal("0.5"), new BigDecimal("0.25")))
.withNumberFormatStyle(NumberFormatStyle.PERCENTAGE)
.build();
List<String> formatted = localizationService.getLocalizedDisplay(request).getFormattedValues();
// formatted: ["50%", "25%"]
Format a DateTime in a Specific Timezone
The following example formats a ZonedDateTime for display in a specific timezone, using a value from thetimezone__sys picklist. The instant is taken from the ZonedDateTime and displayed in the
given timezone, and the same timezone applies to every value in the request:
LocalizationService localizationService = ServiceLocator.locate(LocalizationService.class);
ZonedDateTime dateTime = ZonedDateTime.parse("2025-06-01T12:00:00Z");
LocalizedDisplayRequest request = localizationService.newLocalizedDisplayRequestBuilder()
.withLocaleCode("en_US")
.withBaseValues(ValueType.DATETIME, VaultCollections.asList(dateTime))
.withTimeZone("america_new_york__sys")
.build();
String formatted = localizationService.getLocalizedDisplay(request).getFormattedValues().get(0);
// 12:00 UTC displayed in America/New_York (EDT):
// formatted: "01 Jun 2025 8:00 AM EDT" (Alphanumeric), "6/1/2025 8:00 AM EDT" (Numeric),
// or "2025-06-01 8:00 AM EDT" (ISO 8601) — variation determined by the Vault DateTime format setting
-
ClassDescriptionProvides methods to format values and retrieve locale settings according to Vault locale configuration.Provides methods to retrieve information about a localized display formatting request.Builds a
LocalizedDisplayRequest.Provides methods to retrieve locale-formatted display values.Display styles supported byLocalizationServicewhen formatting values ofValueType.NUMBER.