OrchardCoreContrib.PoExtractor icon indicating copy to clipboard operation
OrchardCoreContrib.PoExtractor copied to clipboard

Get only one pot file as output.

Open VincenzoCarlino opened this issue 1 year ago • 7 comments

Hello, the output of poextractor is a POT template for each project, which can be a bit annoying at times, especially when using POEdit to translate strings. It might be worth considering an option to generate a single POT file as output instead. If this feature is welcomed, I will look into implementing it.

VincenzoCarlino avatar Jun 17 '24 10:06 VincenzoCarlino

Feel free to submit a PR

hishamco avatar Jun 17 '24 10:06 hishamco

@hishamco Ok, thanks. I already have a working poc; later I will make it look good and then I'll open the PR. Just a quick question: What would you call the argument? Currently, I used "-s | --single" followed by the filename. So if you invoke the command with "-s messages.pot" you will get a single file as output.

VincenzoCarlino avatar Jun 17 '24 14:06 VincenzoCarlino

So if you invoke the command with "-s messages.pot" you will get a single file as output.

Don't forget that "messages" could be found in multiple projects

hishamco avatar Jun 17 '24 14:06 hishamco

So if you invoke the command with "-s messages.pot" you will get a single file as output.

Don't forget that "messages" could be found in multiple projects

What do you mean? By "-s messages.pot", I mean the single output file. Let me clarify: imagine we have this structure:

  • src
    • Project1
    • Project2

If you run "dotnet poextractor ./src ./src", you will find "Project1.pot" and "Project2.pot" in the src directory. With this feature, if you run "dotnet poextractor ./src ./src --single messages.pot", you will find "messages.pot" in the src directory, containing all the msgIds retrieved from Project1 and Project2.

VincenzoCarlino avatar Jun 17 '24 14:06 VincenzoCarlino

Got it, the output could be {culture}.pot

hishamco avatar Jun 17 '24 15:06 hishamco

Got it, the output could be {culture}.pot

Why you would specify culture for the pot file? POT files are the template files for PO files. They will have all the translation strings left empty. A POT file is essentially an empty PO file without the translations, with just the original strings. So they are "CultureInvariant" :)

Instead, if you want to get one PO file per culture, we should specify the list of cultures we want right? Something like: "dotnet poextractor ./src ./src --cultures en,it,fr" => to get: en.po, it.po, fr.po.

Personally I would prefer a single POT file as output.

VincenzoCarlino avatar Jun 17 '24 15:06 VincenzoCarlino

Waiting for your PR then we could see

hishamco avatar Jun 17 '24 16:06 hishamco