Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New releases don't use the auto translate #4

Open
SpockBauru opened this issue Apr 7, 2021 · 4 comments
Open

New releases don't use the auto translate #4

SpockBauru opened this issue Apr 7, 2021 · 4 comments

Comments

@SpockBauru
Copy link

SpockBauru commented Apr 7, 2021

Newer versions of HS2_MakerSearch (after v1.2.1) don't auto translates texts that are not translated already. You need to hover the mouse over the item and wait for the translation.

Something in v1.3.0 created this behavior.

To replicate the issue:

Delete the Mods.txt file inside BepInEx\Translation\en\Text

Open the Character maker, and open the XUnity.AutoTranslator UI (Alt + 0)

Go to clothes> Tops and search for SENA mods. You will see that in v1.3.0 (and beyond) the translations are not added to the queue in XUA UI, and you need to hover the mouse on the clothes for 2 seconds to translate them. But in the old v1.2.1 all untranslated text are added to the XUA queue and are translated as expected.

@GeBo1
Copy link

GeBo1 commented Apr 7, 2021

I took a look and I think it might be this:

foreach (var info in whatever) {
    TranslationHelper.Translate(info.name, s => Tools.searchNameStrings[info] = info.name + "/v" + s);
}

Since Translate is async info can be a different object when the callback fires. Try:

foreach (var info in whatever) {
    var currentInfo = info;
    TranslationHelper.Translate(info.name, s => Tools.searchNameStrings[currentInfo] = currentInfo.name + "/v" + s);
}

@Mantas-2155X
Copy link
Owner

Hello, thank you for the issue.
I have spent a while investigating and trying to figure out what's wrong.

The reason why versions before v1.3.0 worked fine is because MakerSearch at that time did not have its own caching system and was force translating every clothing item every boot.

Versions v1.3.0 and after have a separate caching system which keeps the translated items for later use. Removing the Mods.txt file or the entire Translation folder did not cause it to re-translate all clothing items because of the saved cache in BepInEx/cache/HS2_MakerSearch.cache. If an item is in that cache, it will not ask XUA to translate it, that is why you need to hover over the name.

Please verify this on your end by:

  • Removing BepInEx/translation/
  • Removing BepInEx/cache/HS2_MakerSearch.cache
  • Booting into the character maker with the XUA UI open - see everything being translated. After it stops translating, search for SENA and hover over all the items - they should be translated because they were not in MakerSearch cache.
  • Exit the character maker gracefully (by using the in-game exit option), otherwise MakerSearch cache might not be saved.

I will implement GeBo1's suggestion for the next version.

@SpockBauru
Copy link
Author

Cleaning the cache did the trick, thanks!

@GeBo1
Copy link

GeBo1 commented Jun 10, 2021

There's still an issue where due to the in-plugin cache it won't update when translations are added/changed/corrected, will they? If possible the best option would probably be to use TryTranslate() first, and don't persist the translations returned from that between sessions, then fall back to TranslateAsync for entries where that fails, and persist those. In that case anything that comes from local translations will keep in sync with the translations and only auto-translated responses would be cached. Otherwise some sort of periodic trashing of the cache, I guess.

@SpockBauru SpockBauru reopened this Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants