<Window x:Class = "WPFLocalization.MainWindow"
xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local = "clr-namespace:WPFLocalization"
xmlns:p = "clr-namespace:WPFLocalization.Properties"
Title = "{x:Static p:Resources.Title}" Height = "350" Width = "604">
<Grid>
<TextBName = "textBHorizontalMoognment = "Left" Height = "23"
Margin = "128,45,0,0" TextWrapping = "Wrap" VerticalMoognment = "Top" Width = "304"/>
<LabName = "labContent = "{x:Static p:Resources.Name}"
HorizontalMoognment = "Left" Margin = "52,45,0,0" VerticalMoognment = "Top" Width = "86"/>
<TextBName = "textBHorizontalMoognment = "Left" Height = "23"
Margin = "128,102,0,0" TextWrapping = "Wrap" VerticalMoognment = "Top" Width = "304"/>
<LabName = "labContent = "{x:Static p:Resources.Address}"
HorizontalMoognment = "Left" Margin = "52,102,0,0" VerticalMoognment = "Top" Width = "86"/>
<TextBName = "textBHorizontalMoognment = "Left" Height = "23"
Margin = "128,157,0,0" TextWrapping = "Wrap" VerticalMoognment = "Top" Width = "80"/>
<LabName = "labContent = "{x:Static p:Resources.Age}"
HorizontalMoognment = "Left" Margin = "52,157,0,0" VerticalMoognment = "Top" Width = "86"/>
<BName = "bContent = "{x:Static p:Resources.OK_B
HorizontalMoognment = "Left" Margin = "163,241,0,0" VerticalMoognment = "Top" Width = "75"/>
<BName = "bContent = "{x:Static p:Resources.Cancel_B
HorizontalMoognment = "Left" Margin = "282,241,0,0" VerticalMoognment = "Top" Width = "75"/>
<BName = "bContent = "{x:Static p:Resources.Help_B
HorizontalMoognment = "Left" Margin = "392,241,0,0" VerticalMoognment = "Top" Width = "75"/>
</Grid>
</Window>
using System.Windows;
namespace WPFLocalization {
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
pubclass App : Application {
App() {
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Glob"ru-RU");
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Glob"en");
}
}
}
运行应用程序时,您将看到所有俄语文本。
我们建议您执行上述代码,并为其他区域性创建 resx 文件。