Hi,
I'm using Telerik Control now for quite some time and telerik ist doing a great job on enhancing them. I like Telerik Controls a lot! But I live in Germany so I need to have all those nice features with german texts.
To simplify this task I build a very little app. And this App I want to share here, because I see a lot of questions in this direction...
I would like to attach the Code but it is not allowed to attach .zip files here in the forum... so:
Create a WPF Solution, reference the Your telerik WPF DLLS and add the following Code and you will get all you need in the Textbox to implement in your real CustomLocalizationManager to get the Texts in your language.
MainWindow.xaml
ManiWindow.xaml.cs
MainWindowViewModel.cs
CustomLocalizationManager.cs
Have fun :-)
Markus
I'm using Telerik Control now for quite some time and telerik ist doing a great job on enhancing them. I like Telerik Controls a lot! But I live in Germany so I need to have all those nice features with german texts.
To simplify this task I build a very little app. And this App I want to share here, because I see a lot of questions in this direction...
I would like to attach the Code but it is not allowed to attach .zip files here in the forum... so:
Create a WPF Solution, reference the Your telerik WPF DLLS and add the following Code and you will get all you need in the Textbox to implement in your real CustomLocalizationManager to get the Texts in your language.
MainWindow.xaml
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*" /> <ColumnDefinition Width="1*" /> </Grid.ColumnDefinitions> <TextBox Grid.Column="1" Text="{Binding Code}" Margin="10" VerticalScrollBarVisibility="Auto"/> <StackPanel Margin="10"> <!-- TODO Put here all Telerik Controls to Localize--> <telerik:RadTreeView /> <telerik:RadGridView /> </StackPanel> </Grid>
ManiWindow.xaml.cs
public partial class MainWindow : Window { private readonly MainWindowViewModel _mainWindowViewModel; public MainWindow() { _mainWindowViewModel = new MainWindowViewModel(); LocalizationManager.Manager = new CustomLocalizationManager(_mainWindowViewModel); InitializeComponent(); DataContext = _mainWindowViewModel; } }
MainWindowViewModel.cs
public class MainWindowViewModel { public string Code { get; set; } }
CustomLocalizationManager.cs
public class CustomLocalizationManager : LocalizationManager { private readonly MainWindowViewModel _mainWindowViewModel; public CustomLocalizationManager(MainWindowViewModel mainWindowViewModel) { _mainWindowViewModel = mainWindowViewModel; } public override string GetStringOverride(string key) { var defaultText = base.GetStringOverride(key); _mainWindowViewModel.Code += GenerateCode(key, defaultText); return defaultText; } private static string GenerateCode(string key, string ret) { //TODO Change this line to get the Code you need return string.Format(" case \"{0}\": return \"{1}\";{2}", key, ret, Environment.NewLine); } }
Have fun :-)
Markus