User avatar
jsantos
Site Admin
Posts: 4123
Joined: 20 Jan 2012, 17:18
Contact:

Re: Multi-language and translation

18 Aug 2014, 16:33

Yes, we will be adding more samples in the future. There are also two features missing in noesisGUI that we need because NGUI uses them a lot:
  • Text Inlines
  • Support for gradients in the text. NGUI puts a vertical gradient in the fonts that improve a lot the quality.
We are working in these features.
 
User avatar
ai_enabled
Posts: 231
Joined: 18 Jul 2013, 05:28
Contact:

Re: Multi-language and translation

08 Oct 2014, 12:56

Hello! We're recently started localization of our game and have some questions:
1. Does NoesisGUI supports using the StaticMarkupExtension like {x:Static Resources.ResourceName} with using resource file? How can we add custom dictionary to static collection? And how to modify ResourceDictionary in runtime or create a new one? We need ability to provide external localization resources (in our custom format), so we need to convert it to resource dictionary somehow.
2. Is there any chance to adopt this tool for NoesisGUI in Unity? Video example is very promising!
3. (maybe related to 2) Can we implement custom MarkupExtension for localization needs?
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
User avatar
jsantos
Site Admin
Posts: 4123
Joined: 20 Jan 2012, 17:18
Contact:

Re: Multi-language and translation

08 Oct 2014, 18:21

Hi!

1. We do not support StaticMarkupExtension. The recommended method right now is storing each localizacion string in a separate resource dictionary (for example written by a tool) and setting in the DataContext (as shown in the sample referenced in this thread).

2. 3. For now, custom MarkUpExtensions are only supported in C++. In v1.2, ValueConverters are being exposed to C#. I think we should do the same for Markups in a future version.
 
User avatar
sfernandez
Site Admin
Posts: 3152
Joined: 22 Dec 2011, 19:20

Re: Multi-language and translation

08 Oct 2014, 18:31

The sample indicated by Jesus is this one: Example 10 - Localization in the NGUI Examples series.

You can download the complete project in the first post of the thread.
 
User avatar
ai_enabled
Posts: 231
Joined: 18 Jul 2013, 05:28
Contact:

Re: Multi-language and translation

09 Oct 2014, 03:27

jsantos, sfernandez
thanks for respond! But we would like to provide strings dynamically from our custom text files (as our game supports modding and players supposed to easily edit any game data, without using any extra tools). I can convert localization text file to the ResourceDictionary in WPF and add it into global MergedDictionaries collection, but as I see modification of ResourceDictionary is not supported in the v1.1.11 for Unity yet.
Any other ideas?
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
User avatar
sfernandez
Site Admin
Posts: 3152
Joined: 22 Dec 2011, 19:20

Re: Multi-language and translation

13 Oct 2014, 14:04

You mean create an empty ResourceDictionary and add each entry of your localization text file, right?

You could use the ResourceDictionary.RegisterName() to fill it with your localization strings. There is only one tricky thing to do: convert the string to a BaseComponent. As I explained here: viewtopic.php?f=3&t=516&p=2658#p2634, you can accomplish that by using an intermediate object:
FrameworkElement helper = new FrameworkElement();
ResourceDictionary dict = new ResourceDictionary();

// foreach localization text:
helper.SetTag(text);
dict.RegisterName(textId, helper.GetTag());
Is that what you need?
 
User avatar
ai_enabled
Posts: 231
Joined: 18 Jul 2013, 05:28
Contact:

Re: Multi-language and translation

14 Oct 2014, 09:48

sfernandez, good to know it's possible!
I already done this task by utilizing attached properties. Works great!
I will post ReSharper Addin later to help all interested people with translation of their UI!
Image
The ReSharper quickfixes available for fast extraction. I've enforced this rule to "error" severity just to be sure there are nothing remains unlocalized after the extraction.

For example
<TextBlock x:Name="PlayerMoneyAmount" Text="Money: "/>
extracted as
<!-- Text: Money:  -->
<TextBlock x:Name="PlayerMoneyAmount" loc:LocalizationService.Text="PlayerInventoryControl_UserControl_PlayerMoneyAmountDisplay" />
where the PlayerInventoryControl_UserControl_PlayerMoneyAmountDisplay is member in the special UILocalizationKeys enum (all created automatically by the ReSharper quickfix).
It's also works for buttons, labels and other controls, with inline/child Content...

BTW, the attached properties is one of the most amazing features in XAML/WPF/NoesisGUI, we're using it for attaching sounds to the UI elements, custom tooltips and many other useful things.
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
User avatar
sfernandez
Site Admin
Posts: 3152
Joined: 22 Dec 2011, 19:20

Re: Multi-language and translation

14 Oct 2014, 11:20

Attached properties are very powerful, and many things can be achieved through them. It's great to know you find I solution to your localization requirements :D

About the ResourceDictionary I want to add that in version 1.2 the API will match the one offered by WPF, and you will be able to get or set values from the ResourceDictionary using the [ ] operator:
ResourceDictionary resources = new ResourceDictionary();
resources["RedBrush"] = Brushes.Red;
SolidColorBrush redBrush = resources["RedBrush"] as SolidColorBrush;
 
peterh
Posts: 39
Joined: 13 Mar 2015, 13:50

Re: Multi-language and translation

13 Apr 2015, 14:45

Is there any news on when this roadmap item (WPF-style localization) might be expected?
 
User avatar
jsantos
Site Admin
Posts: 4123
Joined: 20 Jan 2012, 17:18
Contact:

Re: Multi-language and translation

14 Apr 2015, 19:37

Right now, this is not planned for the next release (v1.3). Do the workarounds described at this thread work for you?

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests