OrchardCoreContrib / OrchardCoreContrib.PoExtractor

Extracts localizable strings from .cs, .vb, .cshtml and .liquid files into POT files
MIT License
48 stars 35 forks source link

Get only one pot file as output. #93

Closed VincenzoCarlino closed 2 weeks ago

VincenzoCarlino commented 2 months ago

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.

hishamco commented 2 months ago

Feel free to submit a PR

VincenzoCarlino commented 2 months ago

@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.

hishamco commented 2 months ago

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

VincenzoCarlino commented 2 months ago

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:

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.

hishamco commented 2 months ago

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

VincenzoCarlino commented 2 months ago

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.

hishamco commented 2 months ago

Waiting for your PR then we could see