Commit 2e314c36 authored by Andres Käver's avatar Andres Käver
Browse files

nuget

parent c055e5c7
Pipeline #824 passed with stages
in 1 minute and 54 seconds
using System;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
namespace Domain.Base
{
public abstract class DomainEntityId : DomainEntityId<Guid>, IDomainEntityId
......
using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
namespace Domain.Base
{
......
using System;
using System.Text.Json.Serialization;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
using Microsoft.AspNetCore.Identity;
namespace Domain.Base
......
using System;
using System.Text.Json.Serialization;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
using Microsoft.AspNetCore.Identity;
namespace Domain.Base
......
namespace PublicApi.DTO.v1
{
public class CultureDTO
{
public string Code { get; set; } = default!;
public string Name { get; set; } = default!;
}
}
\ No newline at end of file
using System;
using Contracts.DAL.Base;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
using PublicApi.DTO.v1.Identity;
namespace PublicApi.DTO.v1
......
using System;
using System.ComponentModel.DataAnnotations;
using Contracts.DAL.Base;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
namespace PublicApi.DTO.v1
{
......
......@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Contracts.DAL.Base;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
using PublicApi.DTO.v1.Identity;
namespace PublicApi.DTO.v1
......
using System;
using System.Collections.Generic;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
namespace PublicApi.DTO.v1
{
......
using System;
using System.ComponentModel.DataAnnotations;
using Contracts.DAL.Base;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
namespace PublicApi.DTO.v1.Identity
{
......
using System;
using System.ComponentModel.DataAnnotations;
using Contracts.DAL.Base;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
namespace PublicApi.DTO.v1.Identity
{
......
......@@ -6,13 +6,14 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="9.0.0" />
<PackageReference Include="com.akaver.sportmap.Contracts.Domain" Version="1.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BLL.App.DTO\BLL.App.DTO.csproj" />
<ProjectReference Include="..\Contracts.DAL.Base\Contracts.DAL.Base.csproj" />
<ProjectReference Include="..\Contracts.Domain\Contracts.Domain.csproj" />
<ProjectReference Include="..\DAL.Base\DAL.Base.csproj" />
</ItemGroup>
......
......@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using BLL.App.DTO;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
namespace PublicApi.DTO.v1
{
......
using System;
using System.Collections.Generic;
using Contracts.Domain;
using com.akaver.sportmap.Contracts.Domain;
namespace PublicApi.DTO.v1
{
......
......@@ -19,13 +19,13 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Home">
<value>Home</value>
<value>Glavnaja</value>
</data>
<data name="Privacy">
<value>Privacy</value>
<value>Privatnost</value>
</data>
<data name="GpsSessions">
<value>Gps Sessions</value>
<value>Gps Sessii</value>
</data>
<data name="Admin">
<value>Admin</value>
......
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using PublicApi.DTO.v1;
namespace WebApp.ApiControllers._1._0
{
/// <summary>
/// Culture info
/// </summary>
[Route("api/v{version:apiVersion}/[controller]")]
[ApiController]
[ApiVersion("1.0")]
public class CulturesController : ControllerBase
{
private readonly IOptions<RequestLocalizationOptions> _localizationOptions;
/// <summary>
/// Constructor
/// </summary>
/// <param name="localizationOptions"></param>
public CulturesController(IOptions<RequestLocalizationOptions> localizationOptions)
{
_localizationOptions = localizationOptions;
}
/// <summary>
/// Get the list of supported cultures
/// </summary>
/// <returns></returns>
[HttpGet]
[Produces("application/json")]
[Consumes("application/json")]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable<CultureDTO>))]
public ActionResult<IEnumerable<CultureDTO>> GetCultures()
{
var result = _localizationOptions.Value.SupportedUICultures
.Select(c => new CultureDTO()
{
Code = c.Name,
Name = c.NativeName,
}).ToList();
return Ok(result);
}
/// <summary>
/// Get the resource strings and keys
/// </summary>
/// <returns></returns>
[HttpGet("resources")]
public ActionResult<IEnumerable<string>> GetResources()
{
var res = new List<CultureDTO>();
var resourceSet =
Resources.Views.Shared._Layout.ResourceManager
.GetResourceSet(Thread.CurrentThread.CurrentUICulture,
true, true);
if (resourceSet == null)
{
return Ok(res);
}
foreach (DictionaryEntry? entry in resourceSet)
{
if (entry==null) continue;
res.Add(new CultureDTO() {Name = entry.Value.Value!.ToString()!, Code = entry.Value.Key.ToString()!});
}
return Ok(res);
}
}
}
\ No newline at end of file
......@@ -27,7 +27,7 @@
@Html.DisplayNameFor(model => model.LangStr)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.LangStr.Id)
@Html.DisplayFor(model => model.LangStr!.Id)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.CreatedBy)
......
......@@ -26,7 +26,7 @@
@Html.DisplayNameFor(model => model.LangStr)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.LangStr.Id)
@Html.DisplayFor(model => model.LangStr!.Id)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.CreatedBy)
......
......@@ -35,7 +35,7 @@
@Html.DisplayFor(modelItem => item.Value)
</td>
<td>
@Html.DisplayFor(modelItem => item.LangStr.Id)
@Html.DisplayFor(modelItem => item.LangStr!.Id)
</td>
<td>
......
......@@ -97,16 +97,14 @@ namespace WebApp
};
});
var supportedCultures = Configuration
.GetSection("SupportedCultures")
.GetChildren()
.Select(x => new CultureInfo(x.Value))
.ToArray();
services.Configure<RequestLocalizationOptions>(options =>
{
// TODO: Move to configuration
var supportedCultures = new[]
{
new CultureInfo("en-GB"),
new CultureInfo("et-EE"),
new CultureInfo("ru-RU"),
};
// datetime and currency support
options.SupportedCultures = supportedCultures;
// UI translated strings
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment