Files
BusinessMgr-2019/SaBusinessMgrCoreWebControl/Control/App/SbmLocaliser_Control.cs
T

48 lines
1.8 KiB
C#

using Microsoft.Extensions.Localization;
using Sarand.BusinessMgr.Net.Core.Web.App;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Sarand.BusinessMgr.Net.Core.Web
{
// <summary>
/// Dummy classes to group shared resources - named as per '.resx' file in root namespace.
/// <para>Required to create the IStringLocalizer instance using the type from the class.</para>
/// <para>Name of the class is used as the prefix for localisation filenames.</para>
/// <para>Resource files are in the Localization ResourcesPath in Startup.cs.</para>
/// </summary>
public class SbmControlProperties { }
// Class must be in Root/Default Namespace to reference properties with same name.
// NB 'Assembly name' must be the same as 'Default Namespace' until 'Root Namespace' can be set (.Net Core 2.1?).
// Ref. Project Properties - Application.
}
namespace Sarand.BusinessMgr.Net.Core.Web.Control.App
{
//=======================================================================
public class SbmLocaliser_Control : SbmLocaliser
{
//-------------------------------------------------------------------
// Data members.
private readonly IStringLocalizer<SbmControlProperties> webAppProperties;
//-------------------------------------------------------------------
/// <summary>
/// Localisers are supplied using construction injection.
/// </summary>
public SbmLocaliser_Control(IStringLocalizer<SbmControlProperties> webAppProperties)
{
this.webAppProperties = webAppProperties;
}
//-------------------------------------------------------------------
// Properties.
public override IStringLocalizer MainProperties { get { return webAppProperties; } }
//-------------------------------------------------------------------
}
//=======================================================================
}