mclemente / fvtt-module-polyglot

Talk to others using a language you can speak and scrambles text you can't understand.
MIT License
41 stars 48 forks source link

currentLanguageProvider erroring on migrated WWN save #281

Closed jack-liska closed 1 year ago

jack-liska commented 1 year ago

Describe the bug I migrated a WWN save from 0.9 and it consistently fails to return a definition when trying to assign the currentLanguageProvider variable in api.js line 39, which cascades to setting assignment in settings.js line 87 resulting in an undefined value when trying to generate settings, which breaks the module functionality. I can only repro this on this save, seems fine on another migrated WWN world. Resetting settings, uninstalling and reinstalling module don't seem to affect it.

jack-liska commented 1 year ago

Error log:

Uncaught (in promise) TypeError: undefined. Cannot read properties of undefined (reading 'isGeneric') [Detected 1 package: polyglot] at registerSettings (settings.js:88:36) at Object.fn (polyglot.js:20:2) at #call (foundry.js:724:20) at Hooks.callAll (foundry.js:681:17) at Game.setupGame (foundry.js:7913:11) at Game._initializeGameView (foundry.js:8999:16) at Game._initializeView (foundry.js:8975:21) at Game.initialize (foundry.js:7825:16)

foundry.js:747 TypeError: Error thrown in hooked function 'bound renderChatLog' for hook 'renderChatLog'. Cannot read properties of undefined (reading 'languages') [Detected 1 package: polyglot] at Polyglot.updateUserLanguages (logic.js:306:91) at Polyglot.renderChatLog (logic.js:222:8) at #call (foundry.js:724:20) at Hooks.callAll (foundry.js:681:17) at ChatLog._render (foundry.js:5153:13) at async ChatLog._render (foundry.js:60343:5) at async ChatLog._render (foundry.js:74100:5) at async Promise.all (index 2) onError @ foundry.js:747

foundry.js:747 Error: Error thrown in hooked function '' for hook 'ready'. This is not a registered game setting [Detected 1 package: polyglot] at ClientSettings.get (foundry.js:2799:42) at Polyglot.ready (logic.js:484:44) at Object.fn (polyglot.js:25:16) at #call (foundry.js:724:20) at Hooks.callAll (foundry.js:681:17) at Game.setupGame (foundry.js:7952:11) at async Game._initializeGameView (foundry.js:8999:5) at async Game.initialize (foundry.js:7825:5)

mclemente commented 1 year ago

What value does game.settings.get("polyglot", "languageProvider") returns? If it isn't native.wwn, use game.settings.set("polyglot", "languageProvider", "native.wwn") to reset it.

jack-liska commented 1 year ago

It was returning just native for some reason. But that reset fixed it, thanks!

I'm know JS but I'm just starting to familiarize myself with Foundry's guts so this was a little past my ability to troubleshoot quickly on my own. Cheers!