Browse Source

added localization

pull/2097/head
Yunus Emre Kalkan 7 years ago
parent
commit
8cd7470316
  1. 10
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Controllers/ErrorController.cs
  2. 1
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json
  3. 1
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json

10
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Controllers/ErrorController.cs

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.ExceptionHandling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Error;
@ -12,14 +14,18 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers
{
private readonly IExceptionToErrorInfoConverter _errorInfoConverter;
private readonly IHttpExceptionStatusCodeFinder _statusCodeFinder;
private readonly IStringLocalizer<AbpUiResource> _localizer;
private readonly AbpErrorPageOptions _abpErrorPageOptions;
public ErrorController(
IExceptionToErrorInfoConverter exceptionToErrorInfoConverter,
IHttpExceptionStatusCodeFinder httpExceptionStatusCodeFinder, IOptions<AbpErrorPageOptions> abpErrorPageOptions)
IHttpExceptionStatusCodeFinder httpExceptionStatusCodeFinder,
IOptions<AbpErrorPageOptions> abpErrorPageOptions,
IStringLocalizer<AbpUiResource> localizer)
{
_errorInfoConverter = exceptionToErrorInfoConverter;
_statusCodeFinder = httpExceptionStatusCodeFinder;
_localizer = localizer;
_abpErrorPageOptions = abpErrorPageOptions.Value;
}
@ -29,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers
var exception = exHandlerFeature != null
? exHandlerFeature.Error
: new Exception("Unhandled exception!"); //TODO: Localize?
: new Exception(_localizer["UnhandledException"]);
var errorInfo = _errorInfoConverter.Convert(exception);

1
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json

@ -47,6 +47,7 @@
"ChangePassword": "Change password",
"PersonalInfo": "My profile",
"AreYouSureYouWantToCancelEditingWarningMessage": "You have unsaved changes.",
"UnhandledException": "Unhandled exception!",
"401Message": "Unauthorized",
"403Message": "Forbidden",
"404Message": "Page not found",

1
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json

@ -47,6 +47,7 @@
"ChangePassword": "Şifre değiştir",
"PersonalInfo": "Profilim",
"AreYouSureYouWantToCancelEditingWarningMessage": "Kaydedilmemiş değişiklikler var.",
"UnhandledException": "Yakalanmamış hata!",
"401Message": "Yetkisiz",
"403Message": "Yasak",
"404Message": "Sayfa bulunamadı",

Loading…
Cancel
Save