diff --git a/components/configurable-query/configurable-query.component.html b/components/configurable-query/configurable-query.component.html
index 3fb4a121..397fcdb4 100644
--- a/components/configurable-query/configurable-query.component.html
+++ b/components/configurable-query/configurable-query.component.html
@@ -70,9 +70,11 @@
+
-
;
- constructor(private fb: FormBuilder, private cd: ChangeDetectorRef) {
+ constructor(
+ private i18n: NzI18nService,
+ private fb: FormBuilder,
+ private cd: ChangeDetectorRef
+ ) {
this.queryForm = this.fb.group({});
}
@@ -107,6 +113,10 @@ export class NzxConfigurableQueryComponent
}
ngOnInit(): void {
+ this.i18n.localeChange.pipe(takeUntil(this.destroy$)).subscribe(() => {
+ this.locale = this.i18n.getLocaleData('Query');
+ this.cd.markForCheck();
+ });
this.queryForm.valueChanges
.pipe(takeUntil(this.destroy$))
.subscribe((val) => {
diff --git a/components/configurable-query/configurable-query.module.ts b/components/configurable-query/configurable-query.module.ts
index 3e37324e..e9e7af26 100644
--- a/components/configurable-query/configurable-query.module.ts
+++ b/components/configurable-query/configurable-query.module.ts
@@ -12,6 +12,7 @@ import { NzSelectModule } from 'ng-zorro-antd/select';
import { NzxConfigurableQueryComponent } from './configurable-query.component';
import { ControlDirective } from './control.directive';
+import { NzI18nModule } from 'ng-zorro-antd/i18n';
@NgModule({
declarations: [NzxConfigurableQueryComponent, ControlDirective],
@@ -26,6 +27,7 @@ import { ControlDirective } from './control.directive';
NzSelectModule,
NzDatePickerModule,
NzIconModule,
+ NzI18nModule,
],
exports: [ControlDirective, NzxConfigurableQueryComponent],
})
diff --git a/components/i18n/index.ts b/components/i18n/index.ts
new file mode 100644
index 00000000..97717c1c
--- /dev/null
+++ b/components/i18n/index.ts
@@ -0,0 +1,6 @@
+/**
+ * Use of this source code is governed by an MIT-style license that can be
+ * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
+ */
+
+export * from './public-api';
diff --git a/components/i18n/languages/en_US.ts b/components/i18n/languages/en_US.ts
new file mode 100644
index 00000000..5223a4ff
--- /dev/null
+++ b/components/i18n/languages/en_US.ts
@@ -0,0 +1,9 @@
+export default {
+ locale: 'en',
+ Query: {
+ query: 'query',
+ reset: 'reset',
+ expand: 'expand',
+ collapse: 'collapse',
+ },
+};
diff --git a/components/i18n/languages/zh_CN.ts b/components/i18n/languages/zh_CN.ts
new file mode 100644
index 00000000..8769dc0f
--- /dev/null
+++ b/components/i18n/languages/zh_CN.ts
@@ -0,0 +1,9 @@
+export default {
+ locale: 'zh-cn',
+ Query: {
+ query: '查询',
+ reset: '重置',
+ expand: '展开',
+ collapse: '收起',
+ },
+};
diff --git a/components/i18n/ng-package.json b/components/i18n/ng-package.json
new file mode 100644
index 00000000..789c95e4
--- /dev/null
+++ b/components/i18n/ng-package.json
@@ -0,0 +1,5 @@
+{
+ "lib": {
+ "entryFile": "public-api.ts"
+ }
+}
diff --git a/components/i18n/nz-i18n.interface.ts b/components/i18n/nz-i18n.interface.ts
new file mode 100644
index 00000000..1889748c
--- /dev/null
+++ b/components/i18n/nz-i18n.interface.ts
@@ -0,0 +1,6 @@
+export interface NzxQueryI18nInterface {
+ query: string;
+ reset: string;
+ expand: string;
+ collapse: string;
+}
diff --git a/components/i18n/public-api.ts b/components/i18n/public-api.ts
new file mode 100644
index 00000000..b0cdb9bd
--- /dev/null
+++ b/components/i18n/public-api.ts
@@ -0,0 +1,4 @@
+export * from './nz-i18n.interface';
+
+export { default as nzx_en_US } from './languages/en_US';
+export { default as nzx_zh_CN } from './languages/zh_CN';
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index cbe91aad..960388d7 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -13,6 +13,7 @@ import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzConfig, NZ_CONFIG } from 'ng-zorro-antd/core/config';
import { NzxConfig, NZX_CONFIG } from 'ng-zorro-antd-extension/core/config';
import { NzxAclModule } from 'ng-zorro-antd-extension/acl';
+import { nzx_zh_CN } from 'ng-zorro-antd-extension/i18n';
registerLocaleData(zh);
@@ -27,6 +28,11 @@ const ngZorroExtensionConfig: NzxConfig = {
},
};
+const customLanguagePack = {
+ zh_CN,
+ ...nzx_zh_CN,
+};
+
@NgModule({
declarations: [],
imports: [
@@ -39,7 +45,7 @@ const ngZorroExtensionConfig: NzxConfig = {
],
providers: [
...DOCGENI_SITE_PROVIDERS,
- { provide: NZ_I18N, useValue: zh_CN },
+ { provide: NZ_I18N, useValue: customLanguagePack },
{ provide: NZ_CONFIG, useValue: ngZorroConfig },
{ provide: NZX_CONFIG, useValue: ngZorroExtensionConfig },
],