MicrosoftTranslator / DocumentTranslation

Command Line tool and Windows application for document translation, a local interface to the Azure Document Translation service for Windows, macOS and Linux.
Other
154 stars 37 forks source link

Issue with CLI Usage #105

Closed skaschimer closed 1 year ago

skaschimer commented 1 year ago

I'm following the instructions provided at https://github.com/MicrosoftTranslator/DocumentTranslation/blob/master/docs/index.md.

When I get down to the CLI, the instructions are unclear or inaccurate for downloading and using the tool. for instance, if I try to set the config name, the tool tells me that name is not recognized.

In addition, when I point the CLI at a folder to translate all of the documents in the folder, I get an error message that the folder I specified in not a valid document name...

chriswendt1 commented 1 year ago

Hi Steve, Can you add here what you tried and what the response was?

For the first issue: The configuration name is not settable. From the documentation:

The configuration settings are stored in the file appsettings.json, in the user's roaming app settings folder, typically C:\Users\AppData\Roaming\Document Translation You may edit the file by hand, using a text editor of your choice.

For the second issue: The tool uses the OS information about whether the given location is a file or a folder. If a folder is given, the tool will translate files in that folder, and will not recurse into subfolders. Does this explain the behavior you are seeing?

skaschimer commented 1 year ago

So for the first, that's fine.

For the second, it was just a folder full of files that I was using for testing the GUI. No subfolders. This was the command I gave

doctr translate "C:\Users\v-kaschimers\OneDrive - Microsoft\Documents\Accelerators\" "c:\temp\translated\" --to es

And this was the error:

Starting translation of C:\Users\v-kaschimers\OneDrive - Microsoft\Documents\Accelerators\ to es. Press Esc to cancel. Following files were excluded due to a file type mismatch: C:\Users\v-kaschimers\OneDrive - Microsoft\Documents\Accelerators\ List filtered to nothing. (Parameter 'filestotranslate') ERROR: Missing or invalid credentials. Use the 'config set' command to set values.

I tried this way to (no trailing slash after the folder)

doctr translate "C:\Users\v-kaschimers\OneDrive - Microsoft\Documents\Accelerators" "c:\temp\translated" --to es

And I got the same error:

Starting translation of C:\Users\v-kaschimers\OneDrive - Microsoft\Documents\Accelerators to es. Press Esc to cancel. Following files were excluded due to a file type mismatch: C:\Users\v-kaschimers\OneDrive - Microsoft\Documents\Accelerators List filtered to nothing. (Parameter 'filestotranslate') ERROR: Missing or invalid credentials. Use the 'config set' command to set values.

Steve

