fh-fvtt / zweihander

This is an unofficial community implementation of the Zweihander d100 system for FoundryVTT
https://raw.githubusercontent.com/fh-fvtt/zweihander/main/system.json
MIT License
10 stars 7 forks source link

Added multilanguage framework for localizing Zweihander #177

Closed lozanoje closed 1 year ago

lozanoje commented 1 year ago

A few considerations:

I need to add some handlebars, since I didnt find where to put them: NOTE: already added to helpers.js

  $$2("zhConditionLadderLoc", function(name, choices, options) {
    const checked = options.hash["checked"] ?? 5;
    let html = "";
    let uuid = uuidv4();
    for (let i = choices.length - 1; i >= 0; i--) {
      const isChecked = checked == i;
      html += `
        <div class="radio-and-status">
          <input type="radio" class="radio-rank"
            id="${uuid}.${i}" name="${name}"
            value="${i}" data-dtype="Number" ${isChecked ? "checked" : ""}>
          <label for="${uuid}.${i}" class="status">
            <span><span>` + game.i18n.localize('ZWEI.actor.conditions.' + choices[i]) + `</span></span>
          </label>
        </div>`;
    }
    return new Handlebars.SafeString(html);
  });

      $$2("zhGetBonus", function(word) {
    if (typeof word !== "string")
      return game.i18n.localize('ZWEI.actor.bonuses.' + 'B');
        return game.i18n.localize('ZWEI.actor.bonuses.' + word.charAt(0).toUpperCase() + 'B')
  });

  $$2("zhConcat", (...strs) =>
    strs.filter((s) => typeof s !== "object").join("")
  );

      $$2("zhSkillRankAbbreviationLoc", function(rank) {
    return ["-", game.i18n.localize('ZWEI.actor.skills.rankabbreviation.apprentice'), 
        game.i18n.localize('ZWEI.actor.skills.rankabbreviation.journeyman'), 
        game.i18n.localize('ZWEI.actor.skills.rankabbreviation.master')][rank];
  });

I need also to modify some css, since the Peril and Damage tracker for creatures uses the css, or at least remove the title "Peril"/"Damage" in the css and put it in the corresponding template:

    body.game.vtt.system-zweihander .zweihander.sheet.creature form > header section.actor-resources section.damage-ladder::before {
  color: var(--zh-clr-aqua);
  content: "PERIL";
  font-family: var(--zh-font-title);
  font-size: 10px;
  line-height: 1.5;
  padding: 3px;
  text-align: right;
  width: 9ch;
  height: 15px;
  display: block;
}
body.game.vtt.system-zweihander .zweihander.sheet.creature form > header section.actor-resources section.damage-ladder::before {
  content: "DAMAGE";
}

The keys are ZWEI.actor.secondary.peril and ZWEI.actor.secondary.damage

Finally, I have not translated currency since is a system setting, I do not know how to deal with it, if I register the currency depending on the language, probably most items (in english) wont show the right price, so I dont know if I have to translate it at rendering the price sheet.

lozanoje commented 1 year ago

The project:

  1. Release a working version for people to test
  2. Search for missing keys (I need people using it in order to report it)
  3. Homogenization of keys, including replacing current long keys, which I shouldnt use, and merging similar keys
kvndrsslr commented 1 year ago

Thanks again for your efforts! Merged to dev manually and fixed the CSS issue. Closing this here, please update your fork and base future PRs on dev.