public static string GetUIString(string key) { string uiString; LocTextExtension locExtension = new LocTextExtension(String.Format("DriverUtilites:Resources:{0}", key)); locExtension.ResolveLocalizedValue(out uiString); return uiString; }
public static string GetUIString(string key) { string uiString; LocTextExtension locExtension = new LocTextExtension(String.Format("FreeDriverScout.OSMigrationTool.Backup:Resources:{0}", key)); locExtension.ResolveLocalizedValue(out uiString); return uiString; }
/// <summary> /// Gets the specified UI string, localized with a current thread culture /// </summary> /// <param name="key">Resource key</param> /// <returns>Localized string for the specified resource key</returns> public static string GetUIString(string key) { string uiString; var locExtension = new LocTextExtension(String.Format("FreeGamingBooster:Resources:{0}", key)); locExtension.ResolveLocalizedValue(out uiString); return uiString; }
/// <summary> /// Does the binding test. /// </summary> private void DoBindingTest() { TextBlock tb = new TextBlock(); LocTextExtension loc = new LocTextExtension("XamlLocalizationTest:ResTexts:resBack"); // should be true bool success = loc.SetBinding(tb, TextBlock.TextProperty); // should be false success = loc.SetBinding(tb, TextBlock.TextProperty); tb = null; tb = new TextBlock(); // should be true success = loc.SetBinding(tb, TextBlock.TextProperty); tb = null; tb = new TextBlock(); // should be true success = loc.SetBinding(tb, TextBlock.TextProperty); // should be false success = loc.SetBinding(tb, TextBlock.TextProperty); }
public static string GetUIString(string key) { string uiString; LocTextExtension locExtension = new LocTextExtension(String.Format("DriversGalaxy.OSMigrationTool.Restore:Resources:{0}", key)); locExtension.ResolveLocalizedValue(out uiString); return uiString; }
protected void BindPropertyToResource(string propertyName, string resourceKey) { WPFLocalizeExtension.Providers.ResxLocalizationProvider resxLocalizationProvider = WPFLocalizeExtension.Providers.ResxLocalizationProvider.Instance; WPFLocalizeExtension.Providers.ResxLocalizationProvider.SetDefaultAssembly(resxLocalizationProvider, System.Reflection.Assembly.GetCallingAssembly().GetName().Name); WPFLocalizeExtension.Providers.ResxLocalizationProvider.SetDefaultDictionary(resxLocalizationProvider, nameof(Translation)); var targetProperty = this.GetType().GetProperty(propertyName); var locBinding = new WPFLocalizeExtension.Extensions.LocTextExtension(resourceKey); locBinding.SetBinding(this, targetProperty); }
/// <summary> /// Handles the Loaded event of the Window1 control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void Window1_Loaded(object sender, RoutedEventArgs e) { // <TextBlock x:Name="txtSizeNormal" Grid.Column="3" Grid.Row="1" Text="{LocText XamlLocalizationTest:ResTexts:resBack, Prefix=AbC, Suffix=AbC, PrefixSpace=true, SuffixSpace=true}" /> // <TextBlock x:Name="txtSizeUpper" Grid.Column="3" Grid.Row="2" Text="{LocTextUpper XamlLocalizationTest:ResTexts:resBack, Prefix=AbC, Suffix=AbC, PrefixSpace=true, SuffixSpace=true}" /> // <TextBlock x:Name="txtSizeLower" Grid.Column="3" Grid.Row="3" Text="{LocTextLower XamlLocalizationTest:ResTexts:resBack, Prefix=AbC, Suffix=AbC, PrefixSpace=true, SuffixSpace=true}" /> bool txtNormalBinding = new LocTextExtension("XamlLocalizationTest:ResTexts:resBack") { Prefix = "AbC ", Suffix = " AbC" } .SetBinding(this.txtSizeNormal, TextBlock.TextProperty); bool txtUpperBinding = new LocTextUpperExtension("XamlLocalizationTest:ResTexts:resBack") { Prefix = "AbC ", Suffix = " AbC" } .SetBinding(this.txtSizeUpper, TextBlock.TextProperty); bool txtLowerBinding = new LocTextLowerExtension("XamlLocalizationTest:ResTexts:resBack") { Prefix = "AbC ", Suffix = " AbC" } .SetBinding(this.txtSizeLower, TextBlock.TextProperty); this.DoBindingTest(); this.CheckBitmapResolving(); }