Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

NopLocalizationDefaults.cs

using Nop.Core.Caching;
using Nop.Core.Domain.Localization;

namespace Nop.Services.Localization;

/// 
/// Represents default values related to localization services
/// 
public static partial class NopLocalizationDefaults
{
    #region Locales

    /// 
    /// Gets a prefix of locale resources for the admin area
    /// 
    public static string AdminLocaleStringResourcesPrefix => "Admin.";

    /// 
    /// Gets a prefix of locale resources for enumerations 
    /// 
    public static string EnumLocaleStringResourcesPrefix => "Enums.";

    /// 
    /// Gets a prefix of locale resources for permissions 
    /// 
    public static string PermissionLocaleStringResourcesPrefix => "Permission.";

    /// 
    /// Gets a prefix of locale resources for plugin friendly names 
    /// 
    public static string PluginNameLocaleStringResourcesPrefix => "Plugins.FriendlyName.";

    #endregion

    #region Caching defaults

    #region Languages

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : store ID
    /// {1} : show hidden records?
    /// 
    public static CacheKey LanguagesAllCacheKey => new("Nop.language.all.{0}-{1}", LanguagesByStorePrefix, NopEntityCacheDefaults.AllPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : store ID
    /// 
    public static string LanguagesByStorePrefix => "Nop.language.all.{0}";

    #endregion

    #region Locales

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : language ID
    /// 
    public static CacheKey LocaleStringResourcesAllPublicCacheKey => new("Nop.localestringresource.bylanguage.public.{0}", NopEntityCacheDefaults.Prefix);

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : language ID
    /// 
    public static CacheKey LocaleStringResourcesAllAdminCacheKey => new("Nop.localestringresource.bylanguage.admin.{0}", NopEntityCacheDefaults.Prefix);

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : language ID
    /// 
    public static CacheKey LocaleStringResourcesAllCacheKey => new("Nop.localestringresource.bylanguage.{0}", NopEntityCacheDefaults.Prefix);

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : language ID
    /// {1} : resource key
    /// 
    public static CacheKey LocaleStringResourcesByNameCacheKey => new("Nop.localestringresource.byname.{0}-{1}", LocaleStringResourcesByNamePrefix, NopEntityCacheDefaults.Prefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : language ID
    /// 
    public static string LocaleStringResourcesByNamePrefix => "Nop.localestringresource.byname.{0}";

    #endregion

    #region Localized properties

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : language ID
    /// {1} : entity ID
    /// {2} : locale key group
    /// {3} : locale key
    /// 
    public static CacheKey LocalizedPropertyCacheKey => new("Nop.localizedproperty.value.{0}-{1}-{2}-{3}");

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : entity ID
    /// {1} : locale key group
    /// {2} : locale key
    /// 
    public static CacheKey LocalizedPropertiesCacheKey => new("Nop.localizedproperty.all.{0}-{1}-{2}");

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : language ID
    /// 
    public static CacheKey LocalizedPropertyLookupCacheKey => new("Nop.localizedproperty.value.{0}");

    #endregion

    #endregion
}