Sharpen.ResourceBundle.GetLocale C# (CSharp) Method

GetLocale() public method

public GetLocale ( ) : CultureInfo
return System.Globalization.CultureInfo
		public CultureInfo GetLocale ()
		{
			return this.culture;
		}

Usage Example

        /// <summary>Injects locale specific text in all instance fields of this instance.</summary>
        /// <remarks>
        /// Injects locale specific text in all instance fields of this instance.
        /// Only public instance fields of type <code>String</code> are considered.
        /// <p>
        /// The name of this (sub)class plus the given <code>locale</code> parameter
        /// define the resource bundle to be loaded. In other words the
        /// <code>this.getClass().getName()</code> is used as the
        /// <code>baseName</code> parameter in the
        /// <see cref="Sharpen.ResourceBundle.GetBundle(string, System.Globalization.CultureInfo)
        ///     ">Sharpen.ResourceBundle.GetBundle(string, System.Globalization.CultureInfo)</see>
        /// parameter to load the
        /// resource bundle.
        /// <p>
        /// </remarks>
        /// <param name="locale">defines the locale to be used when loading the resource bundle
        ///     </param>
        /// <exception>
        /// TranslationBundleLoadingException
        /// see
        /// <see cref="NGit.Errors.TranslationBundleLoadingException">NGit.Errors.TranslationBundleLoadingException
        ///     </see>
        /// </exception>
        /// <exception>
        /// TranslationStringMissingException
        /// see
        /// <see cref="NGit.Errors.TranslationStringMissingException">NGit.Errors.TranslationStringMissingException
        ///     </see>
        /// </exception>
        /// <exception cref="NGit.Errors.TranslationBundleLoadingException"></exception>
        internal virtual void Load(CultureInfo locale)
        {
            Type bundleClass = GetType();

            try
            {
                // NGit.NGit.resources.JGitText
                resourceBundle = Sharpen.ResourceBundle.GetBundle(bundleClass.FullName, "NGit.NGit.resources.JGitText", locale);
                //resourceBundle = Sharpen.ResourceBundle.GetBundle(bundleClass.FullName, locale);
            }
            catch (MissingResourceException e)
            {
                throw new TranslationBundleLoadingException(bundleClass, locale, e);
            }
            this.effectiveLocale = resourceBundle.GetLocale();
            foreach (FieldInfo field in bundleClass.GetFields())
            {
                if (field.FieldType.Equals(typeof(string)))
                {
                    try
                    {
                        string translatedText = resourceBundle.GetString(field.Name);
                        field.SetValue(this, translatedText);
                    }
                    catch (MissingResourceException e)
                    {
                        throw new TranslationStringMissingException(bundleClass, locale, field.Name, e);
                    }
                    catch (ArgumentException e)
                    {
                        throw new Error(e);
                    }
                    catch (MemberAccessException e)
                    {
                        throw new Error(e);
                    }
                }
            }
        }
All Usage Examples Of Sharpen.ResourceBundle::GetLocale