19 lines
564 B
C#
19 lines
564 B
C#
using ExpenseTracker.Application.Common.Interfaces.Services;
|
|
using ExpenseTracker.Domain.Enums;
|
|
|
|
namespace ExpenseTracker.Api.Services;
|
|
|
|
public class InternationalizationService : IInternationalizationService
|
|
{
|
|
private readonly HttpContext _httpContext;
|
|
|
|
public InternationalizationService(IHttpContextAccessor httpContextAccessor)
|
|
{
|
|
_httpContext = httpContextAccessor.HttpContext!;
|
|
|
|
Currency = Currency.FromName(_httpContext.Request.Headers["Accept-Currency"]) ?? Currency.Default;
|
|
}
|
|
|
|
public Currency Currency { get; init; }
|
|
}
|