java.lang.Object
org.klomp.snark.standalone.ConfigUIHelper

public class ConfigUIHelperextends Object
Configuration helper for I2PSnark standalone application user interface.

This class provides language selection functionality for the I2PSnark web interface when running in standalone mode (with its own app context). It is a simplified version of the router console's ConfigUIHelper, adapted specifically for I2PSnark's needs.

Key features:

  • Generates HTML select dropdown for language selection
  • Supports ISO 639-1 and ISO 639-2 language codes
  • Performs intelligent language matching with fallback logic
  • Uses I2PSnark-specific message bundles for translations

Note: This is a standalone-only helper that does not extend HelperBase and uses static methods since I2PSnark runs with its own application context separate from the main router console.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String
    Marks a form control as already selected.
    private static final String[][]
    Each language has the ISO code, the flag, the name, and the optional country name.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Utility class, not intended for instantiation.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Generates HTML select dropdown for language selection in I2PSnark standalone mode.
    private static boolean
    Determines if advanced mode features should be enabled.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CHECKED

      private static final String CHECKED
      Marks a form control as already selected.
      See Also:
    • langs

      private static final String[][] langs
      Each language has the ISO code, the flag, the name, and the optional country name. Alphabetical by the English language name please (not by the ISO code). See http://en.wikipedia.org/wiki/ISO_639-1 . Any language-specific flag added to the icon set must be added to the top-level build.xml for the updater. As of 0.9.12, ISO 639-2 three-letter codes are supported also.

      Country flag unused.

  • Constructor Details

    • ConfigUIHelper

      private ConfigUIHelper()
      Utility class, not intended for instantiation.
  • Method Details

    • getLangSettings

      public static String getLangSettings(I2PAppContext ctx)
      Generates HTML select dropdown for language selection in I2PSnark standalone mode.

      Creates a <select> element containing all available languages with their display names. The current language is pre-selected based on the I2P app context configuration. Unlike the router console version, this generates a dropdown rather than radio buttons with flags.

      Performs intelligent language matching:

      1. First attempts to match the full language+country code (e.g., "en_US")
      2. Falls back to language-only code (e.g., "en")
      3. Defaults to English if no match is found

      The "Debug: Find untagged strings" option is hidden unless advanced mode is enabled.

      Parameters:
      ctx - the I2P application context for retrieving current language settings
      Returns:
      HTML string containing a complete language selection dropdown
    • isAdvanced

      private static boolean isAdvanced()
      Determines if advanced mode features should be enabled.

      Currently hardcoded to return false, meaning advanced features like the "Debug: Find untagged strings" language option are hidden. This method exists for future extensibility if advanced mode detection is needed for I2PSnark standalone.

      Returns:
      true if advanced features should be shown, false otherwise