Interface Strings

All Superinterfaces:
LocaleMatcher
All Known Implementing Classes:
DefaultStrings

public interface Strings extends LocaleMatcher
Contract for localized string providers - given a key and optional placeholders, return a localized string.

Format is "You are missing {{requiredFieldCount}} required fields."

Author:
Mark Allen
  • Method Details

    • get

      Gets a localized string for the given key.

      If no localized string is available, the key is returned.

      Parameters:
      key - the localization key, not null
      Returns:
      a localized string for the key, not null
    • get

      Gets a localized string for the given key.

      If no localized string is available, the key is returned.

      Parameters:
      key - the localization key, not null
      placeholders - the placeholders to insert into the string, may be null
      Returns:
      a localized string for the key, not null
    • withFallbackLocale

      Vends a Strings instance builder for the specified fallback locale.

       Strings strings = Strings.withFallbackLocale(Locale.forLanguageTag("en"))
       		.localizedStringSupplier(() -> LocalizedStringLoader.loadFromClasspath("strings"))
       		.localeSupplier(() -> Locale.forLanguageTag("en-GB"))
       		.build();
       
      Parameters:
      fallbackLocale - the fallback locale, not null
      Returns:
      a builder for a Strings instance, not null