mhilbrunner / foundryvtt-dnd5e-lang-de

German translation of the dnd5e system for Foundry Virtual Tabletop
12 stars 11 forks source link

Compendiums broken #8

Closed Taroc0 closed 9 months ago

Taroc0 commented 11 months ago

Versions: Foundry v11.315 DnD 2.4.0 DnD German Translation: 2.4.1 Babele 2.5.2 libwrapper 1.12.13.0 Additional Metric Ruler Labels: 3.1.9 German [Core]: 11.1

Problem: I can't open/read any compendium items with the above modules active. With only DnD German Translations deactivated the compendiums does work again.

DevTools error message:

caught (in promise) TypeError: undefined. m.replace is not a function [Detected 2 packages: FoundryVTT-dnd5e-DE, babele] at FieldMapping.convertSource [as converter] (dnd5e-de.js:546:46) at FieldMapping.translate (babele.js:1006:26) at FieldMapping.map (babele.js:989:28) at babele.js:1072:62 at Array.reduce () at CompendiumMapping.map (babele.js:1072:28) at TranslatedCompendium.translate (babele.js:1235:43) at Babele.translate (babele.js:763:19) at babele.js:78:54 at Array.map () at 🎁ClientDatabaseBackend.prototype._getDocuments#babele (babele.js:77:27) at async CompendiumCollection.getDocuments (foundry.js:16280:23) at async CompendiumCollection.getDocument (foundry.js:16252:23) at async Compendium._onClickEntryName (foundry.js:70218:57)

mhilbrunner commented 11 months ago

Thanks for the detailed report! Will look into this once time permits 🙏

Thoeme77 commented 10 months ago

Hi,

I was facing the same issue but found a "quick fix" which maybe breaks other stuff, but at least lets me open the compendium stuff again. In case anyone else is interested:

  1. Open "dnd5e-de.js" (path should be something like this /YourFoundryInstall/Data/modules/FoundryVTT-dnd5e-DE/...)
  2. Navigate to line 546 and change the line to:

translation = translation + ' (' + m.toString().replace('pg.', 'S.').replace('PG.', 'S.') + ')';

The error seems to be that sometimes 'm' isn't a string therefore 'replace' is failing. Keep in mind this is only a temporary fix, but you should be able to open the compendium entries again. Also I have no idea if this breaks anything else, but so far it seemed to work for me.

mhilbrunner commented 9 months ago

I just released version 2.5.0 which should fix this issue. Please update the package and let me know if you run into any more issues. Thanks for helping out!