/// <summary>
        /// Initializes a new instance of the <see cref="PackageLanguage{TImplementation}"/> class.
        /// </summary>
        /// <param name="packageName">Name of the package that the language is for.</param>
        /// <param name="rootCulture">Culture of the non-translated message text in code.</param>
        /// <exception cref="System.ArgumentNullException">
        /// If <paramref name="packageName"/> or <paramref name="rootCulture"/> are <c>null</c>.
        /// </exception>
        /// <exception cref="System.ArgumentException">
        /// If <paramref name="packageName"/> is an empty string.
        /// </exception>
        protected PackageLanguage(string packageName, CultureInfo rootCulture)
            : base(packageName, rootCulture)
        {
            this.localizedStringsRepository = this.CreateLocalizedStringsRepository();
            this.languageDomain             = CreateLanguageDomain(this.localizedStringsRepository);

            this.Load();
        }
示例#2
0
        /// <summary>
        /// Sets up the language domain instance.
        /// </summary>
        /// <param name="domain">The language domain instance.</param>
        /// <exception cref="System.ArgumentNullException">
        /// If <paramref name="domain"/> is <c>null</c>.
        /// </exception>
        /// <exception cref="System.InvalidOperationException">
        /// If the runtime language has already been setup.
        /// </exception>
        public virtual void Setup(ILanguageDomain domain)
        {
            ExceptionUtility.CheckArgumentNotNull(domain, "domain");

            if (LocalizedStrings != null)
            {
                throw new InvalidOperationException("Runtime language has already been setup.");
            }

            LocalizedStrings = domain;
        }