Aiursoft.Dotlang
9.0.17
See the version list below for details.
dotnet tool install --global Aiursoft.Dotlang --version 9.0.17
dotnet new tool-manifest
dotnet tool install --local Aiursoft.Dotlang --version 9.0.17
#tool dotnet:?package=Aiursoft.Dotlang&version=9.0.17
nuke :add-package Aiursoft.Dotlang --version 9.0.17
ASP.NET Core App Translator
This app helps you generate translated .cshtml
files and resources
files. Based on the Ollama AI model, it translates the content inside @Localizer[""]
tags in your ASP.NET Core project.
Installation
Requirements:
Run the following command to install this tool:
dotnet tool install --global Aiursoft.Dotlang
Usage
After getting the binary, run it directly in the terminal.
dotlang translate-aspnet --path ~/Code --instance http://ollama:11434/api/chat --model "qwen:32b" --token "your-ollama-token"
Description:
The command to start translation on an ASP.NET Core project.
Usage:
dotlang translate-aspnet [options]
Options:
-v, --verbose Show detailed log
-d, --dry-run Preview changes without actually making them
-p, --path <path> (REQUIRED) Path of the videos to be parsed.
-l, --languages <languages> (REQUIRED) The target languages code. Connect with ','. For example: zh_CN,en_US,ja_JP [default:
zh-CN,zh-TW,zh-HK,ja-JP,ko-KR,vi-VN,th-TH,de-DE,fr-FR,es-ES,ru-RU,it-IT,pt-PT,pt-BR,ar-SA,nl-NL,sv-SE,pl-PL,tr-TR]
--instance <instance> (REQUIRED) The Ollama instance to use.
--model <model> (REQUIRED) The Ollama model to use.
--token <token> (REQUIRED) The Ollama token to use.
-?, -h, --help Show help and usage information
Run locally
Requirements about how to run
- .NET 9 SDK
- Ollama.
- Execute
dotnet run
to run the app
Run in Microsoft Visual Studio
- Open the
.sln
file in the project path. - Press
F5
.
How does this work?
- Find all files ends with
.cshtml
. - foreach
cshtml
file, replace all text in tag surrounded with@Localizer[""]
with the content inside. - Call ollama to translate all the content. (The entire file will be sent to ollama to make sure AI understands the context.)
- 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.
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.
How to contribute
There are many ways to contribute to the project: logging bugs, submitting pull requests, reporting issues, and creating suggestions.
Even if you with push rights on the repository, you should create a personal fork and create feature branches there when you need them. This keeps the main repository clean and your workflow cruft out of sight.
We're also interested in your feedback on the future of this project. You can submit a suggestion or feature request through the issue tracker. To make this process more effective, we're asking that these include more information to help define them more clearly.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
9.0.19 | 111 | 6/18/2025 |
9.0.18 | 211 | 6/13/2025 |
9.0.17 | 276 | 6/12/2025 |
9.0.16 | 268 | 6/12/2025 |
9.0.15 | 272 | 6/11/2025 |
9.0.13 | 273 | 6/11/2025 |
9.0.12 | 65 | 6/7/2025 |
9.0.11 | 94 | 6/6/2025 |
9.0.10 | 132 | 6/2/2025 |
9.0.9 | 97 | 6/1/2025 |
9.0.8 | 186 | 4/10/2025 |
9.0.7 | 171 | 3/12/2025 |
9.0.6 | 162 | 3/12/2025 |
9.0.5 | 124 | 2/13/2025 |
9.0.4 | 128 | 2/12/2025 |
9.0.3 | 116 | 2/1/2025 |
9.0.2 | 104 | 1/16/2025 |
9.0.1 | 76 | 1/15/2025 |
9.0.0 | 134 | 1/2/2025 |
8.0.13 | 130 | 1/1/2025 |
8.0.12 | 144 | 10/10/2024 |
8.0.11 | 136 | 10/9/2024 |
8.0.10 | 112 | 10/7/2024 |
8.0.9 | 149 | 10/5/2024 |
8.0.8 | 130 | 8/30/2024 |
8.0.7 | 117 | 7/31/2024 |
8.0.6 | 134 | 7/12/2024 |
8.0.5 | 111 | 7/10/2024 |
8.0.4 | 135 | 6/29/2024 |
8.0.3 | 129 | 6/28/2024 |
8.0.2 | 129 | 6/18/2024 |
8.0.1 | 132 | 6/5/2024 |
8.0.0 | 1,149 | 2/19/2024 |
7.0.11 | 1,374 | 2/2/2024 |
7.0.10 | 1,465 | 1/30/2024 |
7.0.9 | 1,998 | 12/12/2023 |
7.0.8 | 2,043 | 12/12/2023 |
7.0.6 | 2,264 | 12/6/2023 |
7.0.5 | 2,254 | 12/6/2023 |
7.0.4 | 2,216 | 12/6/2023 |
7.0.3 | 2,082 | 11/12/2023 |
7.0.2 | 2,558 | 11/2/2023 |
7.0.1 | 2,427 | 11/2/2023 |
7.0.0 | 2,820 | 9/7/2023 |
6.0.2 | 2,977 | 7/20/2023 |
6.0.1 | 2,824 | 5/18/2023 |