File tree Expand file tree Collapse file tree 9 files changed +77
-0
lines changed
aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc
Shared/Components/AccountLanguages
wwwroot/view-resources/Views/Account Expand file tree Collapse file tree 9 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 18
18
<ItemGroup >
19
19
<Content Include =" wwwroot\images\user-img-background.jpg" />
20
20
<Content Include =" wwwroot\images\user.png" />
21
+ <Content Include =" wwwroot\view-resources\Views\Account\_Layout.less" />
21
22
<Content Include =" wwwroot\view-resources\Views\Home\Index.js" />
22
23
</ItemGroup >
23
24
Original file line number Diff line number Diff line change 42
42
<link href =" ~/css/style.css" rel =" stylesheet" >
43
43
44
44
<link rel =" stylesheet" href =" ~/css/main.css" asp-append-version =" true" />
45
+ <link href =" ~/view-resources/Views/Account/_Layout.css" rel =" stylesheet" asp-append-version =" true" />
45
46
</environment >
46
47
47
48
<environment names =" Staging,Production" >
74
75
75
76
@RenderBody()
76
77
78
+ <vc:account-languages ></vc:account-languages >
79
+
77
80
<div class =" row" >
78
81
<div class =" col-xs-12 text-center" style =" color : #e9e9e9 " >
79
82
<small >© ; @DateTime.Now.Year AbpProjectName. <b >Version </b > @AppVersionHelper.Version [@AppVersionHelper.ReleaseDate.ToString( "yyyyMMdd")]</small >
Original file line number Diff line number Diff line change
1
+ using System . Linq ;
2
+ using System . Threading . Tasks ;
3
+ using Abp . Localization ;
4
+ using Microsoft . AspNetCore . Mvc ;
5
+
6
+ namespace AbpCompanyName . AbpProjectName . Web . Views . Shared . Components . AccountLanguages
7
+ {
8
+ public class AccountLanguagesViewComponent : ViewComponent
9
+ {
10
+ private readonly ILanguageManager _languageManager ;
11
+
12
+ public AccountLanguagesViewComponent ( ILanguageManager languageManager )
13
+ {
14
+ _languageManager = languageManager ;
15
+ }
16
+
17
+ public Task < IViewComponentResult > InvokeAsync ( )
18
+ {
19
+ var model = new LanguageSelectionViewModel
20
+ {
21
+ CurrentLanguage = _languageManager . CurrentLanguage ,
22
+ Languages = _languageManager . GetLanguages ( )
23
+ //.Where(l => !l.IsDisabled) //TODO: Will be supported after Abp.ZeroCore 2.1.
24
+ . ToList ( ) ,
25
+ CurrentUrl = Request . Path
26
+ } ;
27
+
28
+ return Task . FromResult ( View ( model ) as IViewComponentResult ) ;
29
+ }
30
+ }
31
+ }
Original file line number Diff line number Diff line change
1
+ @using System .Text .Encodings .Web
2
+ @using AbpCompanyName .AbpProjectName .Web .Views .Shared .Components .AccountLanguages
3
+ @model LanguageSelectionViewModel
4
+ @if (Model .Languages .Count > 1 )
5
+ {
6
+ <div class =" language-switch-area" >
7
+ @foreach ( var languageInfo in Model .Languages )
8
+ {
9
+ <a href =" ~/AbpLocalization/ChangeCulture?cultureName=@(languageInfo.Name)&returnUrl=@(UrlEncoder.Default.Encode(Context.Request.Path + Context.Request.QueryString))" >
10
+ <span class =" language-icon @(languageInfo == Model.CurrentLanguage ? " language-icon-current " : " " )" title =" @languageInfo.DisplayName" ><i class =" @languageInfo.Icon" ></i ></span >
11
+ </a >
12
+ }
13
+ </div >
14
+ }
Original file line number Diff line number Diff line change
1
+ using System . Collections . Generic ;
2
+ using Abp . Localization ;
3
+ using Microsoft . AspNetCore . Http ;
4
+
5
+ namespace AbpCompanyName . AbpProjectName . Web . Views . Shared . Components . AccountLanguages
6
+ {
7
+ public class LanguageSelectionViewModel
8
+ {
9
+ public LanguageInfo CurrentLanguage { get ; set ; }
10
+
11
+ public IReadOnlyList < LanguageInfo > Languages { get ; set ; }
12
+
13
+ public PathString CurrentUrl { get ; set ; }
14
+ }
15
+ }
Original file line number Diff line number Diff line change 6
6
{
7
7
"outputFile" : " wwwroot/view-resources/Views/Account/Login.css" ,
8
8
"inputFile" : " wwwroot/view-resources/Views/Account/Login.less"
9
+ },
10
+ {
11
+ "outputFile" : " wwwroot/view-resources/Views/Account/_Layout.css" ,
12
+ "inputFile" : " wwwroot/view-resources/Views/Account/_Layout.less"
9
13
}
10
14
]
Original file line number Diff line number Diff line change
1
+ .language-switch-area {
2
+ text-align : center;
3
+ padding : 10px ;
4
+ }
Original file line number Diff line number Diff line change
1
+ .language-switch-area {
2
+ text-align : center ;
3
+ padding : 10px ;
4
+ }
Original file line number Diff line number Diff line change
1
+ .language-switch-area {text-align : center;padding : 10px ;}
You can’t perform that action at this time.
0 commit comments