Multi-language and translation
I read the "Is it possible use korean language?" topic and I was thinking a little.
Can I translate text with NoesisGUI? ( Like Qt or CEGUI )
Can I translate text with NoesisGUI? ( Like Qt or CEGUI )
Re: Multi-language and translation
what do you mean by "translating text" ? multilingual support?
Re: Multi-language and translation
yes.
I add text in english, french etc. with editor (like QtLingiust), after that when I am change the language from english to french, then all text switch to french equivalent.
I add text in english, french etc. with editor (like QtLingiust), after that when I am change the language from english to french, then all text switch to french equivalent.
-
sfernandez
Site Admin
- Posts: 3184
- Joined:
Re: Multi-language and translation
The correct way to do this in WPF is following this guide in the MSDN:
http://msdn.microsoft.com/en-us/library/ms788718.aspx
You can read this article too to understand how localization works:
http://timheuer.com/blog/archive/2012/0 ... m+Heuer%29
This feature is complex and we decided to leave it out of 1.0 version, but it's planned for version 1.1 because we consider it very important for real production.
Until that feature is implemented we thought of a simpler approximation to application localization by using external ResourceDictionaries that define application texts for each language. Application code can select which dictionary to add to the Application.Resources (or Window.Resources) depending on the selected language.
A language dictionary could look like this:
And in your window XAML you refer to the localized strings as follows:
You cannot use <sys:String> objects in the current beta but will be available for the 1.0 release.
http://msdn.microsoft.com/en-us/library/ms788718.aspx
You can read this article too to understand how localization works:
http://timheuer.com/blog/archive/2012/0 ... m+Heuer%29
This feature is complex and we decided to leave it out of 1.0 version, but it's planned for version 1.1 because we consider it very important for real production.
Until that feature is implemented we thought of a simpler approximation to application localization by using external ResourceDictionaries that define application texts for each language. Application code can select which dictionary to add to the Application.Resources (or Window.Resources) depending on the selected language.
A language dictionary could look like this:
Code: Select all
<!-- Languages/EnglishResources.xaml -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<sys:String x:Key="Welcome">Welcome to my application</sys:String>
<sys:String x:Key="Accept">OK</sys:String>
<sys:String x:Key="Cancel">Cancel</sys:String>
</ResourceDictionary>
Code: Select all
<!-- MainWindow.xaml -->
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<StackPanel Margin="10">
<TextBlock Text="{DynamicResource Welcome}"/>
<StackPanel Orientation="Horizontal">
<Button x:Name="Ok" Content="{DynamicResource Accept}" Margin="10"/>
<Button x:Name="Cancel" Content="{DynamicResource Cancel}" Margin="10"/>
</StackPanel>
</StackPanel>
</Window>
Re: Multi-language and translation
Hi guys, as a follow up, is Globalization/Localization supported yet? I see you're shooting for 1.1. Are you feeling good about that? And do you have a timeframe? This is pretty important for our application. Thanks!
Re: Multi-language and translation
For now, the only alternative is using external ResourceDictionaries as shown above. The proper implementation has been delayed, we expect to have it along v1.2.X.
Is the implementation based on ResourceDictionaries enough for you? If not, could you please file us a bug demanding this feature?
Thanks.
Is the implementation based on ResourceDictionaries enough for you? If not, could you please file us a bug demanding this feature?
Thanks.
- PandaChuZero
- Posts: 11
- Joined:
Re: Multi-language and translation
Just like to chime in and say how important this is. Please do add it to the roadmap.
-
sfernandez
Site Admin
- Posts: 3184
- Joined:
Re: Multi-language and translation
Have you seen how it can be done right now? viewtopic.php?f=12&t=485#p2386Just like to chime in and say how important this is. Please do add it to the roadmap.
Using data binding and string dictionaries is quite easy for localizing an application.
- PandaChuZero
- Posts: 11
- Joined:
Re: Multi-language and translation
Excellent, thank you!
Actually of those samples are excellent for seeing how to put things together. I would be even better if you could add more samples.
The one line in quest and localize example makes the preview in blend break.. anyway to fix that?
error : "DraggablePanel does not exist in the namespace ..."
Actually of those samples are excellent for seeing how to put things together. I would be even better if you could add more samples.
The one line in quest and localize example makes the preview in blend break.. anyway to fix that?
Code: Select all
<local:DraggablePanel x:Name="WoodPanel" Style="{StaticResource WoodPanelStyle}" Margin="50">
Last edited by PandaChuZero on 18 Aug 2014, 16:38, edited 1 time in total.
Who is online
Users browsing this forum: No registered users and 5 guests