コード例 #1
0
        /// <summary>
        /// Retrieves the string with the specified key from the specified culture.
        /// </summary>
        /// <param name="culture">The culture from which to retrieve the string.</param>
        /// <param name="key">The localization key of the string to retrieve.</param>
        /// <returns>The string that was retrieved.</returns>
        public LocalizedString Get(String culture, String key)
        {
            Contract.RequireNotEmpty(key, nameof(key));
            Contract.RequireNotEmpty(culture, nameof(culture));

            var db    = GetCultureStrings(culture);
            var value = (LocalizedString)null;

            if (!db.TryGetValue(key, out value))
            {
                var fallback = LocalizedString.CreateFallback(culture, key);
                db[key] = fallback;
                return(fallback);
            }

            return(value);
        }