Quantcast
Channel: WPF Localization Extension
Viewing all 286 articles
Browse latest View live

Updated Wiki: Home

$
0
0

The Localization Extension...

... is the easiest way to localize any type of DependencyProperties or native Properties on DependencyObjects under WPF & Silverlight.

Feature Demo:

Version 2.1.4 arrived

Structure of version 2.0.0

Products that use this Solution:

SAPSAP Crystal Reports, Version for Visual Studio .NET

Features:

  • First of all: ITS FREE (and will stay free)
  • Obtain stable results in
    • WPF applications using .NET 3.5 and higher
    • New: Silverlight 5.0 applications
    • New: Windows Phone 7.x applications
  • New: Localization source/provider can be changed freely at arbitrary nodes
    • Use the Provider property in LocalizeDictionary to change the provider for the particular sub tree
    • Use the DefaultProvider property to set the provider for the whole application
    • Built-in RESX provider for resource file lookup (Default) - fully backward compatible to older versions of this extension
    • Interface for custom providers
    • Notification about provider changes and errors
    • Get the list of all available cultures from a provider - or just take the bindable merged list from LocalizeDictionary
    • CSV provider project in the Tests folder as an example for custom providers
  • Supports binding-like write style like "Text = {lex:LocText ResAssembly:ResFile:ResKey}"
    • Define a default assembly and / or resource file to reduce the key to ResAssembly::ResKey, ResFile:ResKey or even ResKey
    • If no key is specified, the Name and Property Name of the target are used (e.g. MyButton_Content)
    • Default assembly, dictionary and culture can be changed dynamically
    • Default assembly and dictionary inherit along the visual tree and can be redefined at each node
  • It is available at designtime (MS Expression Blend 3.0 & 4.0, MS VisualStudio 2008 & 2010
    • not for dynamic loaded assemblies which only can be found at runtime and as long the resource (.resx) is built at designtime
    • Even for Silverlight!
    • No extra preview application needed
    • Offers a DesignValue Property to support custom values during design mode
  • Full support of various application scenarios
    • Works with normal dependency properties
    • Works with normal properties (e.g. Ribbon)
    • Works with control/data templates
  • Various culture setup features
    • Works with the .resx-fallback mechanism (e.g. en-us -> en -> invariant culture)
    • Supports culture forcing (e.g. "this object has to be in english all the time")
    • Buffering allows fast switching of the language at runtime
    • Offers a design language for visual testing at designtime
    • Offers a "SpecificCulture" to use as IFormatProvider (e.g. (123.20).ToString(LocalizeDictionary.SpecificCulture) = "123.20" or "123,20")
    • Does not alter the culture on Thread.CurrentCulture or Thread.CurrentUICulture (can be changed easily)
  • Code behind features:
    • Can be used in code behind to bind localized values to dynamic generated controls
    • Implements INotifyPropertyChanged for advanced use
    • Offers some functionality to check and get resource values in code behind (e.g. ResolveLocalizedValue)
  • Easy to use
    • Can be used with any resource file (.resx) accross all assemblies (also the dynamic loaded one at runtime)
    • Does not need any initializing process (like "call xyz to register a special localize dictionary")
    • Can localize any type of data type, as long a TypeConverter exists for it
  • Example extensions included for
    • Formating e.g. "this is the '{0}' value" (not bindable at the moment)
    • Prefix and suffix values (currently with LocText extension)
    • Upper and lower Text
  • Last, but not least
    • Does not create any memory leaks
    • Leaves the UID property untouched
    • Does not need an additional build task
    • Is in use in various productive systems

Get the latest NuGet package at:

https://nuget.org/packages/WpfLocalizeExtension/

Get the source code at:

https://github.com/SeriousM/WPFLocalizationExtension

Documentation & Tutorial

Documentation

WPF Localization Addin:

WPF Localization Addin, hosted by skiba_k
thanks for this!

You can do a donation to me and my work.
It would be very nice of you :)
PayPal - The safer, easier way to pay online!

Please let me know your Feedback or send me a message if you are using this extension in your projects!
It would be nice if you would call me your company and whether i have the permission to set it on the references.


NEWS

20130828: Version 2.1.4 ready for download

20130408: Version 2.1.3 ready for download

