Giter Site home page Giter Site logo

Comments (9)

chriswendt1 avatar chriswendt1 commented on May 28, 2024

I can come up with two possibilities that could cause this failure:

  1. The dialog depends on the app being able to enumerate the supported file formats form the document translation service: https://docs.microsoft.com/en-us/azure/cognitive-services/translator/document-translation/reference/get-supported-document-formats. If that fails, the document picker doesn't show. Normally the configuration "Test" should have found that though.
  2. The dialog itself is a regular operating system call from .Net 5 libraries. Can you try reinstalling the .Net 5 runtime from https://dotnet.microsoft.com/download/dotnet/5.0? If you are running Visual Studio 2019, you get it with Visual Studio 16.11.0 and no need to install the runtime separately.

from documenttranslation.

chriswendt1 avatar chriswendt1 commented on May 28, 2024

If you are in a bind translating something right now, you can use the command line version to translate.

from documenttranslation.

chriswendt1 avatar chriswendt1 commented on May 28, 2024

@MarcMoeHx: Did any of this help? Note there is also a new version of the compiled binary out there, version 0.8.5.0. I don't think any of the changes affect the bug you observed, but worth a try.
Let me know what you find.

from documenttranslation.

MarcMoeHx avatar MarcMoeHx commented on May 28, 2024

Hello,

will updtae my visual studio to 2019 16.11
Had an older version installed, maybe this will solve the problem.
I will come back after testing.

Thank you very much for your fast reply

from documenttranslation.

chriswendt1 avatar chriswendt1 commented on May 28, 2024

Hi Marc,
can you let me know if the update had the desired effect?

The code in question is quite simple. It is in the DocumentBrowseButton_Click method in Mainwindow.xaml.cs:
private async void DocumentBrowseButton_Click(object sender, RoutedEventArgs e)
{
ResetUI();
ViewModel.FilesToTranslate.Clear();
OpenFileDialog openFileDialog = new() { RestoreDirectory = true, CheckFileExists = true, Multiselect = true };
if (ViewModel.UISettings.lastDocumentsFolder is not null) openFileDialog.InitialDirectory = ViewModel.UISettings.lastDocumentsFolder;
try
{
openFileDialog.Filter = await ViewModel.GetDocumentExtensionsFilter();
}
catch (Azure.RequestFailedException ex)
{
StatusBarText1.Text = Properties.Resources.msg_Error;
if (ex.Status == 401 || ex.Status == 403) StatusBarText2.Text = Properties.Resources.msg_S1OrHigherTierRequired;
else StatusBarText2.Text = ex.Message;
await Task.Delay(2000);
StatusBarText1.Text = string.Empty;
StatusBarText2.Text = string.Empty;
return;
}
openFileDialog.ShowDialog();
foreach (var filename in openFileDialog.FileNames)
ViewModel.FilesToTranslate.Add(filename);
FilesListBox.ItemsSource = ViewModel.FilesToTranslate;
if (ViewModel.FilesToTranslate.Count > 0)
{
if (string.IsNullOrEmpty(TargetTextBox.Text)) TargetTextBox.Text = Path.GetDirectoryName(ViewModel.FilesToTranslate[0]) + "." + toLanguageBoxDocuments.SelectedValue as string;
if (!string.IsNullOrEmpty(TargetTextBox.Text)) translateDocumentsButton.IsEnabled = true;
}
else translateDocumentsButton.IsEnabled = false;
return;
}

I suspect the failure happens in this line:
openFileDialog.Filter = await ViewModel.GetDocumentExtensionsFilter();

Can you step through it and see where it fails in your situation?

from documenttranslation.

chriswendt1 avatar chriswendt1 commented on May 28, 2024

Also, can you have a look at the output window? It should show something like this:
image
Note the GetFormats: Response: value. Are you getting this line?
GetFormats: Response: {"Value":[{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"PlainText","FileExtensions":[".txt"],"ContentTypes":["text/plain"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"OpenXmlWord","FileExtensions":[".docx"],"ContentTypes":["application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"OpenXmlPresentation","FileExtensions":[".pptx"],"ContentTypes":["application/vnd.openxmlformats-officedocument.presentationml.presentation"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"OpenXmlSpreadsheet","FileExtensions":[".xlsx"],"ContentTypes":["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"OutlookMailMessage","FileExtensions":[".msg"],"ContentTypes":["application/vnd.ms-outlook"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"HtmlFile","FileExtensions":[".html",".htm"],"ContentTypes":["text/html"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"PortableDocumentFormat","FileExtensions":[".pdf"],"ContentTypes":["application/pdf"]},{"FormatVersions":["1.0","1.1","1.2"],"DefaultFormatVersion":null,"Format":"XLIFF","FileExtensions":[".xlf"],"ContentTypes":["application/xliff\u002Bxml"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"TSV","FileExtensions":[".tsv",".tab"],"ContentTypes":["text/tab-separated-values"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"CSV","FileExtensions":[".csv"],"ContentTypes":["text/csv"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"RichTextFormat","FileExtensions":[".rtf"],"ContentTypes":["application/rtf"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"WordDocument","FileExtensions":[".doc"],"ContentTypes":["application/msword"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"PowerpointPresentation","FileExtensions":[".ppt"],"ContentTypes":["application/vnd.ms-powerpoint"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"ExcelSpreadsheet","FileExtensions":[".xls"],"ContentTypes":["application/vnd.ms-excel"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"OpenDocumentText","FileExtensions":[".odt"],"ContentTypes":["application/vnd.oasis.opendocument.text"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"OpenDocumentPresentation","FileExtensions":[".odp"],"ContentTypes":["application/vnd.oasis.opendocument.presentation"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"OpenDocumentSpreadsheet","FileExtensions":[".ods"],"ContentTypes":["application/vnd.oasis.opendocument.spreadsheet"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"Markdown","FileExtensions":[".markdown",".mdown",".mkdn",".md",".mkd",".mdwn",".mdtxt",".mdtext",".rmd"],"ContentTypes":["text/markdown","text/x-markdown","text/plain"]},{"FormatVersions":[],"DefaultFormatVersion":null,"Format":"Mhtml","FileExtensions":[".mhtml",".mht"],"ContentTypes":["message/rfc822","application/x-mimearchive","multipart/related"]}]}

from documenttranslation.

MarcMoeHx avatar MarcMoeHx commented on May 28, 2024

Hello,

thank you for your help and sorry about late response.
I have created a new Azure Ressource for translation, now it works with the DocumentTranslation.

Interesting part:
the old ressource which not work with this repo is working with the older translator...

So, problem is solved for me :-)

Thank you

from documenttranslation.

chriswendt1 avatar chriswendt1 commented on May 28, 2024

Thanks for letting me know.
Was the old resource a free one? Document translation does require paid, S1 or higher.
I thought I had tested with free resource though, and the app should have produced a warning.

from documenttranslation.

chriswendt1 avatar chriswendt1 commented on May 28, 2024

Added exception handlers around it, added checks into the "Test" function in the Settings page, bubbled up server error messages to the status bar and to the error log. In 0.8.7.5.

from documenttranslation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.