Commit af494b4
feat: integrate Lingua i18n framework from source (self-implemented) (#86)
Re-implement the Irihi.Lingua public API surface to avoid NuGet source generator
issues in debug mode. The implementation matches the Lingua 0.2.0 contract:
Core types (Irihi.Lingua namespace):
- LinguaKey — strongly-typed key + manager pair for XAML bindings
- ILinguaManager — interface for culture switching + observable access
- LinguaManagerAttribute — marks a partial class as a language manager
- LinguaObservableString — behaviour-subject observable with replay
- LinguaRuntimeResources — culture hierarchy resource resolution
- LanguageManager — abstract base class for concrete managers
Avalonia markup extensions:
- TranslateExtension — {Translate Key} for reactive XAML text binding
- FormatTranslateExtension — {FormatTranslate} with format strings + args
- TranslateEntry + FormatTranslateConverter — format argument entries
App integration:
- AppLanguageManager — concrete manager loading from LocalizationService JSONs
- Exposes strongly-typed IObservable<string?> properties for common keys
- Keys nested class with static LinguaKey fields (mirrors source gen output)
- XmlnsDefinition registered so {Translate} works without xmlns import
- Culture switching syncs both legacy LocalizationService + Lingua observables
Demo: MainWindow title uses {Translate AppLanguageManager+Keys.App_Title}
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent f74c67b commit af494b4
0 file changed
0 commit comments