abp.sweet-alert.js - 没有使用v3.5.0的按钮本地化

时间:2018-03-08 13:59:42

标签: localization aspnetboilerplate sweetalert2

我有一个ABP 3.5.0 ASP.NET Core和Angular的项目,包括Sweetalert 2.0.8。

按下删除按钮(例如角色或租户)时,确认对话框不会本地化按钮取消和是。我今天试图获得一个新的模板,同样的行为。

我试图按照预期更改abp.sweet-alert.js,但没有运气: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2708

在这里,您可以看到今天的新模板。我试图获得确认按钮的意大利语翻译。正如您在菜单上看到的那样,“关于”已被翻译。

SEE HERE PICTURE from fresh template

1 个答案:

答案 0 :(得分:0)

好消息,我解决了这个问题!

打开 root.module.ts 并将以下行添加到AppPreBootstrap.run()回调方法中。

  

abp.event.trigger(' abp.dynamicScriptsInitialized&#39);

root.module.ts 的最终外观在

之下
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule, Injector, APP_INITIALIZER, LOCALE_ID } from '@angular/core';

import { AbpModule, ABP_HTTP_PROVIDER } from '@abp/abp.module';

import { SharedModule } from '@shared/shared.module';
import { ServiceProxyModule } from '@shared/service-proxies/service-proxy.module';
import { RootRoutingModule } from './root-routing.module';

import { AppConsts } from '@shared/AppConsts';
import { AppSessionService } from '@shared/session/app-session.service';
import { API_BASE_URL } from '@shared/service-proxies/service-proxies';

import { RootComponent } from './root.component';
import { AppPreBootstrap } from './AppPreBootstrap';
import { ModalModule } from 'ngx-bootstrap';


export function appInitializerFactory(injector: Injector) {
    return () => {

        abp.ui.setBusy();
        return new Promise<boolean>((resolve, reject) => {
            AppPreBootstrap.run(() => {
                abp.event.trigger('abp.dynamicScriptsInitialized');
                var appSessionService: AppSessionService = injector.get(AppSessionService);
                appSessionService.init().then(
                    (result) => {
                        abp.ui.clearBusy();
                        resolve(result);
                    },
                    (err) => {
                        abp.ui.clearBusy();
                        reject(err);
                    }
                );
            });
        });
    }
}

export function getRemoteServiceBaseUrl(): string {
    return AppConsts.remoteServiceBaseUrl;
}

export function getCurrentLanguage(): string {
    return abp.localization.currentLanguage.name;
}

@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        SharedModule.forRoot(),
        ModalModule.forRoot(),
        AbpModule,
        ServiceProxyModule,
        RootRoutingModule
    ],
    declarations: [
        RootComponent
    ],
    providers: [
        ABP_HTTP_PROVIDER,
        { provide: API_BASE_URL, useFactory: getRemoteServiceBaseUrl },
        {
            provide: APP_INITIALIZER,
            useFactory: appInitializerFactory,
            deps: [Injector],
            multi: true
        },
        {
            provide: LOCALE_ID,
            useFactory: getCurrentLanguage
        }
    ],
    bootstrap: [RootComponent]
})
export class RootModule {

}
  • 证明:

Abp Angular SweetAlert Localization Fix

  • 问题:

https://github.com/aspnetboilerplate/module-zero-core-template/issues/200

  • 修复此问题:

https://github.com/aspnetboilerplate/module-zero-core-template/commit/8752cd1b4f33afc1c8330f9990f3a6395b14bfeb