microsoft / Multilingual-App-Toolkit

This repo contains samples that demonstrate the localization workflow for users of the Multilingual Application Toolkit Visual Studio extension and editor. You can also use GitHub Issues to submit feedback, report bugs, or ask questions.
MIT License
24 stars 4 forks source link

Runtime issue with MAT Editor #30

Open dannydel opened 4 months ago

dannydel commented 4 months ago

There seems to be a problem with the MAT editor currently. I am not sure how it got into this state but it will either throw a 401: Not Authorized error (even after double checking my api key, end point, etc), or it will throw a The category parameter is invalid. in the messages area. I was able to do one single full translation before this happened.

image

My colleague is doing the same thing but it works for them, no errors and no parameters possibly invalid.

Version: 4.1.14.0

What I have tried:

I wanted to see if anyone else has had these issues (noting issue #28 ) and may have a fix or workaround.

Thank you!

joshftb commented 3 months ago

We haven't been able to find a repro for this. Please try:

Let us know if the issue persists after these steps.

nrcole commented 3 months ago

I uninstalled the editor and deleted the folder. Reinstalled the latest version (which is what was originally installed) and still have the same problems. I also verified that I have the same issues stated above as well as in my Issue #28. The only difference now is that my workaround no longer works. I get "The category parameter is invalid" like stated above in this issue.

I have deleted the resource group and translator, the created a new group and translator service. I have verified that the key, region and custom translator are all correct. All with the same result.

dannydel commented 3 months ago

I have a workaround I believe.

After some searching around I came across the LocalData Multilingual App Toolkit folder which houses the credentials. D:\Users\johnsmith\AppData\Local\Multilingual App Toolkit

In that folder there is MicrosoftTranslatorSettings.json which holds what is on the Settings page of the Tool. My friend also had the tool installed but an older version and compared his file with mine. He only had the TranslatorKey filled in and then the fields Region and Category were null. Mine were filled in or empty strings. His also had Fallback set to false which mine was true.

So after I nulled out Category and Region and made Fallback: false. I saved the file and was able to run the translations as normal.

Sample of corrected file:

{
    "TranslatorKey": "TranslationKeyHere",
    "Service": {
        "Region": null,
        "Category": null,
        "AllowFallback": false,
        "ProfanityAction": "NoAction",
        "ProfanityMarker": "Asterisk",
        "IncludeAlignment": false,
        "IncludeSentenceLength": false,
        "AvailableRegions": [
            "australiaeast",
            "brazilsouth",
            "canadacentral",
            "centralindia",
            "centralus",
            "centraluseuap",
            "eastasia",
            "eastus",
            "eastus2",
            "francecentral",
            "japaneast",
            "japanwest",
            "koreacentral",
            "northcentralus",
            "northeurope",
            "southafricanorth",
            "southcentralus",
            "southeastasia",
            "uksouth",
            "westcentralus",
            "westeurope",
            "westus",
            "westus2"
        ]
    }
}

For some reason, if you do a fresh install of the current version and add the settings as expected (even keeping fallback set to off), it will work once and then fail with the above error each time. I believe it overwrites the file with incorrect values that it later on uses and fails.

This should really be looked into.

nrcole commented 3 months ago

Thank you for the suggestion. Unfortunately, this workaround does not work for me. Even my previous workarounds have quite working. I hope someone from MSFT will look in to this and get it fixed.

nrcole commented 3 months ago

I constantly get a 401: Not Authorized error. I wrote a console app that uses my Key and location to verify that azure is working correct. I have had no issue at all getting my console app to return translated text using my key. This verifies that the Azure Portal is setup correct.

joshftb commented 3 months ago

Hi, @nrcole, @dannydel, thanks for the feedback and for providing that additional information. We will look into this.

joshftb commented 2 months ago

Hi @nrcole, can you confirm that the region in your translator resource in Azure matches the region in C:\Users\[your user]\AppData\Local\Multilingual App Toolkit\MicrosoftTranslatorSettings.json

image

nrcole commented 2 months ago

Hi @joshftb, I have confirmed and have attached screenshots of both for you to look over. The translator key is correct in the json, I just removed it for security reasons for posting in this thread.

Screenshot 2024-04-23 072726 Screenshot 2024-04-23 072903

I am currently getting this error. Screenshot 2024-04-23 073224

Once in a while it will give a different message int he messages tab but most of the time i get this one.

joshftb commented 2 months ago

@nrcole,

That category is not valid -- the category field is for the category ID of a custom trained model.

If you clear out the custom translator field, save, and restart, it should work: image

Just make sure the category is null or an empty string in the config JSON:

image

nrcole commented 2 months ago

@joshftb, Thank you for your continued support. This has been very frustrating to say the least.

I tried your suggestions and started getting a 401-Unathorized message. I know that the settings in Azure are correct because I can write a console app that uses those setting and it works perfect. I had to delete the MAT folder from the Local AppData. Reboot and hold my breath just right. It seems to be working for now. I still get random 401-Unathorized messages but no more category id issues. I did have to enter the subscription key AND the region. Your example above does not have the region.

Also, one other thing to note is that if I manually opened the settings and entered the values, the translator would fail with 401 messages. I had to clear the folder, reopen the MAT program and click translate all. It would then bring up the settings screen and I could enter the values. This seems to be the only way I could get it to work.

There still seems to be some kind of bug in the cache or program somewhere.

This tool is amazing and I hope that Microsoft continues to make improvements or creates a new tool for XLF files. Thanks again for your support.

Nathan