在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):lukaskabrt/PoExtractor开源软件地址(OpenSource Url):https://github.com/lukaskabrt/PoExtractor开源编程语言(OpenSource Language):C# 99.9%开源软件介绍(OpenSource Introduction):PoExtractorThis utility extracts translatable strings from the C# and VB code, Razor templates and Liquid templates to POT (portable object template) files. It is designed to follow conventions used in the OrchardCore project. PoExtractor is distributed as a dotnet global tool and it is available on the official NuGet.org feed in two versions:
InstallationInstall with the following command:
or
Usage
or
Extracts all translatable strings from projects at the specified input path and saves generated POT files at the specified output path. It creates one POT file per a project. This includes liquid views. Uninstallation
or
LimitationsPoExtractor assumes, the code follows several conventions:
ExampleC# code: namespace OrchardCore.ContentFields.Fields {
public class LinkFieldDisplayDriver : ContentFieldDisplayDriver<LinkField> {
private IStringLocalizer S;
public LinkFieldDisplayDriver(IStringLocalizer<LinkFieldDisplayDriver> localizer) {
S = localizer;
}
public override async Task<IDisplayResult> UpdateAsync(LinkField field, IUpdateModel updater, UpdateFieldEditorContext context) {
bool modelUpdated = await updater.TryUpdateModelAsync(field, Prefix, f => f.Url, f => f.Text);
if (modelUpdated)
{
var settings = context.PartFieldDefinition.Settings.ToObject<LinkFieldSettings>();
if (settings.Required && String.IsNullOrWhiteSpace(field.Url))
{
updater.ModelState.AddModelError(Prefix, S["The url is required for {0}.", context.PartFieldDefinition.DisplayName()]);
}
}
return Edit(field, context);
}
}
} VB code: Namespace OrchardCore.Modules.GreetingModule
Public Class Greeting
private readonly S As IStringLocalizer(Of Greeting)
Public Sub New(ByVal localizer As IStringLocalizer(Of Greeting))
S = localizer
End Sub
Public Sub Saulation(byVal name As String)
Console.WriteLine(S("Hi {0} ...", name))
End Sub
End Class
End Namespace Razor view: @model OrchardCore.ContentFields.ViewModels.EditLinkFieldViewModel
<div class="row">
<fieldset class="form-group col-md-12">
<label asp-for="Url">@Model.PartFieldDefinition.DisplayName()</label>
</fieldset>
<fieldset class="form-group col-md-6" asp-validation-class-for="Url">
<input asp-for="Url" class="form-control content-preview-text" placeholder="@settings.UrlPlaceholder" required="@isRequired" />
</fieldset>
<fieldset class="form-group col-md-6" asp-validation-class-for="Text">
<label asp-for="Text" @if (settings.LinkTextMode == LinkTextMode.Required) { <text> class="required" </text> }>@T["Link text"]</label>
<input asp-for="Text" type="text" class="form-control content-preview-text" placeholder="@settings.TextPlaceholder" required="@isTextRequired" />
</fieldset>
</div> Liquid template: div class="page-heading">
<h1>{{ "Page Not Found" | t }}</h1>
/div> Generated POT file:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论