20121112: Version 2.1.2 ready for download

20121017: Version 2.1.1 ready for download

20120706: Version 2.1.0 ready for download

20120626: Beta 2.1.0 ready for download

20120620: Version 2.0.0 ready for download

20120619: Beta 2.0.0 ready for download

20120615: We got a documentation! ...ehm - finally :-)

20120614: The Localization Extension is now also supporting Silverlight 5.0 applications! Check out the latest source at GitHub or NuGet package

20120521: I'm proud to announce that WPF Localization Extension is prepared for the future! It's now build on top of XAML Markup Extensions by MrCircuit

20120116: NuGet Package arrived! https://nuget.org/packages/WpfLocalizeExtension/

20111103: I've added the source code to Github: https://github.com/SeriousM/WPFLocalizationExtension
Now can everyone make a fork easily! go for it :)

20110725: The SVN Repository (Source Code Section) is now updated. (the project is still alive and will be monitored well by me)

Closed Feature: SetBinding exception in Silverlight [9295]

$
0
0
The code behind binding throws an exception in Silverlight:

Attempt by method 'SLLocalizeExtension.Extensions.LocExtension.SetBinding(System.Object, System.Object, Int32)' to access field 'System.Windows.DependencyProperty._propertyType' failed.

in LocExtension.cs line 730.

I am using windows8 and vs2012.

My code is

TextBlock tt = new TextBlock();
LocExtension lex = new LocExtension("SRCommon:SRCommon:Modul_XXX");
lex.SetBinding(tt, TextBlock.TextProperty);

Edited Issue: Possible memory leak in Locextension object [9284]

$
0
0
When I show a window with just localized labels and textboxes without databinding
my application will not be properly shutdown. Possible roots from mem profiler :
NestedMarkupextension or localizedictionary .
When I investigate the code there never is called something to deregister what the constructor of Locextension will call

/// <summary>
/// Initializes a new instance of the <see cref="LocExtension"/> class.
/// </summary>
public LocExtension()
: base()
{
// Register this extension as an event listener on the first target.
base.OnFirstTarget = () =>
{
LocalizeDictionary.DictionaryEvent.AddListener(this);
};
}
Thank you

Closed Issue: Possible memory leak in Locextension object [9284]

$
0
0
When I show a window with just localized labels and textboxes without databinding
my application will not be properly shutdown. Possible roots from mem profiler :
NestedMarkupextension or localizedictionary .
When I investigate the code there never is called something to deregister what the constructor of Locextension will call

/// <summary>
/// Initializes a new instance of the <see cref="LocExtension"/> class.
/// </summary>
public LocExtension()
: base()
{
// Register this extension as an event listener on the first target.
base.OnFirstTarget = () =>
{
LocalizeDictionary.DictionaryEvent.AddListener(this);
};
}
Thank you

Closed Issue: Datagrid column headers are not localized when using default assembly and default dictionary [9282]

$
0
0
If you use just <br /><DataGridTextColumn Header="{lex:LocText Key=Description}"></DataGridTextColumn><br />instead of <br /><DataGridTextColumn Header="{lex:LocText Key=Description, Assembly=XamlLocalizationTest, Dict=ResTexts}"></DataGridTextColumn><br />when localizing a datagrid ( having defined default assembly and Default dictionary) no value is shown <br /><br />

Edited Issue: Datagrid column headers are not localized when using default assembly and default dictionary [9282]

$
0
0
If you use just <br /><DataGridTextColumn Header="{lex:LocText Key=Description}"></DataGridTextColumn><br />instead of <br /><DataGridTextColumn Header="{lex:LocText Key=Description, Assembly=XamlLocalizationTest, Dict=ResTexts}"></DataGridTextColumn><br />when localizing a datagrid ( having defined default assembly and Default dictionary) no value is shown <br /><br />

Closed Issue: Extension not working in Addin [9281]

$
0
0
Hello,<br />I am attempting to use your library in an Auto-CAD addin! However whenever I try to open the window and use the library for its intended purpose my application crashes. The stack trace is telling me that a File is not found but both DLLs (WPFLocalizeExtension an XAMLMarkupExtensions) are where they should be. I'm guessing that the file it's not finding is actually my primary library which contains the default resources. Maybe due to AutoCAD becoming the primary thread when the Addin launches within it? There is no way to be sure which file it loses (all 3 DLLs are kept together). Any suggestions or ideas?

