Asper Header  1.0.14
The header injector extension
Loading...
Searching...
No Matches
messageReference.ts File Reference

Comprehensive multilingual message repository with advanced localization support. More...

Go to the source code of this file.

Variables

export const messages
 Complete message dictionary for all supported languages with type-safe function interfaces @export Exported for use by the MessageProvider system and extension components.
 
export const Record< string,(...args:any[])=> string
 

Detailed Description

Comprehensive multilingual message repository with advanced localization support.

Author
Henry Letellier
Version
1.0.10
Since
1.0.0
Date
2025-10-05

This module serves as the authoritative multilingual message repository for the entire AsperHeader extension ecosystem. It implements a sophisticated internationalization framework that provides consistent, culturally-appropriate messaging across all user interfaces, error conditions, and interactive elements while supporting dynamic parameter interpolation and context-aware message generation.

Localization Architecture

The module implements a multi-layered localization system with the following components:

Multi-Language Support

  • Complete translations for 15+ languages including English, French, Italian, Spanish, German, Japanese, Korean, Chinese (Simplified & Traditional), Russian, Portuguese, Turkish, Polish, Czech, and Hungarian
  • Standardized message key consistency across all language variants
  • Professional native speaker translations with technical domain expertise

Function-Based Message System


  • Dynamic parameter interpolation with full TypeScript type safety
  • Named parameter substitution with {paramName} syntax support
  • Automatic type conversion and locale-aware formatting
  • Security-conscious parameter escaping for HTML contexts

Cultural Adaptation Framework

  • Language-specific formatting rules and cultural considerations
  • Context-sensitive plural forms for different linguistic structures
  • Locale-appropriate number, currency, and date formatting
  • Right-to-left (RTL) language preparation for future expansion

Extensible Plugin Architecture

  • Modular design enabling seamless addition of new languages
  • Standardized message key interface for consistent expansion
  • Automated validation tools for translation completeness
  • Hot-reload capability for development and testing scenarios

Supported Language Matrix

Primary Languages (100% Coverage)

  • English (en): Primary reference language - complete message coverage with American English conventions
  • French (fr): Professional translation with French cultural adaptations and technical terminology
  • Italian (it): Complete localization with Italian conventions and technical domain expertise
  • Spanish (es): Full Spanish translation with Latin American and European Spanish considerations
  • German (de): Comprehensive German localization with technical precision and formal register

Asian Languages (Full Support)

  • Japanese (ja): Native Japanese translation with proper honorific usage and technical terminology
  • Korean (ko): Complete Korean localization with appropriate formality levels
  • Chinese Simplified (zh-cn): Mainland Chinese translation with simplified characters
  • Chinese Traditional (zh-tw): Traditional Chinese for Taiwan and Hong Kong regions

Additional European Languages

  • Russian (ru): Full Cyrillic script support with Russian technical conventions
  • Portuguese (pt-br): Brazilian Portuguese with regional adaptations
  • Turkish (tr): Complete Turkish localization with agglutinative language considerations
  • Polish (pl): Polish translation with complex grammar and case system support
  • Czech (cs): Czech localization with Slavic language characteristics
  • Hungarian (hu): Hungarian translation with unique Finno-Ugric linguistic features

Message Classification and Organization

Messages are systematically organized into functional categories for maintainability:

User Interface Messages

  • Dialog prompts and confirmation dialogs (quickPickYes, quickPickNo)
  • Button labels and interactive element text (copyAscii, zoomIn, zoomOut)
  • Input field prompts and validation messages (getHeaderDescription, getHeaderTags)
  • Menu items and command descriptions

System Operation Messages

  • File I/O operations (fileLoaded, fileParseError, fileSaveFailed)
  • Configuration management and settings validation
  • Directory and workspace management (cwdUpdated, cwdDoesNotExist)
  • Process lifecycle and state management

Header Management Messages

  • Template generation and metadata handling (headerOpenerFound, headerWriteSuccess)
  • Content creation and injection workflows (headerInjectQuestion)
  • Date and timestamp management (lastModifiedUpdated)
  • Header validation and integrity checks (brokenHeader)

Error Reporting and Diagnostics

  • Comprehensive error messages with actionable guidance
  • Input validation errors (inputboxError, quickPickError)
  • File operation failures with diagnostic information
  • System state errors and recovery suggestions

