Skip to content

Commit

Permalink
Add custom localizer identifiers options
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamco committed Jun 17, 2024
1 parent ff2d977 commit 5dabe1c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
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.");
}
}

0 comments on commit 5dabe1c

Please sign in to comment.