Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom localizer identifiers options #92

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public static class LocalizerAccessors
/// <summary>
/// Gets the localizer identifiers.
/// </summary>
public static string[] LocalizerIdentifiers = new string[]
{
public static string[] LocalizerIdentifiers =
[
DefaultLocalizerIdentifier,
StringLocalizerIdentifier,
HtmlLocalizerIdentifier
};
];
}
}
22 changes: 16 additions & 6 deletions src/OrchardCoreContrib.PoExtractor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Program

public static void Main(string[] args)
{
if (args.Length < 2 || args.Length > 6 || args.Length % 2 == 1)
if (args.Length < 2 || args.Length > 10 || args.Length % 2 == 1)
{
ShowHelp();

Expand Down Expand Up @@ -160,6 +160,15 @@ private static (string language, string templateEngine) GetCliOptions(string[] a
}
}

break;
case "--localizer":
if (!string.IsNullOrEmpty(args[i - 1]))
{
var localizerIdentifiers = args[i - 1].Split(',', StringSplitOptions.RemoveEmptyEntries);

LocalizerAccessors.LocalizerIdentifiers = localizerIdentifiers;
}

break;
default:
language = null;
Expand All @@ -181,10 +190,11 @@ private static void ShowHelp()
Console.WriteLine(" <OUTPUT_PATH> The path to a directory where POT files will be generated.");
Console.WriteLine();
Console.WriteLine("Options:");
Console.WriteLine(" -l, --language <C#|VB> Specifies the code language to extracts translatable strings from.");
Console.WriteLine(" Default: C# language");
Console.WriteLine(" -t, --template <Razor|Liquid> Specifies the template engine to extract the translatable strings from.");
Console.WriteLine(" Default: Razor & Liquid templates");
Console.WriteLine(" -i, --ignore project1,project2, Ignores extracting PO filed from a given project(s).");
Console.WriteLine(" -l, --language <C#|VB> Specifies the code language to extracts translatable strings from.");
Console.WriteLine(" Default: C# language");
Console.WriteLine(" -t, --template <Razor|Liquid> Specifies the template engine to extract the translatable strings from.");
Console.WriteLine(" Default: Razor & Liquid templates");
Console.WriteLine(" -i, --ignore project1,project2 Ignores extracting PO filed from a given project(s).");
Console.WriteLine(" --localizer localizer1,localizer2 Specifies the name of the localizer(s) that will be used suring the extraction process.");
}
}
Loading