Aiursoft.Dotlang
7.0.11
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet tool install --global Aiursoft.Dotlang --version 7.0.11
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Aiursoft.Dotlang --version 7.0.11
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Aiursoft.Dotlang&version=7.0.11
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package Aiursoft.Dotlang --version 7.0.11
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
8.0.12 | 89 | 10/10/2024 |
8.0.11 | 85 | 10/9/2024 |
8.0.10 | 70 | 10/7/2024 |
8.0.9 | 81 | 10/5/2024 |
8.0.8 | 95 | 8/30/2024 |
8.0.7 | 84 | 7/31/2024 |
8.0.6 | 93 | 7/12/2024 |
8.0.5 | 75 | 7/10/2024 |
8.0.4 | 94 | 6/29/2024 |
8.0.3 | 92 | 6/28/2024 |
8.0.2 | 90 | 6/18/2024 |
8.0.1 | 101 | 6/5/2024 |
8.0.0 | 1,113 | 2/19/2024 |
7.0.11 | 1,343 | 2/2/2024 |
7.0.10 | 1,433 | 1/30/2024 |
7.0.9 | 1,968 | 12/12/2023 |
7.0.8 | 2,013 | 12/12/2023 |
7.0.6 | 2,240 | 12/6/2023 |
7.0.5 | 2,233 | 12/6/2023 |
7.0.4 | 2,193 | 12/6/2023 |
7.0.3 | 2,058 | 11/12/2023 |
7.0.2 | 2,537 | 11/2/2023 |
7.0.1 | 2,404 | 11/2/2023 |
7.0.0 | 2,793 | 9/7/2023 |
6.0.2 | 2,944 | 7/20/2023 |
6.0.1 | 2,776 | 5/18/2023 |