mirror of https://github.com/abpframework/abp.git
29 changed files with 142 additions and 47 deletions
@ -0,0 +1,46 @@ |
|||||
|
# How to add a new language to your ABP project? |
||||
|
|
||||
|
Adding a new language to your ABP project is pretty simple. Let's add the German language to our ABP project: |
||||
|
|
||||
|
|
||||
|
|
||||
|
1. Go to your solution's root folder and write the following CLI command. This command will generate an empty translation file from English. |
||||
|
```bash |
||||
|
abp translate -c de-DE |
||||
|
``` |
||||
|
|
||||
|
Check out for [the complete supported culture codes](https://docs.microsoft.com/en-us/bingmaps/rest-services/common-parameters-and-types/supported-culture-codes). |
||||
|
(For internal development `D:\Github\abp` and `D:\Github\volo\abp`) |
||||
|
|
||||
|
2. Fill the `target` fields in your target language. |
||||
|
|
||||
|
 |
||||
|
|
||||
|
3. Copy `abp-translation.json` your solution's root folder (Do not change the filename!) |
||||
|
|
||||
|
4. Run the following command. This command will create the necessary `json` files. |
||||
|
```bash |
||||
|
abp translate --apply |
||||
|
``` |
||||
|
|
||||
|
5. Open your solution and add the new language to the language list. To do this; |
||||
|
|
||||
|
* open `MyProjectNameDomainModule.cs` and in `ConfigureServices` you'll find `Configure<AbpLocalizationOptions>`. If you have `HttpApi.Host` project then you need to add this in `MyProjectNameHttpApiHostModule.cs` |
||||
|
|
||||
|
``` |
||||
|
options.Languages.Add(new LanguageInfo("de-DE", "de-DE", "Deutsche", "de")); |
||||
|
``` |
||||
|
|
||||
|
 |
||||
|
|
||||
|
The last parameter is the flag icon. You can find the list of flag icons on https://flagicons.lipis.dev/ |
||||
|
|
||||
|
6. The last step is running the DbMigrator project. It will seed the database for the new language. |
||||
|
 |
||||
|
|
||||
|
|
||||
|
|
||||
|
Close the IIS Express / Kestrel to invalidate the language cache and run the project. You will see the new language on your website. |
||||
|
|
||||
|
 |
||||
|
|
||||
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 26 KiB |
@ -1,8 +1,8 @@ |
|||||
<ul class="navbar-nav"> |
<ul class="navbar-nav"> |
||||
@foreach (var render in ToolbarItemRenders) |
@foreach (var render in ToolbarItemRenders) |
||||
{ |
{ |
||||
<li class="nav-item"> |
<BarItem> |
||||
@render |
@render |
||||
</li> |
</BarItem> |
||||
} |
} |
||||
</ul> |
</ul> |
||||
|
|||||
@ -0,0 +1,7 @@ |
|||||
|
namespace Volo.Abp.ExceptionHandling |
||||
|
{ |
||||
|
public interface IHasHttpStatusCode |
||||
|
{ |
||||
|
int HttpStatusCode { get; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Ui.Branding; |
||||
|
|
||||
|
namespace MyCompanyName.MyProjectName |
||||
|
{ |
||||
|
[Dependency(ReplaceServices = true)] |
||||
|
public class MyProjectNameBrandingProvider : DefaultBrandingProvider |
||||
|
{ |
||||
|
public override string AppName => "MyProjectName"; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue