50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using Microsoft.AspNetCore.Html;
|
|
using Microsoft.AspNetCore.Mvc.Localization;
|
|
using Microsoft.Extensions.Localization;
|
|
using Saxonite.Net.Core.Web.Base.App;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Resources;
|
|
using System.Web;
|
|
|
|
namespace Saxonite.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 SaxOnlineProperties { }
|
|
// 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 Saxonite.Net.Core.Web.Online.App
|
|
{
|
|
//=======================================================================
|
|
public class SaxLocaliser_Online : SaxLocaliser
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private readonly IStringLocalizer<SaxOnlineProperties> webAppProperties;
|
|
|
|
//-------------------------------------------------------------------
|
|
/// <summary>
|
|
/// Localisers are supplied using construction injection.
|
|
/// </summary>
|
|
public SaxLocaliser_Online(IStringLocalizer<SaxOnlineProperties> webAppProperties)
|
|
{
|
|
this.webAppProperties = webAppProperties;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
public override IStringLocalizer MainProperties { get { return webAppProperties; } }
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
} |