karics
Topic Author
Posts: 6
Joined: 11 Mar 2013, 13:28

Multi-language and translation

21 Mar 2013, 12:44

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 )
 
User avatar
jsantos
Site Admin
Posts: 2596
Joined: 20 Jan 2012, 17:18
Contact:

Re: Multi-language and translation

21 Mar 2013, 16:04

what do you mean by "translating text" ? multilingual support?
 
karics
Topic Author
Posts: 6
Joined: 11 Mar 2013, 13:28

Re: Multi-language and translation

21 Mar 2013, 18:31

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.
 
User avatar
sfernandez
Site Admin
Posts: 1666
Joined: 22 Dec 2011, 19:20

Re: Multi-language and translation

22 Mar 2013, 13:36

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:
<!-- 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>
And in your window XAML you refer to the localized strings as follows:
<!-- 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>
You cannot use <sys:String> objects in the current beta but will be available for the 1.0 release.
 
karics
Topic Author
Posts: 6
Joined: 11 Mar 2013, 13:28

Re: Multi-language and translation

22 Mar 2013, 14:07

Thanks the informations!
 
walhore
Posts: 19
Joined: 25 Feb 2013, 17:24

Re: Multi-language and translation

12 May 2014, 17:54

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!
 
User avatar
jsantos
Site Admin
Posts: 2596
Joined: 20 Jan 2012, 17:18
Contact:

Re: Multi-language and translation

12 May 2014, 18:36

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.
 
PandaChuZero
Posts: 11
Joined: 06 May 2014, 06:05

Re: Multi-language and translation

14 Aug 2014, 22:26

Just like to chime in and say how important this is. Please do add it to the roadmap.
 
User avatar
sfernandez
Site Admin
Posts: 1666
Joined: 22 Dec 2011, 19:20

Re: Multi-language and translation

16 Aug 2014, 12:01

Just like to chime in and say how important this is. Please do add it to the roadmap.
Have you seen how it can be done right now? viewtopic.php?f=12&t=485#p2386

Using data binding and string dictionaries is quite easy for localizing an application.
 
PandaChuZero
Posts: 11
Joined: 06 May 2014, 06:05

Re: Multi-language and translation

18 Aug 2014, 16:23

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?
<local:DraggablePanel x:Name="WoodPanel" Style="{StaticResource WoodPanelStyle}" Margin="50">
error : "DraggablePanel does not exist in the namespace ..."
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 2 guests