asacolips-projects / boilerplate

Boilerplate system for FoundryVTT to use as a starting point for your own system's development. Follow along with the [accompanying tutorial](https://foundryvtt.wiki/en/development/guides/SD-tutorial) on the wiki.
Other
11 stars 2 forks source link

LOCALIZATION_PREFIXES fix with base DataModels #34

Open yjeroen opened 1 week ago

yjeroen commented 1 week ago

base-actor model - add line:

  static LOCALIZATION_PREFIXES = ['BOILERPLATE.Actor.base'];

actor-npc model:

  static LOCALIZATION_PREFIXES = [...super.LOCALIZATION_PREFIXES, 'BOILERPLATE.Actor.Npc'];

character-npc model:

  static LOCALIZATION_PREFIXES = [...super.LOCALIZATION_PREFIXES, 'BOILERPLATE.Actor.Npc'];

en.json:

      "base": {
        "FIELDS": {
          "biography": {"label": "Biography"},
          "health.value": {"label": "Health"},
          "health.max": {"label": "Maximum Health"},
          "power.value": {"label": "Power"},
          "power.max": {"label": "Maximum Power"}
        }
      },
      "Character": {
        "FIELDS": {
          "attributes.level.value": {"label": "Level"}
        }
      },
yjeroen commented 1 week ago
    Handlebars.registerHelper('label', function (fieldPath) {
        try {
            if (this.system?.schema?.getField(fieldPath)?.label)
                return this.system?.schema?.getField(fieldPath)?.label;
            else 
                throw new Error();
        } catch (e) {
            console.warn(`Handlebars Helper | Error during label creation of '${fieldPath}'`);
            return fieldPath;
        }
    });
yjeroen commented 1 week ago

Reworked header.hbs as well, altough it should get a rework of the