Edited Issue: Problem using a Converter on XAML LocText [9280]

$
0
0
Im using a custom converter to make the text all upper case on some TextBlocks. The problem comes when i display the same text on other controls without that converter, its still upper case!

Example:

<TextBlock Text="{Lang:LocText Key=Test, Dict=ApplicationStrings, Assembly=GSMTool.Localization, Converter={StaticResource UpperCaseTextConverter}}" Foreground="Black" />
<TextBlock Text="{Lang:LocText Key=Test, Dict=ApplicationStrings, Assembly=GSMTool.Localization}" Foreground="Black" />

The second text is still upper case. The definition in ApplicationStrings is "Test".

The Converter:

[ValueConversion(typeof(String), typeof(String))]
public class UpperCaseTextConverter : IValueConverter
{
public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
{
return ((String)value).ToUpperInvariant();
}

public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

Closed Issue: Problem using a Converter on XAML LocText [9280]

$
0
0
Im using a custom converter to make the text all upper case on some TextBlocks. The problem comes when i display the same text on other controls without that converter, its still upper case!

Example:

<TextBlock Text="{Lang:LocText Key=Test, Dict=ApplicationStrings, Assembly=GSMTool.Localization, Converter={StaticResource UpperCaseTextConverter}}" Foreground="Black" />
<TextBlock Text="{Lang:LocText Key=Test, Dict=ApplicationStrings, Assembly=GSMTool.Localization}" Foreground="Black" />

The second text is still upper case. The definition in ApplicationStrings is "Test".

The Converter:

[ValueConversion(typeof(String), typeof(String))]
public class UpperCaseTextConverter : IValueConverter
{
public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
{
return ((String)value).ToUpperInvariant();
}

public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

Edited Issue: LocalizeDictionary.DesignCulture & Blend + VS2012 [9269]

$
0
0
Blend and VS 2012 do not react properly on the value of LocalizeDictionary.DesignCulture.

This is caused by the designer not uploading the satellite assemblies to the ShadowCache path, e.g.:

[User]\AppData\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache

Closed Issue: LocalizeDictionary.DesignCulture & Blend + VS2012 [9269]

$
0
0
Blend and VS 2012 do not react properly on the value of LocalizeDictionary.DesignCulture.

This is caused by the designer not uploading the satellite assemblies to the ShadowCache path, e.g.:

[User]\AppData\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache
Comments: This issue is solved with v2.1.4. partially. Nevertheless, I used a DIRTY hack because MS stopped responding to my questions on that topic in their forums.

Closed Issue: Windows Store App support [9279]

$
0
0
Hi,

are Windows Store Apps supported? If not: is a support planned, or do you know a good alternative for runtime localization? This project is looking realy nice *.*

I just tried to install the Package via NuGet and got an Error:

Attempting to resolve dependency 'XAMLMarkupExtensions (≥ 1.1.5)'.
Successfully installed 'XAMLMarkupExtensions 1.1.5'.
Successfully installed 'WpfLocalizeExtension 2.1.2'.
The process cannot access the file 'c:\Users\xxx\documents\visual studio 2012\Projects\TestApp\packages\XAMLMarkupExtensions.1.1.5\lib\net35\XAMLMarkupExtensions.dll' because it is being used by another process.
The process cannot access the file 'c:\Users\xxx\documents\visual studio 2012\Projects\TestApp\packages\XAMLMarkupExtensions.1.1.5\lib\net40\XAMLMarkupExtensions.dll' because it is being used by another process.
The process cannot access the file 'c:\Users\xxx\documents\visual studio 2012\Projects\TestApp\packages\XAMLMarkupExtensions.1.1.5\lib\sl50\XAMLMarkupExtensions.dll' because it is being used by another process.
The directory is not empty.

Successfully uninstalled 'XAMLMarkupExtensions 1.1.5'.
Install failed. Rolling back...
Could not install package 'XAMLMarkupExtensions 1.1.5'. You are trying to install this package into a project that targets '.NETCore,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.



regards

otis

Closed Unassigned: Replace format place holders in text resource only if at least on FormatSegment is set [9300]

$
0
0
Currently all custom format placeholder (like {0}) are removed in method "FormatOutput".
To allow custom text format with placeholders the internal string formatting should only happen if at least one FormatSegment is explicitly set through binding.

For that I introduced a simple bool value which is set in the setters of the FormatSegmentX-Properties. Please see attached file for further details.

New Post: Version 2.1.4 is out

$
0
0

Thats great news and another milestone on our road to great success!
Thanks Uwe for the hard work you put into this great pice of software!

New Post: Refresh text put in code behind

$
0
0
Hi

I have a problem of the same kind. I try to use WPF Localize Extension with Modern UI for WPF ( http://mui.codeplex.com ).

SeriousM : can this solution be used with property that are not dependencyProperty ? I tried to give the property I want to localize as second argument for the method SetBinging but it doesn't seems to work
var loc = new LocExtension("ChefOrchestre:Strings:SettingsView_Link_General");
bool success = loc.SetBinding(LinkGeneral, LinkGeneral.DisplayName);
The error I get
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at XAMLMarkupExtensions.Base.NestedMarkupExtension.SetPropertyValue(Object value, TargetInfo info, Boolean forceNull)
   at WPFLocalizeExtension.Extensions.LocExtension.SetBinding(Object targetObject, Object targetProperty, Int32 targetPropertyIndex)
   at WPFLocalizeExtension.Extensions.LocExtension.SetBinding(Object targetObject, Object targetProperty)
   at ChefOrchestre.View.SettingsView..ctor() in c:\Users\Julien\Documents\Visual Studio 2012\Projects\ChefOrchestre\ChefOrchestre\View\SettingsView.xaml.cs:line 20
Julien

Created Feature: Retrieve extension that is bound to an object's property [9304]

$
0
0
The engine should be able to get the extension instance, that is already bound to a certain object's property.

New Post: Refresh text put in code behind

$
0
0
Hi Julien,

the second parameter must be of type "DependencyProperty" or "PropertyInfo". The latter would fit to your task. You can retrieve it using reflection on the type of "LinkGeneral".

Best regards,
Uwe

New Post: Changing resource is not working

$
0
0
Hello there,

i created a test project following The Idiot's Guide to using WPF Localization Extenstion (Get Started) .

it work so good.

but when i move my resources.resx file to a single project,
the MergedAvailableCultures and Culture got the right value.
the binding value not working.

my source like this. ok, who can help me?
<Window x:Class="DemoLocalize.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        WindowStartupLocation="CenterScreen"

        xmlns:engine="clr-namespace:WPFLocalizeExtension.Engine;assembly=WPFLocalizeExtension"
        engine:LocalizeDictionary.DesignCulture="ja"

        xmlns:lex="http://wpflocalizeextension.codeplex.com"
        lex:LocalizeDictionary.IncludeInvariantCulture="False"
        lex:ResxLocalizationProvider.DefaultAssembly="DemoLocalize"
        lex:ResxLocalizationProvider.DefaultDictionary="Resources">
    <DockPanel>
        <ComboBox DockPanel.Dock="Top"
                  ItemsSource="{Binding Source={x:Static lex:LocalizeDictionary.Instance}, Path=MergedAvailableCultures}"
                  SelectedItem="{Binding Source={x:Static lex:LocalizeDictionary.Instance}, Path=Culture}"
                  DisplayMemberPath="NativeName"
                  x:Name="Lang" />
        <Label Content="{lex:Loc DemoLocalize:Resources:lag}" />
    </DockPanel>
</Window>

New Post: Refresh text put in code behind

$
0
0
Thank you, it works.

And is there a solution to do that in the XAML code and not code behind ? In fact that was my initial problem, I have done like in the documentation and that didn't work with the property that are not DependencyProperty.


Julien

Created Unassigned: Cannot use Loc in Style Setter [9305]

$
0
0
This is the issue as reported in Issue 2574, except using Loc and VS2012.

When trying to set Setter.Value to Loc yields the following in VS 2012: 'LocExtension' is not valid for Setter.Value. The only supported MarkupExtension types are DynamicResourceExtension and BindingBase or derived types.

Viewing all 286 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>