Exemplo n.º 1
0
        /// <summary>
        /// Get the localized object using the given target and provider.
        /// </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>
        /// <param name="provider">The provider 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, ILocalizationProvider provider)
        {
            if (provider == null)
            {
                throw new InvalidOperationException("No provider found and no default provider given.");
            }

            return(provider.GetLocalizedObject(key, target, culture));
        }
 /// <summary>
 /// Looks up the ResourceManagers for the searched <paramref name="key"/>
 /// with the passed culture. If the searched one does not exists with the passed culture, is will searched
 /// until the invariant culture is used.
 /// </summary>
 /// <param name="key">The key of the searched entry</param>
 /// <param name="cultureToUse">The culture to use.</param>
 /// <param name="provider">The localization provider.</param>
 /// <returns>
 /// TRUE if the searched one is found, otherwise FALSE
 /// </returns>
 public bool ResourceKeyExists(string key, CultureInfo cultureToUse, ILocalizationProvider provider)
 {
     return provider.GetLocalizedObject(key, null, cultureToUse) != null;
 }
        /// <summary>
        /// Get the localized object using the given target and provider.
        /// </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>
        /// <param name="provider">The provider 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, ILocalizationProvider provider)
        {
            if (provider == null)
                throw new InvalidOperationException("No provider found and no default provider given.");

            return provider.GetLocalizedObject(key, target, culture);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Looks up the ResourceManagers for the searched <paramref name="key"/>
 /// with the passed culture. If the searched one does not exists with the passed culture, is will searched
 /// until the invariant culture is used.
 /// </summary>
 /// <param name="key">The key of the searched entry</param>
 /// <param name="cultureToUse">The culture to use.</param>
 /// <param name="provider">The localization provider.</param>
 /// <returns>
 /// TRUE if the searched one is found, otherwise FALSE
 /// </returns>
 public bool ResourceKeyExists(string key, CultureInfo cultureToUse, ILocalizationProvider provider)
 {
     return(provider.GetLocalizedObject(key, null, cultureToUse) != null);
 }