Skip to content

Commit

Permalink
Merge pull request #862 from leehom0123/master
Browse files Browse the repository at this point in the history
本地化支持修改
  • Loading branch information
colinin authored Aug 24, 2023
2 parents 251938c + 913d1ea commit 7c72807
Show file tree
Hide file tree
Showing 79 changed files with 6,746 additions and 3,726 deletions.
1 change: 1 addition & 0 deletions apps/vue/run.bat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
title abp-next-admin-vben
npm run dev
5 changes: 3 additions & 2 deletions apps/vue/src/api/localization/languages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defAbpHttp } from '/@/utils/http/abp';
import { LanguageListResult, LanguageCreate, LanguageUpdate, Language } from './model/languagesModel';
import { LanguageListResult, LanguageCreate, LanguageUpdate, Language, GetLanguageWithFilter } from './model/languagesModel';

const remoteServiceName = 'LocalizationManagement';
const controllerName = 'Language';
Expand All @@ -8,9 +8,10 @@ enum Api {
GetList = '/api/abp/localization/languages',
}

export const getList = () => {
export const getList = (input: GetLanguageWithFilter) => {
return defAbpHttp.get<LanguageListResult>({
url: Api.GetList,
params: input,
});
};

Expand Down
4 changes: 4 additions & 0 deletions apps/vue/src/api/localization/model/languagesModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ export interface LanguagePagedResult extends PagedResultDto<Language> {}
export interface GetLanguagePagedRequest extends PagedAndSortedResultRequestDto {
filter?: string;
}

export interface GetLanguageWithFilter {
filter?: string;
}
4 changes: 4 additions & 0 deletions apps/vue/src/api/localization/model/resourcesModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ export interface ResourcePagedResult extends PagedResultDto<Resource> {}
export interface GetResourcePagedRequest extends PagedAndSortedResultRequestDto {
filter?: string;
}

export interface GetResourceWithFilter {
filter?: string;
}
5 changes: 3 additions & 2 deletions apps/vue/src/api/localization/resources.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defAbpHttp } from '/@/utils/http/abp';
import { ResourceListResult, Resource, ResourceCreate, ResourceUpdate } from './model/resourcesModel';
import { ResourceListResult, Resource, ResourceCreate, ResourceUpdate, GetResourceWithFilter } from './model/resourcesModel';

const remoteServiceName = 'LocalizationManagement';
const controllerName = 'Resource';
Expand All @@ -8,9 +8,10 @@ enum Api {
GetList = '/api/abp/localization/resources',
}

