XCTLocalizationDemo
Localization demo using Xamarin.CommunityToolkit
Install / Use
/learn @maxkoshevoi/XCTLocalizationDemoREADME
XCTLocalizationDemo
App localization demo using Xamarin.CommunityToolkit
Useful links
- Video demonstration of this app: https://www.youtube.com/watch?v=wyKKa09z9VQ
- More info on Xamarin app localization: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/localization/text
- Great extension to manage resx-based resources: https://marketplace.visualstudio.com/items?itemName=TomEnglert.ResXManager
How to use XCT localization?
- In
App.xaml.cs
- Initialize
LocalizationResourceManagerwith your resouce manager and optionally initial culture; - Subscribe to
PropertyChangedto ensure that culture forAppResourcesis updated whenLocalizationResourceManager.Current.CurrentCultureis updated.
LocalizationResourceManager.Current.PropertyChanged += (_, _) => AppResources.Culture = LocalizationResourceManager.Current.CurrentCulture;
LocalizationResourceManager.Current.Init(AppResources.ResourceManager, initialCulture);
- For static strings that use
xct:Translate.
<ContentPage Title="{xct:Translate AppName}">
- For dynamily generated strings use
LocalizedString(currently in preview).
public LocalizedString AppVersion { get; } = new(() => string.Format(AppResources.Version, AppInfo.VersionString));
<Label Text="{Binding AppVersion.Localized}"/>
- That's it. Now just do this when you need to change current culture:
LocalizationResourceManager.Current.CurrrentCulture = newCulture;
And after that every resource string in the program will be automatically updated.
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
