This guide covers migrating an existing Avalonia, WPF, .NET MAUI, WinUI, or Uno application to ProTranslate. The recommended migration is incremental: introduce the core services first, migrate low-risk labels, then move dynamic formatting and settings screens.
Identify:
.resx resources.IStringLocalizer usage.ResourceManager.GetString calls.Keep the current resource store at first. ProTranslate can sit in front of it through a provider.
Shared project:
<PackageReference Include="ProTranslate.Abstractions" Version="0.1.0" />
<PackageReference Include="ProTranslate.Core" Version="0.1.0" />
ResourceManager workflow:
<PackageReference Include="ProTranslate.ResourceManager" Version="0.1.0" />
Microsoft.Extensions workflow:
<PackageReference Include="ProTranslate.MicrosoftExtensions" Version="0.1.0" />
Application project:
<PackageReference Include="ProTranslate.Avalonia" Version="0.1.0" />
Use the matching adapter package for WPF, MAUI, WinUI, or Uno.
With dependency injection:
services.AddProTranslate(culture: CultureInfo.GetCultureInfo("en-US"));
Without dependency injection:
var cultures = new CultureService(CultureInfo.GetCultureInfo("en-US"));
var provider = new InMemoryTranslationProvider()
.Add(CultureInfo.GetCultureInfo("en-US"), "Shell.Title", "Dashboard");
var translations = new TranslationService(provider, cultures);
Then connect the adapter bridge:
ProTranslate.Avalonia.TranslationService.UseService(translations, cultures);
Use the corresponding adapter namespace for WPF, MAUI, WinUI, or Uno.
Before:
<TextBlock Text="Orders" />
After in Avalonia or WPF with prefix-free namespace support:
<TextBlock Text="{Translate Orders.Title}" />
After in portable explicit syntax:
<TextBlock xmlns:pt="https://github.com/protranslate/xaml"
Text="{pt:Translate Orders.Title}" />
WinUI:
<TextBlock xmlns:pt="using:ProTranslate.WinUI"
Text="{pt:Translate Orders.Title}" />
Start with read-only labels, headers, menu text, and empty-state copy.
Move simple formatting to ITranslationService.Format:
public string TotalDisplay => _translations.Format("Orders.Total", Total);
Use adapter Format only where the target framework supports the binding pattern cleanly. Avalonia, WPF, and MAUI have stronger multi-binding support than WinUI and Uno. For WinUI and Uno, prefer x:Bind or view-model properties for dynamic formatted values.
Before migrating every view, introduce one application-level culture command:
public void UseCulture(string cultureName)
{
_cultures.SetCulture(cultureName);
}
Then validate:
Use IGlobalizationService when UI depends on region or measurement preferences:
globalization.SetRegionOverride(new RegionInfo("GB"));
globalization.SetMeasurementSystemOverride(MeasurementSystem.Metric);
Use IUnitConversionService and ILocalizedUnitFormatter for values that must follow user unit preferences:
string distance = globalization.FormatMeasurementForProfile(
42.2,
MeasurementUnit.Kilometer,
"N1");
Add a catalog file:
<ItemGroup>
<AdditionalFiles Include="Localization/Strings.en-US.json" />
<AdditionalFiles Include="Localization/App.protranslate.keys.txt" />
</ItemGroup>
Use generated keys in view models:
using ProTranslate.Generated;
public string Title => _translations.Value_ShellTitle();
Generated keys reduce typo risk and give compiled binding and x:Bind scenarios a stable path.
Avalonia:
WPF:
Translation.Culture also updates culture-related native state such as XmlLanguage.MAUI:
xmlns:pt="https://github.com/protranslate/xaml".WinUI:
xmlns:pt="using:ProTranslate.WinUI".x:Bind or view-model properties for dynamic formatted values.Uno:
xmlns:pt="using:ProTranslate.Uno" for WinUI-compatible syntax.Translate or T.Format or view-model properties.ProTranslate.Analyzers is enabled for static key and catalog validation.CultureServiceOptions when tests or hosts require thread-culture isolation.The deeper working migration guide remains in docs/spec/migration-guide.md.