Beispiel #1
0
		/// <summary>
		/// Checks if the given Localized Value is <c>null</c> or empty.
		/// A Localized Value is empty when both the <see cref="Value"/> and
		/// <see cref="Comment"/> string properties are <c>null</c> or empty.
		/// </summary>
		/// <param name="value">A <see cref="LocalizedValue"/></param>
		/// <returns>A value indicating whether the given object is <c>null</c> or empty.
		/// </returns>
		public static bool IsNullOrEmpty(LocalizedValue value)
		{
			return value == null || value.IsEmpty();
		}
        internal LocalizedValue EnsureLocalizedValue(string key, string culture)
        {
            if (!_keys.Contains(key))
            {
                throw new ArgumentOutOfRangeException("Key not found");
            }

            if (!_cultures.Contains(culture))
            {
                throw new ArgumentOutOfRangeException("Culture not found");
            }

            Dictionary<string, LocalizedValue> values;
            if (_contents.ContainsKey(key))
            {
                values = _contents[key];
            }
            else
            {
                values = new Dictionary<string, LocalizedValue>();
                _contents.Add(key, values);
            }

            LocalizedValue lv;
            if (values.ContainsKey(culture))
            {
                lv = values[culture];
            }
            else
            {
                lv = new LocalizedValue();
                values.Add(culture, lv);
            }
            return lv;
        }