Example #1
0
        /// <summary>
        ///   Creates or reuses a locale with the specified <see cref="LocaleIdentifier"/>.
        /// </summary>
        /// <param name="id">
        ///   A locale identifier.
        /// </param>
        /// <returns>
        ///   A locale for the specified <paramref name="id"/>.
        /// </returns>
        /// <remarks>
        ///   Uses the <see cref="LocaleIdentifier.CanonicalForm"/> of the
        ///   <paramref name="id"/>.
        /// </remarks>
        public static Locale Create(LocaleIdentifier id)
        {
            var cid = id.CanonicalForm();

            if (log.IsDebugEnabled)
            {
                log.DebugFormat("Resolved locale '{0}' to '{1}'", id, cid);
            }
            return(LocaleCache.GetOrAdd(cid.ToString(), name => new Locale(cid)));
        }