krbz999 / babonus

Other
18 stars 6 forks source link

Using the system native `Traits.choices` method prevents babele from translating weapons, armors, and tools #396

Closed Padhiver closed 1 month ago

Padhiver commented 5 months ago

Describe the bug With BaB activated, the translation of weapons, armour and tools on the character sheet is no longer active when playing in a language other than English (tested in French). Also in item properties. (See screenshots below)

To Reproduce Steps to reproduce the behavior:

  1. Activate the d&d 5e Français translation module. https://github.com/adgranger/foundryvtt-dnd5e-lang-fr-fr
  2. Open the character sheet and activate weapon or armour proficiency, for example.
  3. They are in English.

Expected behavior They should be in French.

Screenshots image

Setup Describe your foundry setup.

Additional context Not much to add, but thanks for this module. :D

krbz999 commented 5 months ago

Note: I have zero clue how translation modules work to modify the names of documents inside compendiums.

The only relevant change made in bab v11.10 is that I use a system-native method (the SelectChoices class). I somehow doubt this could interfere with other modules, since it's technically not anything custom written for bab. And I of course don't mess with the names at all; if simply retrieving the partial index of some items causes the translation module to fail, that'd surely have to be an issue on their end.

Padhiver commented 5 months ago

As for how the translation works, it's pretty basic: you take the object name (or ID) from the English compendium and change it, along with its description: (Then there's the more complicated part, but Babele's in charge)

        "Dagger": {
            "name": "Dague",
            "description": "<p>Blabla dagger description blabla.</p>"
        },

It also changes the name which can also be found in the weapons proficiency window on the character sheet. I'm going to see what we can do with the translation module, if there's anything we can do. 😄

Ps : I should have mentioned it just in case, but with an older version (11.9) the problem didn't exist.

krbz999 commented 5 months ago

If simply loading the item (partially) from the compendium is enough to prevent this change of name and description, then that seems like a bigger issue with how the translation module is making its changes.

I'd encourage you to find out how it does its thing, but I'm afraid I don't have the bandwidth to dive into the behavior of other modules, so my best guess here is all I can do.

If it does turn out to be specific to babonus - i.e., running this world script below does not cause the behavior -- then I will look into it.

Hooks.once("ready", async () => {
  const trees = {};
  for (const k of ["languages", "weapon", "armor", "tool"]) {
    trees[k] = await dnd5e.documents.Trait.choices(k);
  }
  return trees;
});
Padhiver commented 5 months ago

The problem is there with BaB deactivated and the world script running. I'm going to talk to the dev' of the translation module to see if he has any idea where it might be coming from. :)

Thank you !

krbz999 commented 3 months ago

@Padhiver Has this issue persisted to v3.2.0?

Padhiver commented 3 months ago

@Padhiver Has this issue persisted to v3.2.0?

Sadly, yes.

krbz999 commented 3 months ago

@Padhiver Has this issue persisted to v3.2.0?

Sadly, yes.

Hm. OK. It seems to be a problem with babele, though, going by this issue: https://github.com/foundryvtt/dnd5e/issues/3587