Specialized Feature Messages

  • Watermark display and management (watermarkPersonDisplayed, watermarkCopied)
  • Character showcase functionality (darlingPersonDisplayed, darlingCopied)
  • Logo randomization and display (logoDisplayed, logoChosen)
  • ASCII art handling and clipboard operations

Extension Lifecycle Messages

  • Activation and initialization (extensionActivated)
  • Deactivation and cleanup procedures
  • Status updates and operational notifications
  • Version and compatibility information

Development Support Messages

  • Debug output and diagnostic information (arrayNodeContent)
  • Development-oriented logging and tracing
  • Performance metrics and optimization data
  • Testing and validation support messages

Technical Implementation Details

Function-Based Architecture

Each message is implemented as a function to enable:

  • Dynamic parameter injection with compile-time type checking
  • Runtime parameter validation and sanitization
  • Contextual message generation based on application state
  • Deferred execution for performance optimization

TypeScript Type Safety System

  • Strongly-typed parameter interfaces ensure consistency across languages
  • Generic type parameters for flexible message function signatures
  • Compile-time validation of parameter count and types
  • Runtime type assertion for development safety

Performance Optimization Strategies

  • Lazy evaluation prevents unnecessary message generation
  • Efficient parameter handling with minimal object allocation
  • Message caching for frequently accessed strings
  • Tree-shaking support for production bundle optimization

Memory Management

  • Optimal memory usage through selective message loading
  • Garbage collection friendly implementation patterns
  • Minimal closure overhead in message functions
  • Language pack loading on demand for memory efficiency

Error Resilience Framework

  • Graceful fallback to English for missing translations
  • Runtime detection of incomplete language packs
  • Error logging for missing message keys during development
  • Automatic recovery from corrupted message data

Parameter Interpolation System

Named Parameter Substitution

  • Template syntax: {paramName} for clear parameter identification
  • Case-sensitive parameter matching with validation
  • Nested object property access support: {object.property}
  • Default value specification: {param|defaultValue}

Positional Parameter System

  • Sequential parameter replacement for simple message templates
  • Zero-indexed positional parameters: {0}, {1}, etc.
  • Mixed named and positional parameter support
  • Overflow protection for parameter count mismatches

Type Conversion and Formatting

  • Automatic type coercion for string, number, and boolean values
  • Date and time formatting with locale-aware patterns
  • Currency formatting with regional currency symbols
  • Percentage and decimal formatting with locale rules

Security-Conscious Parameter Escaping

  • HTML entity escaping for web view contexts
  • URL encoding for parameter values in URLs
  • JSON escape sequences for data serialization
  • SQL injection prevention for database contexts

Context-Sensitive Pluralization

  • Language-specific plural form rules (singular, plural, zero, few, many)
  • Cardinal and ordinal number pluralization support
  • Gender-sensitive pluralization for applicable languages
  • Custom pluralization rules for domain-specific terms

Locale-Appropriate Formatting

  • Number formatting with locale-specific separators and grouping
  • Currency display with proper symbol placement and precision
  • Date and time formatting following regional conventions
  • Unit conversion and display for measurements

Quality Assurance Process:

  • Native Speaker Review: All translations reviewed by native speakers
  • Technical Accuracy: Technical terminology validated by subject matter experts
  • Cultural Sensitivity: Messages adapted for cultural appropriateness
  • Consistency Checking: Automated validation of message key completeness
  • Context Validation: Messages tested in actual usage contexts

Integration Framework: This module provides the foundation for all user-facing text throughout:

  • Core Extension: Primary extension interfaces and workflows
  • Configuration System: Settings descriptions and validation messages
  • Interactive Features: Webview content and user interaction prompts
  • Error Handling: Comprehensive error reporting and diagnostic messages
  • Development Tools: Debug output and development-oriented information

Definition in file messageReference.ts.

Variable Documentation

◆ messages

export const messages

Complete message dictionary for all supported languages with type-safe function interfaces @export Exported for use by the MessageProvider system and extension components.

Central repository of all localized messages used throughout the AsperHeader extension. Each language is represented as a nested object where message keys map to functions that generate the appropriate localized string. The function-based architecture enables sophisticated localization features while maintaining type safety and performance.

Function-Based Message Architecture

Function-based messages provide several key advantages:

  • Dynamic Parameter Interpolation: Contextual information injection at runtime
  • Type-Safe Parameter Passing: Full TypeScript type checking and IntelliSense support
  • Consistent Message Formatting: Uniform parameter handling across all languages
  • Runtime Message Generation: Complex conditional and contextual message creation
  • Performance Optimization: Lazy evaluation and parameter validation