From: Chris Wendt @.> Sent: Tuesday, November 15, 2022 11:49 AM To: MicrosoftTranslator/DocumentTranslation @.> Cc: Steven Kaschimer (Slalom LLC) @.>; Author @.> Subject: Re: [MicrosoftTranslator/DocumentTranslation] Issue with CLI Usage (Issue #105)

Hi Steve, Can you add here what you tried and what the response was?

For the first issue: The configuration name is not settable. From the documentation:

The configuration settings are stored in the file appsettings.json, in the user's roaming app settings folder, typically C:\Users\AppData\Roaming\Document Translation You may edit the file by hand, using a text editor of your choice.

For the second issue: The tool uses the OS information about whether the given location is a file or a folder. If a folder is given, the tool will translate files in that folder, and will not recurse into subfolders. Does this explain the behavior you are seeing?

- Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftTranslator%2FDocumentTranslation%2Fissues%2F105%23issuecomment-1315590812&data=05%7C01%7Cv-kaschimers%40microsoft.com%7Ccaf2bf38da134662ed2a08dac7293ec5%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638041277225433852%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DDAbw8PVrFFmadlW%2BMC7hfol6yju0nmv5SLSnvhLtXA%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAXPMNQJBPMSRBBBJZSCQ7LLWIO5GNANCNFSM6AAAAAASBDLQBE&data=05%7C01%7Cv-kaschimers%40microsoft.com%7Ccaf2bf38da134662ed2a08dac7293ec5%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638041277225433852%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=PmD%2BOFzOdpC%2BW4M3pwOd3WAeHiO73N9W%2F22yGGBYVVU%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.**@.>>

chriswendt1 commented 1 year ago

Hi Steve,

There is a real bug here: the message ERROR: Missing or invalid credentials. Use the 'config set' command to set values. shows up when the source folder is empty. There is most likely nothing wrong with your credentials.

Use the command doctr config test to get a hint whether your credentials are valid and accepted by the service.

It is by current design that the tool does not recurse through subfolders.

The following shows the translation of a set of files in a folder with one file being untranslatable. Followed by the translation attempt of an empty folder.

Screenshot 2022-11-21 120501

I will treat this issue in the sense of: Translation of an empty folder causes an erroneous error message about invalid or missing credentials

Let me know as a new "issue" if recursing through subfolders is essential for you. I am happy to add this as a feature.

skaschimer commented 1 year ago

Hi Chris

Thanks for the reply. When I do doctr config test, it tests fine. Are there any limitations to the folder that the files can be in? Mine were in c:\temp yours are in a folder on d:.

Subfolders... that's fine I get that that's not the design right now and its not a hard and fast requirement.

Thanks again

Steve

From: Chris Wendt @.> Sent: Monday, November 21, 2022 3:11 PM To: MicrosoftTranslator/DocumentTranslation @.> Cc: Steven Kaschimer (Slalom LLC) @.>; Author @.> Subject: Re: [MicrosoftTranslator/DocumentTranslation] Issue with CLI Usage (Issue #105)

Hi Steve,

There is a real bug here: the message ERROR: Missing or invalid credentials. Use the 'config set' command to set values. shows up when the source folder is empty. There is most likely nothing wrong with your credentials.

Use the command doctr config test to get a hint whether your credentials are valid and accepted by the service.

It is by current design that the tool does not recurse through subfolders.

The following shows the translation of a set of files in a folder with one file being untranslatable. Followed by the translation attempt of an empty folder.

[Screenshot 2022-11-21 120501]https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F11096941%2F203148392-364afb83-bd20-44d3-96db-cb9732c5aa24.png&data=05%7C01%7Cv-kaschimers%40microsoft.com%7Cba50adfd1c3b436e7bca08dacbfc857e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638046582717520988%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8VQ9IMrGYyArc3TkK3%2BvO4OiB0PIP8ZVWFEvAEAimZw%3D&reserved=0

I will treat this issue in the sense of: Translation of an empty folder causes an erroneous error message about invalid or missing credentials

Let me know as a new "issue" if recursing through subfolders is essential for you. I am happy to add this as a feature.

- Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftTranslator%2FDocumentTranslation%2Fissues%2F105%23issuecomment-1322586697&data=05%7C01%7Cv-kaschimers%40microsoft.com%7Cba50adfd1c3b436e7bca08dacbfc857e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638046582717520988%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=dILOf8KkIo1mc6aNuh%2F97cdYcUO75%2FAq5sZnVwzjL6g%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAXPMNQLYG2RDQIH2TL77OC3WJPJNTANCNFSM6AAAAAASBDLQBE&data=05%7C01%7Cv-kaschimers%40microsoft.com%7Cba50adfd1c3b436e7bca08dacbfc857e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638046582717520988%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1%2FD3WTdMaCIDQ2sl%2B32HcCVVxsqF57JYPkSukOhfALI%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.**@.>>

chriswendt1 commented 1 year ago

You tried to translate a OneDrive folder. Can it be that the source files were not physically present on the drive yet? Explorer needs to show the green circle checkmark for the file(s) in question. I am not sure the tool would invoke OneDrive's just in time download. I am quite sure that the target folder doesn't matter, as long as you have write permission to it.

chriswendt1 commented 1 year ago

App fails to translate a OneDrive folder even when the files are locally present. @skaschimer, for now please copy content to a non-OneDrive folder before starting translation. My suspicion is that the OS reported folder attributes for a OneDrive folder are different than what the app is looking for. I'll close this issue and carry the two new issues 106 and 107 forward.

chriswendt1 commented 1 year ago

The failure to translate OneDrive folders was a stupid mistake in the logic for checking the file attributes, and a simple and safe fix.

chriswendt1 commented 1 year ago

@skaschimer Closing this, pursuing the two issues in #106 and #107.

chriswendt1 commented 1 year ago

Both the issues raised here are now fixed in code. Wait for the updated binaries or compile from current code.