Skip to content

Commit a223589

Browse files
author
alirizaadiyahsi
authored
Merge branch 'master' into issue-68
2 parents c0bc86d + 3b055a9 commit a223589

File tree

268 files changed

+40084
-3110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+40084
-3110
lines changed

angular/package-lock.json

Lines changed: 10842 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@types/moment": "^2.13.0",
3232
"@types/moment-timezone": "^0.2.34",
3333
"@types/toastr": "^2.1.33",
34-
"abp-ng2-module": "^3.2.1",
34+
"abp-ng2-module": "^3.2.2",
3535
"abp-web-resources": "^3.8.2",
3636
"animate.css": "^3.5.2",
3737
"block-ui": "^2.70.1",

angular/src/AppPreBootstrap.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export class AppPreBootstrap {
2626
}).done(result => {
2727
AppConsts.appBaseUrl = result.appBaseUrl;
2828
AppConsts.remoteServiceBaseUrl = result.remoteServiceBaseUrl;
29-
29+
AppConsts.localeMappings = result.localeMappings;
30+
3031
callback();
3132
});
3233
}

angular/src/app/roles/roles.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h2>
4545
</table>
4646

4747
<div class="text-align: center;" *ngIf="totalItems > pageSize">
48-
<pagination-controls (pageChange)="getDataPage($event)" id="server"></pagination-controls>
48+
<abp-pagination-controls (pageChange)="getDataPage($event)" id="server"></abp-pagination-controls>
4949
</div>
5050
<button type="button" data-toggle="modal" class="btn btn-primary btn-circle waves-effect waves-circle waves-float pull-right" (click)="createRole()">
5151
<i class="material-icons">add</i>
@@ -56,4 +56,4 @@ <h2>
5656
</div>
5757

5858
<create-role-modal #createRoleModal (modalSave)="refresh()"></create-role-modal>
59-
<edit-role-modal #editRoleModal (modalSave)="refresh()"></edit-role-modal>
59+
<edit-role-modal #editRoleModal (modalSave)="refresh()"></edit-role-modal>

angular/src/app/tenants/tenants.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h2>
5252
</table>
5353

5454
<div class="text-align: center;" *ngIf="totalItems > pageSize">
55-
<pagination-controls (pageChange)="getDataPage($event)" id="server"></pagination-controls>
55+
<abp-pagination-controls (pageChange)="getDataPage($event)" id="server"></abp-pagination-controls>
5656
</div>
5757
<button type="button" data-toggle="modal" class="btn btn-primary btn-circle waves-effect waves-circle waves-float pull-right" (click)="createTenant()">
5858
<i class="material-icons">add</i>

angular/src/app/users/edit-user/edit-user.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ <h4 class="modal-title">
9999
</form>
100100
</div>
101101
</div>
102-
</div>
102+
</div>

angular/src/app/users/users.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h2>
5656
<!-- ******************************************************** -->
5757

5858
<div class="text-align: center;" *ngIf="totalItems > pageSize">
59-
<pagination-controls (pageChange)="getDataPage($event)" id="server"></pagination-controls>
59+
<abp-pagination-controls (pageChange)="getDataPage($event)" id="server"></abp-pagination-controls>
6060
</div>
6161
<button type="button" data-toggle="modal" class="btn btn-primary btn-circle waves-effect waves-circle waves-float pull-right" (click)="createUser()">
6262
<i class="material-icons">add</i>
@@ -67,4 +67,4 @@ <h2>
6767
</div>
6868

6969
<create-user-modal #createUserModal (modalSave)="refresh()"></create-user-modal>
70-
<edit-user-modal #editUserModal (modalSave)="refresh()"></edit-user-modal>
70+
<edit-user-modal #editUserModal (modalSave)="refresh()"></edit-user-modal>

angular/src/assets/appconfig.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
{
22
"remoteServiceBaseUrl": "http://localhost:21021",
3-
"appBaseUrl": "http://localhost:4200"
4-
}
3+
"appBaseUrl": "http://localhost:4200",
4+
"localeMappings": [
5+
{
6+
"from": "pt-BR",
7+
"to": "pt"
8+
},
9+
{
10+
"from": "zh-CN",
11+
"to": "zh"
12+
},
13+
{
14+
"from": "he-IL",
15+
"to": "he"
16+
}
17+
]
18+
}

angular/src/root.module.ts

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BrowserModule } from '@angular/platform-browser';
22
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
33
import { NgModule, Injector, APP_INITIALIZER, LOCALE_ID } from '@angular/core';
4-
import { PlatformLocation } from '@angular/common';
4+
import { PlatformLocation, registerLocaleData } from '@angular/common';
55

66
import { AbpModule } from '@abp/abp.module';
77
import { AbpHttpInterceptor } from '@abp/abpHttpInterceptor';
@@ -20,6 +20,8 @@ import { AppPreBootstrap } from './AppPreBootstrap';
2020
import { ModalModule } from 'ngx-bootstrap';
2121
import { HttpClientModule } from '@angular/common/http';
2222

23+
import * as _ from 'lodash';
24+
2325
export function appInitializerFactory(injector: Injector,
2426
platformLocation: PlatformLocation) {
2527
return () => {
@@ -35,7 +37,17 @@ export function appInitializerFactory(injector: Injector,
3537
appSessionService.init().then(
3638
(result) => {
3739
abp.ui.clearBusy();
38-
resolve(result);
40+
41+
if (shouldLoadLocale()) {
42+
let angularLocale = convertAbpLocaleToAngularLocale(abp.localization.currentLanguage.name);
43+
import(`@angular/common/locales/${angularLocale}.js`)
44+
.then(module => {
45+
registerLocaleData(module.default);
46+
resolve(result);
47+
}, reject);
48+
} else {
49+
resolve(result);
50+
}
3951
},
4052
(err) => {
4153
abp.ui.clearBusy();
@@ -47,6 +59,23 @@ export function appInitializerFactory(injector: Injector,
4759
}
4860
}
4961

62+
export function convertAbpLocaleToAngularLocale(locale: string): string {
63+
if (!AppConsts.localeMappings) {
64+
return locale;
65+
}
66+
67+
let localeMapings = _.filter(AppConsts.localeMappings, { from: locale });
68+
if (localeMapings && localeMapings.length) {
69+
return localeMapings[0]['to'];
70+
}
71+
72+
return locale;
73+
}
74+
75+
export function shouldLoadLocale(): boolean {
76+
return abp.localization.currentLanguage.name && abp.localization.currentLanguage.name !== 'en-US';
77+
}
78+
5079
export function getRemoteServiceBaseUrl(): string {
5180
return AppConsts.remoteServiceBaseUrl;
5281
}

angular/src/shared/AppConsts.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export class AppConsts {
44
static appBaseUrl: string;
55
static appBaseHref: string; // returns angular's base-href parameter value if used during the publish
66

7+
static localeMappings: any = [];
8+
79
static readonly userManagement = {
810
defaultAdminUserName: 'admin'
911
};

0 commit comments

Comments
 (0)