/// <summary> /// Get the dictionary from the context, if possible. /// </summary> /// <param name="target">The target object.</param> /// <returns>The dictionary name, if available.</returns> protected override string GetDictionary(DependencyObject target) { if (target == null) return FallbackDictionary; var dictionary = target.GetValueOrRegisterParentNotifier<string>(DefaultDictionaryProperty, ParentChangedAction, _parentNotifiers); return String.IsNullOrEmpty(dictionary) ? FallbackDictionary : dictionary; }
/// <summary> /// Get the dictionary from the context, if possible. /// </summary> /// <param name="target">The target object.</param> /// <returns>The dictionary name, if available.</returns> protected override string GetDictionary(DependencyObject target) { if (target == null) return null; return target.GetValueOrRegisterParentNotifier<string>(CSVEmbeddedLocalizationProvider.DefaultDictionaryProperty, ParentChangedAction, parentNotifiers); }
/// <summary> /// Get the assembly from the context, if possible. /// </summary> /// <param name="target">The target object.</param> /// <returns>The assembly name, if available.</returns> protected override string GetAssembly(DependencyObject target) { if (target == null) return FallbackAssembly; var assembly = target.GetValueOrRegisterParentNotifier<string>(DefaultAssemblyProperty, ParentChangedAction, _parentNotifiers); return String.IsNullOrEmpty(assembly) ? FallbackAssembly : assembly; }
/// <summary> /// Get the localized object using the given target for context information. /// </summary> /// <param name="key">The key to the value.</param> /// <param name="target">The target <see cref="DependencyObject"/>.</param> /// <param name="culture">The culture to use.</param> /// <returns>The value corresponding to the source/dictionary/key path for the given culture (otherwise NULL).</returns> public object GetLocalizedObject(string key, DependencyObject target, CultureInfo culture) { #if WINDOWS_PHONE var provider = this.DefaultProvider; #else #if !SILVERLIGHT if (this.DefaultProvider is InheritingResxLocalizationProvider) return GetLocalizedObject(key, target, culture, this.DefaultProvider); #endif var provider = target != null ? target.GetValueOrRegisterParentNotifier(GetProvider, (obj) => { LocalizeDictionary.DictionaryEvent.Invoke(obj, new DictionaryEventArgs(DictionaryEventType.ProviderChanged, null)); }, parentNotifiers) : null; if (provider == null) provider = this.DefaultProvider; #endif return GetLocalizedObject(key, target, culture, provider); }