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
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateUtility class, not intended for instantiation.Method Summary
Modifier and TypeMethodDescriptionstatic StringGenerates HTML select dropdown for language selection in I2PSnark standalone mode.private static booleanDetermines if advanced mode features should be enabled.
Field Details
CHECKED
Marks a form control as already selected.- See Also:
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
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:
- First attempts to match the full language+country code (e.g., "en_US")
- Falls back to language-only code (e.g., "en")
- 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