OrchardCoreContrib / OrchardCoreContrib.PoExtractor

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

Add documentation on how to install tool locally #62

Open Skrypt opened 1 year ago

Skrypt commented 1 year ago

You need to do a Dotnet Pack on the PoExtractor.OrchardCore or the PoExtractor projects. Then you need to do:

extractpo

dotnet tool install --global --add-source {{PathToYourRepository}}\OrchardCoreContrib.PoExtractor\src\OrchardCoreContrib.PoExtractor\bin\Debug OrchardCoreContrib.PoExtractor --version 1.0.1

This needs to be documented so that when we develop we can use it locally.

hishamco commented 1 year ago

Is it to avoid adding a unit test for a certain use case or is there a use case to create a package locally?

Skrypt commented 1 year ago

When debugging this tool while fixing it.

hishamco commented 1 year ago

I'm usually run the donet run from CLI to test any added feature

rjpowers10 commented 1 year ago

I'm usually run the donet run from CLI to test any added feature

I'm also confused by the issue. Should be able to debug the tool like any other .NET application (e.g. dotnet run or launch from Visual Studio).

Skrypt commented 9 months ago

This is what I'm doing.

dotnet run on the OrchardCoreContrib.PoExtractor folder but I get an exception when trying to execute extractpo

image

So I need to install the extractor tool from the local Nuget package which doesn't make any sense.

hishamco commented 9 months ago

Why do you need the extractpo inside the repo folder?!!

Skrypt commented 8 months ago

@hishamco What I'm trying to do here is execute extractpo inside a command.ps1 file. So, either I'm moving that command.ps1 file to the repository folder or I need to reinstall the tool from the local source code folder. Running it from Visual Studio is not registering this tool as a global command shell available script. You need to install it first. This is what I'm explaining here with my different tests and showing you screenshots of the results.

hishamco commented 8 months ago

What I'm trying to do here is execute extractpo inside a command.ps1 file

I didn't understand which command.ps1 are you referring to.

Skrypt commented 8 months ago

Nothing that comes with the source code here. It is a custom script that I wrote that uses Google Translate to generate PO files for each cultures with translated strings. I run this script manually periodically to translate everything. So, if I want to debug it, I need to install the tool from source code locally. Running the OrchardCoreContrib.PoExtractor project doesn't work for me for doing that. Else, I need to change all of my script paths. I understand that you can run extractpo when running the project but then the paths are all relative to that folder which is not really helpful at all.

In the end, if it needs to execute from CI it needs to use the installed Nuget package tool.

hishamco commented 8 months ago

I understand that you can run extractpo when running the project but then the paths are all relative to that folder which is not really helpful at all.

Strange!! could you please share the script if it's fine for you or give me steps to reproduce the issue, I remember that I extracted one project resources from the source but I will have another try

Skrypt commented 8 months ago

I will share it at some point in a different PR but that's not the point. The issue is that when you are running the solution it doesn't register the tool globally to be used. You can see it in the screenshot I sent you. That's the Visual Studio powershell instanciated when running the project locally. Doing extractpo fails.

Actually don't want to digress into that topic but we could easily add a translate option to this tool. But, the script I made needs to be rewritten in C#. Which is something anyone could do.

extractpo -t "en,fr"

hishamco commented 8 months ago

I understand what you mean, you need to use OrchardCoreContrib.PoExtractor instead of extractpo

Skrypt commented 8 months ago

Thanks, I will try that.