export const getList = () => {
export const getList = (input: GetResourceWithFilter) => {
return defAbpHttp.get<ResourceListResult>({
url: Api.GetList,
params: input,
});
};

Expand Down
3 changes: 3 additions & 0 deletions apps/vue/src/utils/http/axios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ const transform: AxiosTransform = {
if ((config as Recordable)?.requestOptions?.withAcceptLanguage !== false) {
const localeStore = useLocaleStoreWithOut();
config.headers['Accept-Language'] = localeStore.getLocale;
if (config.headers['Accept-Language'] == 'zh_CN') {
config.headers['Accept-Language'] = 'zh-Hans';
}
}
return config;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
function fetchLanguages() {
const form = getForm();
return form.validate().then(() => {
return getList().then((res) => {
return form.validate().then((input) => {
return getList(input).then((res) => {
setTableData(res.items);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
import { getList, GetAsyncByName, DeleteAsyncByName } from '/@/api/localization/resources';
import { Resource } from '/@/api/localization/model/resourcesModel';
import { getDataColumns } from './TableData';
import { reactive } from 'vue';
import ResourceModal from './ResourceModal.vue';
const { createConfirm, createMessage } = useMessage();
const { L } = useLocalization(['LocalizationManagement', 'AbpLocalization', 'AbpUi']);
Expand All @@ -72,7 +74,7 @@
component: 'Input',
label: L('Search'),
colProps: { span: 24 },
defaultValue: '',
defaultValue: ''
},
],
submitFunc: fetchResources,
Expand All @@ -87,8 +89,8 @@
function fetchResources() {
const form = getForm();
return form.validate().then(() => {
return getList().then((res) => {
return form.validate().then((input) => {
return getList(input).then((res) => {
setTableData(res.items);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useLocalization } from '/@/hooks/abp/useLocalization';
import { FormProps } from '/@/components/Form';
import { NotificationReadState } from '/@/api/messages/model/notificationsModel';

const { L } = useLocalization(['AbpMessageService', 'AbpUi']);
const { L } = useLocalization(['AbpMessageService', 'Notifications', 'AbpUi']);

export function getSearchFormSchemas(): Partial<FormProps> {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useLocalization } from '/@/hooks/abp/useLocalization';
import { BasicColumn } from '/@/components/Table';
import { formatToDateTime } from '/@/utils/dateUtil';

const { L } = useLocalization('AbpMessageService');
const { L } = useLocalization('Notifications');

export function getDataColumns(): BasicColumn[] {
return [
Expand Down
2 changes: 1 addition & 1 deletion apps/vue/src/views/saas/tenant/components/TenantTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
import TenantModal from './TenantModal.vue';
import ConnectionTableModal from './ConnectionTableModal.vue';
const { L } = useLocalization(['AbpSaas', 'AbpFeatureManagement']);
const { L } = useLocalization(['AbpSaas', 'AbpFeatureManagement','WeChat']);
const { hasPermission } = usePermission();
const tableElRef = ref<Nullable<TableActionType>>(null);
const [registerConnectModal, { openModal: openConnectModal }] = useModal();
Expand Down
25 changes: 9 additions & 16 deletions aspnet-core/migrate-database.bat
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
@echo off
cls
set stime=8

start .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.DbMigrator admin --run
ping -n %stime% 127.1 >nul
start .\migrate-db-cmd.bat LY.MicroService.AuthServer.DbMigrator auth-server --run
ping -n %stime% 127.1 >nul
start .\migrate-db-cmd.bat LY.MicroService.IdentityServer.DbMigrator identityserver4-admin --run
ping -n %stime% 127.1 >nul
start .\migrate-db-cmd.bat LY.MicroService.LocalizationManagement.DbMigrator localization --run
ping -n %stime% 127.1 >nul
start .\migrate-db-cmd.bat LY.MicroService.Platform.DbMigrator platform --run
ping -n %stime% 127.1 >nul
start .\migrate-db-cmd.bat LY.MicroService.RealtimeMessage.DbMigrator messages --run
ping -n %stime% 127.1 >nul
start .\migrate-db-cmd.bat LY.MicroService.TaskManagement.DbMigrator task-management --run
ping -n %stime% 127.1 >nul
start .\migrate-db-cmd.bat LY.MicroService.WebhooksManagement.DbMigrator webhooks-management --run
call .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.DbMigrator admin --run
call .\migrate-db-cmd.bat LY.MicroService.AuthServer.DbMigrator auth-server --run
call .\migrate-db-cmd.bat LY.MicroService.IdentityServer.DbMigrator identityserver4-admin --run
call .\migrate-db-cmd.bat LY.MicroService.LocalizationManagement.DbMigrator localization --run
call .\migrate-db-cmd.bat LY.MicroService.Platform.DbMigrator platform --run
call .\migrate-db-cmd.bat LY.MicroService.RealtimeMessage.DbMigrator messages --run
call .\migrate-db-cmd.bat LY.MicroService.TaskManagement.DbMigrator task-management --run
call .\migrate-db-cmd.bat LY.MicroService.WebhooksManagement.DbMigrator webhooks-management --run
pause
17 changes: 10 additions & 7 deletions aspnet-core/migrate-db-cmd.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
@echo off
cls
chcp 65001

title %2

@echo %2 migration running
@echo %2 migrating

cd .\migrations\%1

Expand All @@ -15,14 +14,18 @@ if '%3' equ '' goto run
exit

:run
dotnet run
pause
exit
dotnet run
goto end

:restore
dotnet restore
exit
goto end

:efu
dotnet ef databse update
exit
goto end

:end
cd ..\..\
@echo %2 migrated
@echo --------
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public class MessagesHub : AbpHub

protected IUserGroupStore UserGroupStore => LazyServiceProvider.LazyGetRequiredService<IUserGroupStore>();

protected AbpExceptionHandlingOptions ExceptionHandlingOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<AbpExceptionHandlingOptions>>().Value;


public override async Task OnConnectedAsync()
{
await base.OnConnectedAsync();
Expand Down Expand Up @@ -167,8 +170,8 @@ await SendMessageAsync(
{
var errorInfo = ErrorInfoConverter.Convert(ex, options =>
{
options.SendExceptionsDetailsToClients = false;
options.SendStackTraceToClients = false;
options.SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients;
});

await SendMessageAsync(
Expand Down Expand Up @@ -230,8 +233,8 @@ protected async virtual Task<string> SendMessageAsync(string methodName, ChatMes
{
var errorInfo = ErrorInfoConverter.Convert(ex, options =>
{
options.SendExceptionsDetailsToClients = false;
options.SendStackTraceToClients = false;
options.SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients;
});
if (!chatMessage.GroupId.IsNullOrWhiteSpace())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ public class SignalRMessageSenderProvider : MessageSenderProviderBase
private readonly AbpIMSignalROptions _options;

private readonly IHubContext<MessagesHub> _hubContext;
private readonly AbpExceptionHandlingOptions _exceptionHandlingOptions;

public SignalRMessageSenderProvider(
IHubContext<MessagesHub> hubContext,
IAbpLazyServiceProvider serviceProvider,
IOptions<AbpIMSignalROptions> options)
IOptions<AbpIMSignalROptions> options,
IOptions<AbpExceptionHandlingOptions> exceptionHandlingOptions)
: base(serviceProvider)
{
_options = options.Value;
_exceptionHandlingOptions = exceptionHandlingOptions.Value;
_hubContext = hubContext;
}

Expand Down Expand Up @@ -99,8 +102,8 @@ protected async virtual Task TrySendBusinessErrorMessage(Exception ex, ChatMessa
{
var errorInfo = errorInfoConverter.Convert(ex, options =>
{
options.SendExceptionsDetailsToClients = false;
options.SendStackTraceToClients = false;
options.SendExceptionsDetailsToClients = _exceptionHandlingOptions.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = _exceptionHandlingOptions.SendStackTraceToClients;
});
if (!chatMessage.GroupId.IsNullOrWhiteSpace())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace LINGYUN.Abp.AspNetCore.Mvc.Localization
{
public class GetLanguageWithFilterDto
{
public string Filter { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace LINGYUN.Abp.AspNetCore.Mvc.Localization
{
public class GetResourceWithFilterDto
{
public string Filter { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ namespace LINGYUN.Abp.AspNetCore.Mvc.Localization
{
public interface ILanguageAppService : IApplicationService
{
Task<ListResultDto<LanguageDto>> GetListAsync();
Task<ListResultDto<LanguageDto>> GetListAsync(GetLanguageWithFilterDto input);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ namespace LINGYUN.Abp.AspNetCore.Mvc.Localization
{
public interface IResourceAppService : IApplicationService
{
Task<ListResultDto<ResourceDto>> GetListAsync();
Task<ListResultDto<ResourceDto>> GetListAsync(GetResourceWithFilterDto input);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
using Microsoft.AspNetCore.Authorization;
using System.Linq;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Volo.Abp;
using System.Threading.Tasks;

Check warning on line 10 in aspnet-core/modules/localization/LINGYUN.Abp.AspNetCore.Mvc.Localization/LINGYUN/Abp/AspNetCore/Mvc/Localization/LanguageAppService.cs

View workflow job for this annotation

GitHub Actions / Build

The using directive for 'System.Threading.Tasks' appeared previously in this namespace
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Localization;
using Volo.Abp.Localization.External;

namespace LINGYUN.Abp.AspNetCore.Mvc.Localization
{
Expand All @@ -16,9 +24,12 @@ public LanguageAppService(ILanguageProvider languageProvider)
_languageProvider = languageProvider;
}

public async virtual Task<ListResultDto<LanguageDto>> GetListAsync()
public async virtual Task<ListResultDto<LanguageDto>> GetListAsync(GetLanguageWithFilterDto input)
{
var languages = await _languageProvider.GetLanguagesAsync();
var languages = (await _languageProvider.GetLanguagesAsync())
.WhereIf(!input.Filter.IsNullOrWhiteSpace(), x => x.CultureName.IndexOf(input.Filter, StringComparison.OrdinalIgnoreCase) >= 0
|| x.UiCultureName.IndexOf(input.Filter, StringComparison.OrdinalIgnoreCase) >= 0
|| x.DisplayName.IndexOf(input.Filter, StringComparison.OrdinalIgnoreCase) >= 0);

return new ListResultDto<LanguageDto>(
languages.Select(l => new LanguageDto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public LanguageController(ILanguageAppService service)
}

[HttpGet]
public virtual Task<ListResultDto<LanguageDto>> GetListAsync()
public virtual Task<ListResultDto<LanguageDto>> GetListAsync(GetLanguageWithFilterDto input)
{
return _service.GetListAsync();
return _service.GetListAsync(input);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using System.Linq;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Volo.Abp;
using System.Threading.Tasks;

Check warning on line 10 in aspnet-core/modules/localization/LINGYUN.Abp.AspNetCore.Mvc.Localization/LINGYUN/Abp/AspNetCore/Mvc/Localization/ResourceAppService.cs

View workflow job for this annotation

GitHub Actions / Build

The using directive for 'System.Threading.Tasks' appeared previously in this namespace
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
Expand All @@ -23,12 +29,14 @@ public ResourceAppService(
_externalLocalizationStore = externalLocalizationStore;
}

public virtual async Task<ListResultDto<ResourceDto>> GetListAsync()
public virtual async Task<ListResultDto<ResourceDto>> GetListAsync(GetResourceWithFilterDto input)
{
var externalResources = await _externalLocalizationStore.GetResourcesAsync();
var externalResources = (await _externalLocalizationStore.GetResourcesAsync())
.WhereIf(!input.Filter.IsNullOrWhiteSpace(), x => x.ResourceName.IndexOf(input.Filter, StringComparison.OrdinalIgnoreCase) >= 0);

var resources = _localizationOptions
.Resources
.WhereIf(!input.Filter.IsNullOrWhiteSpace(), x => x.Value.ResourceName.IndexOf(input.Filter, StringComparison.OrdinalIgnoreCase) >= 0)
.Select(x => new ResourceDto
{
Name = x.Value.ResourceName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public ResourceController(IResourceAppService service)
}

[HttpGet]
public virtual Task<ListResultDto<ResourceDto>> GetListAsync()
public virtual Task<ListResultDto<ResourceDto>> GetListAsync(GetResourceWithFilterDto input)
{
return _service.GetListAsync();
return _service.GetListAsync(input);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
<RootNamespace />
</PropertyGroup>

<ItemGroup>
<None Remove="LINGYUN\Abp\Notifications\DynamicNotificationDefinitionStore.cs~RF299208b7.TMP" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Volo.Abp.Caching" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="$(VoloAbpPackageVersion)" />
Expand Down
Loading

0 comments on commit 7c72807

Please sign in to comment.