From efed02689e46da33720beaf01b77431748a437ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 1 May 2018 14:34:05 +0300 Subject: [PATCH] Localized default 4xx messages --- npm/packs/jquery/src/abp.ajax.js | 22 ++++++++++--------- ...pplicationConfigurationScriptController.cs | 6 +++-- .../Localization/Resources/AbpUi/en.json | 12 ++++++---- .../Localization/Resources/AbpUi/tr.json | 10 ++++++--- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/npm/packs/jquery/src/abp.ajax.js b/npm/packs/jquery/src/abp.ajax.js index 3eb701dcc0..605b254a7b 100644 --- a/npm/packs/jquery/src/abp.ajax.js +++ b/npm/packs/jquery/src/abp.ajax.js @@ -174,15 +174,17 @@ return abp.ajax.ajaxSendHandler(event, request, settings); }); - //abp.event.on('abp.dynamicScriptsInitialized', function () { - // abp.ajax.defaultError.message = abp.localization.abpWeb('DefaultError'); - // abp.ajax.defaultError.details = abp.localization.abpWeb('DefaultErrorDetail'); - // abp.ajax.defaultError401.message = abp.localization.abpWeb('DefaultError401'); - // abp.ajax.defaultError401.details = abp.localization.abpWeb('DefaultErrorDetail401'); - // abp.ajax.defaultError403.message = abp.localization.abpWeb('DefaultError403'); - // abp.ajax.defaultError403.details = abp.localization.abpWeb('DefaultErrorDetail403'); - // abp.ajax.defaultError404.message = abp.localization.abpWeb('DefaultError404'); - // abp.ajax.defaultError404.details = abp.localization.abpWeb('DefaultErrorDetail404'); - //}); + abp.event.on('abp.configurationInitialized', function () { + var l = abp.localization.getResource('AbpUi'); + + abp.ajax.defaultError.message = l('DefaultErrorMessage'); + abp.ajax.defaultError.details = l('DefaultErrorMessageDetail'); + abp.ajax.defaultError401.message = l('DefaultErrorMessage401'); + abp.ajax.defaultError401.details = l('DefaultErrorMessage401Detail'); + abp.ajax.defaultError403.message = l('DefaultErrorMessage403'); + abp.ajax.defaultError403.details = l('DefaultErrorMessage403Detail'); + abp.ajax.defaultError404.message = l('DefaultErrorMessage404'); + abp.ajax.defaultError404.details = l('DefaultErrorMessage404Detail'); + }); })(jQuery); \ No newline at end of file diff --git a/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs b/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs index 9698f3f302..0f61a87940 100644 --- a/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs +++ b/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs @@ -35,9 +35,11 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations var script = new StringBuilder(); script.AppendLine("(function(){"); - + script.AppendLine(); script.AppendLine($"$.extend(true, abp, {_jsonSerializer.Serialize(config, indented: Debugger.IsAttached)})"); - + script.AppendLine(); + script.AppendLine("abp.event.trigger('abp.configurationInitialized');"); + script.AppendLine(); script.Append("})();"); return script.ToString(); diff --git a/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json b/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json index 4d34beb230..6b0f92a800 100644 --- a/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json +++ b/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json @@ -4,10 +4,14 @@ "InternalServerErrorMessage": "An internal error occurred during your request!", "ValidationErrorMessage": "Your request is not valid!", "ValidationNarrativeErrorMessageTitle": "The following errors were detected during validation.", - "DefaultErrorMessage": "An error has occurred!", - "DefaultErrorMessage401": "You are not authenticated! You should sign in to perform this operation.", - "DefaultErrorMessage403": "You are not allowed to perform this operation!", - "DefaultErrorMessage404": "The resource requested could not found on the server!", + "DefaultErrorMessage": "An error has been occurred!", + "DefaultErrorMessageDetail": "Error detail not sent by server.", + "DefaultErrorMessage401": "You are not authenticated!", + "DefaultErrorMessage401Detail": "You should sign in to perform this operation.", + "DefaultErrorMessage403": "You are not authorized!", + "DefaultErrorMessage403Detail": "You are not allowed to perform this operation!", + "DefaultErrorMessage404": "Resource not found!", + "DefaultErrorMessage404Detail": "The resource requested could not found on the server!", "EntityNotFoundErrorMessage": "There is no entity {0} with id = {1}!", "AreYouSure": "Are you sure?", "Cancel": "Cancel", diff --git a/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json b/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json index 0422a04ad1..f2d55a20b5 100644 --- a/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json +++ b/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json @@ -5,9 +5,13 @@ "ValidationErrorMessage": "İşleminiz geçerli değil!", "ValidationNarrativeErrorMessageTitle": "Aşağıdaki hatalar doğrulama sırasında tespit edilmiştir.", "DefaultErrorMessage": "Bir hata oluştu!", - "DefaultErrorMessage401": "Giriş yapılmamış! Bu işlemi gerçekleştirmek için uygulamaya giriş yapmalısınız.", - "DefaultErrorMessage403": "Bu işlemi gerçekleştirmek için gereken izne sahip değilsiniz!", - "DefaultErrorMessage404": "İstenilen kaynak sunucuda bulunamadı!", + "DefaultErrorMessageDetail": "Hatanın ne olduğu sunucu tarafından gönderilmedi.", + "DefaultErrorMessage401": "Giriş yapılmamış!", + "DefaultErrorMessage401Detail": "Bu işlemi gerçekleştirmek için uygulamaya giriş yapmalısınız.", + "DefaultErrorMessage403": "İzinsiz işlem!", + "DefaultErrorMessage403Detail": "Bu işlemi gerçekleştirmek için gereken izne sahip değilsiniz.", + "DefaultErrorMessage404": "Kaynak bulunamadı!", + "DefaultErrorMessage404Detail": "İstenilen kaynak sunucuda bulunamadı.", "EntityNotFoundErrorMessage": "Id değeri {1} olan {0} türünden bir nesne bulunamadı!", "AreYouSure": "Emin misiniz?", "Cancel": "Vazgeç",