Aiursoft.Dotlang 8.0.0
ASP.NET Core App Translator
This app helps you generate translated .cshtml
files and resources
files.
How to install
Run the following command to install this tool:
dotnet tool install --global Aiursoft.Dotlang
How does it works
- Find all files ends with
.cshtml
- foreach
cshtml
file, replace all text in tag sround with@Localizer[""]
- Call bing translate API to translate all those content
- Save the translated file as
Resource
file in theResources
folder.
The Core Translator won't override any existing translation nor resources files. If your content was already surrounded with @Localizer[""]
, we won't touch it.
How to run locally
Build:
dotnet pack
Install:
dotnet tool install --global --add-source ./nupkg dotlang
Run:
# In your project folder
$ dotlang
Uninstall:
dotnet tool uninstall -g dotlang
Before running the translator
- Follow the document here ASP.NET Core Localization
Use the following code to register the localizer service:
// In StartUp.cs ConfigureServices method:
services.AddLocalization(options => options.ResourcesPath = "Resources");
services.AddMvc()
.AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
.AddDataAnnotationsLocalization();
Use the following code to add localizer middleware:
// In StartUp.cs Configure method
var SupportedCultures = new CultureInfo[]
{
new CultureInfo("en"),
new CultureInfo("zh")
};
app.UseRequestLocalization(new RequestLocalizationOptions
{
DefaultRequestCulture = new RequestCulture(defaultLanguage),
SupportedCultures = SupportedCultures,
SupportedUICultures = SupportedCultures
});
Use the following code to inject localizer:
@using Microsoft.AspNetCore.Mvc.Localization
@inject IViewLocalizer Localizer
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
Now run this app!
Caution
Running this under your project folder may ruin your project! It may change your cshtml
! Do run git commit
under your project before running this app.
This package has no dependencies.
Version | Last updated |
---|---|
9.0.40 | 9/17/2025 |
9.0.39 | 9/13/2025 |
9.0.38 | 9/12/2025 |
9.0.37 | 9/11/2025 |
9.0.36 | 9/11/2025 |
9.0.35 | 9/11/2025 |
9.0.34 | 9/11/2025 |
9.0.32 | 9/11/2025 |
9.0.31 | 9/10/2025 |
9.0.30 | 9/7/2025 |
9.0.29 | 9/6/2025 |
9.0.28 | 8/7/2025 |
9.0.27 | 8/5/2025 |
9.0.26 | 7/10/2025 |
9.0.25 | 7/9/2025 |
9.0.24 | 7/4/2025 |
9.0.23 | 6/26/2025 |
9.0.22 | 6/23/2025 |
9.0.21 | 6/23/2025 |
9.0.20 | 6/23/2025 |
9.0.19 | 6/18/2025 |
9.0.18 | 6/13/2025 |
9.0.17 | 6/12/2025 |
9.0.16 | 6/12/2025 |
9.0.15 | 6/11/2025 |
9.0.13 | 6/11/2025 |
9.0.12 | 6/7/2025 |
9.0.11 | 6/6/2025 |
9.0.10 | 6/2/2025 |
9.0.9 | 6/1/2025 |
9.0.8 | 4/10/2025 |
9.0.7 | 3/12/2025 |
9.0.6 | 6/10/2025 |
9.0.5 | 5/20/2025 |
9.0.4 | 6/12/2025 |
9.0.3 | 5/17/2025 |
9.0.2 | 5/22/2025 |
9.0.1 | 5/22/2025 |
9.0.0 | 4/19/2025 |
8.0.13 | 4/21/2025 |
8.0.12 | 4/2/2025 |
8.0.11 | 6/7/2025 |
8.0.10 | 4/25/2025 |
8.0.9 | 3/26/2025 |
8.0.8 | 4/16/2025 |
8.0.7 | 4/1/2025 |
8.0.6 | 4/3/2025 |
8.0.5 | 4/6/2025 |
8.0.4 | 3/16/2025 |
8.0.3 | 4/1/2025 |
8.0.2 | 4/10/2025 |
8.0.1 | 4/16/2025 |
8.0.0 | 6/7/2025 |
7.0.11 | 4/10/2025 |
7.0.10 | 6/7/2025 |
7.0.9 | 4/25/2025 |
7.0.8 | 4/16/2025 |
7.0.6 | 6/7/2025 |
7.0.5 | 5/4/2025 |
7.0.4 | 3/30/2025 |
7.0.3 | 4/16/2025 |
7.0.2 | 6/7/2025 |
7.0.1 | 4/16/2025 |
7.0.0 | 4/16/2025 |
6.0.2 | 4/16/2025 |
6.0.1 | 4/3/2025 |