Re: Multi-language and translation
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.
- ai_enabled
- Posts: 231
- Joined:
- Contact:
Re: Multi-language and translation
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?
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
Re: Multi-language and translation
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.
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.
-
sfernandez
Site Admin
- Posts: 3152
- Joined:
Re: Multi-language and translation
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.
You can download the complete project in the first post of the thread.
- ai_enabled
- Posts: 231
- Joined:
- Contact:
Re: Multi-language and translation
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?
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
-
sfernandez
Site Admin
- Posts: 3152
- Joined:
Re: Multi-language and translation
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:
Is that what you need?
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:
Code: Select all
FrameworkElement helper = new FrameworkElement();
ResourceDictionary dict = new ResourceDictionary();
// foreach localization text:
helper.SetTag(text);
dict.RegisterName(textId, helper.GetTag());
- ai_enabled
- Posts: 231
- Joined:
- Contact:
Re: Multi-language and translation
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!
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
extracted as
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.
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!
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
Code: Select all
<TextBlock x:Name="PlayerMoneyAmount" Text="Money: "/>
Code: Select all
<!-- Text: Money: -->
<TextBlock x:Name="PlayerMoneyAmount" loc:LocalizationService.Text="PlayerInventoryControl_UserControl_PlayerMoneyAmountDisplay" />
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
-
sfernandez
Site Admin
- Posts: 3152
- Joined:
Re: Multi-language and translation
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
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:
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:
Code: Select all
ResourceDictionary resources = new ResourceDictionary();
resources["RedBrush"] = Brushes.Red;
SolidColorBrush redBrush = resources["RedBrush"] as SolidColorBrush;
Re: Multi-language and translation
Is there any news on when this roadmap item (WPF-style localization) might be expected?
Re: Multi-language and translation
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