Comprehensive Language Support

Primary Languages (100% Coverage)

  • en: English (primary) - Complete reference implementation with American English conventions
  • fr: French - Professional translation with French linguistic and cultural adaptations
  • it: Italian - Complete Italian localization with proper grammatical structures
  • es: Spanish - Full Spanish translation covering Latin American and European variants
  • de: German - Comprehensive German localization with technical precision

Extended Global Language Support

  • ja: Japanese - Native Japanese with proper honorifics and technical terminology
  • ko: Korean - Complete Korean with appropriate formality levels
  • zh-cn: Chinese Simplified - Mainland Chinese with simplified character set
  • zh-tw: Chinese Traditional - Traditional Chinese for Taiwan/Hong Kong regions
  • ru: Russian - Full Cyrillic support with Russian technical conventions
  • pt-br: Brazilian Portuguese - Regional Brazilian adaptations
  • tr: Turkish - Turkish localization with agglutinative language considerations
  • pl: Polish - Polish with complex grammar and case system support
  • cs: Czech - Czech localization with Slavic linguistic characteristics
  • hu: Hungarian - Hungarian with unique Finno-Ugric language features

Usage Patterns and Examples

// Basic parameter interpolation
messages.en.fileLoaded("/path/to/file") // "File /path/to/file loaded!"
messages.fr.fileLoaded("/chemin/vers/fichier") // "Fichier /chemin/vers/fichier chargé !"
// Complex multi-parameter messages
messages.en.sayHelloWorldResponse(".ts", "main.ts", "/src/main.ts", "typescript")
// "Hello world! This file's extension is: .ts, it's name is: main.ts..."
// Error handling with contextual information
messages.en.fileParseError("/invalid.json", "SyntaxError: Unexpected token")
// "The file content (/invalid.json) could not be loaded successfully. Error: SyntaxError..."

Functional Message Categories

Messages are systematically organized into the following categories:

Input/Output Operations

  • File loading, saving, and parsing operations (fileLoaded, fileParseError, fileSaveFailed)
  • Directory and workspace management (cwdUpdated, filePathUpdated)
  • Configuration file handling and validation

User Interface Interactions

  • Dialog prompts and confirmations (quickPickYes, quickPickNo, headerInjectQuestion)
  • Input field labels and validation messages (getHeaderDescription, getHeaderTags)
  • Button labels and interactive element text (copyAscii, zoomIn, zoomOut)

Header Management Operations

  • Header creation, updating, and validation (headerOpenerFound, headerWriteSuccess)
  • Template injection and refresh workflows (headerInjectQuestion, lastModifiedUpdated)
  • Metadata extraction and timestamp management (updatingEditionDate)

Specialized Feature Operations

  • Watermark display and clipboard operations (watermarkPersonDisplayed, watermarkCopied)
  • Character showcase functionality (darlingPersonDisplayed, darlingCopied)
  • Logo randomization and display management (logoDisplayed, logoChosen)
  • ASCII art processing and user interactions

Error Handling and Diagnostics

  • File operation errors with actionable guidance (fileSaveFailed, fileParseError)
  • Input validation failures (inputboxError, quickPickError)
  • System state errors and recovery procedures (closedDocument, emptyDocument)
  • Language and configuration detection failures (languageNotFound, missingFileError)

Extension Lifecycle Management

  • Activation and initialization notifications (extensionActivated, helloWorldGreetingsCommand)
  • Status updates and operational feedback (messageWritten, extensionActivated)
  • Resource management and cleanup procedures

Development and Debugging Support

  • Debug output and diagnostic information (arrayNodeContent, inputArgs)
  • Performance monitoring and optimization data
  • Development-time logging and error tracking (errorDuringFunctionCall)

Type Safety Contract

Note
All message functions must maintain consistent parameter signatures across languages
Parameter types should be explicitly defined in TypeScript for compile-time validation
Runtime parameter validation should be implemented for production safety

Fallback and Error Handling

Note
Missing translations automatically fall back to English through the MessageProvider system
Undefined message keys return a standardized error message with the missing key identifier
Language pack validation occurs during extension initialization for early error detection
Version
1.0.14
Since
1.0.0
See also
MessageProvider For the primary interface to access these messages
Logger For integration with the extension's logging system
Examples
Message.

Definition at line 332 of file messageReference.ts.

◆ string

export const Record<string, (...args: any[]) => string
Examples
Message.

Definition at line 332 of file messageReference.ts.