customize subname info placeholder per-sheet

This commit is contained in:
jalensailin
2025-07-23 12:56:08 -04:00
parent 74fe41fda5
commit d8217d19bb
3 changed files with 32 additions and 3 deletions
+3 -2
View File
@@ -4,7 +4,6 @@
"DG.RollLuck": "Roll Luck",
"DG.Luck": "Luck",
"DG.FallbackText.ProfessionAndOrRank": "PROFESSION (RANK IF APPLICABLE)",
"DG.FallbackText.newItem": "New {type}",
"DG.Skills.accounting": "Accounting",
@@ -307,9 +306,11 @@
"DG.Sheet.BlockHeaders.PersonalInfoCV": "PERSONAL INFORMATION / CV",
"DG.Sheet.BlockHeaders.BondsRelationshipsContacts": "BONDS / RELATIONSHIPS / CONTACTS",
"DG.AgentSheet.ProfessionPlaceholder": "PROFESSION (RANK IF APPLICABLE)",
"DG.UnnaturalSheet.HideUntrainedSkillsLabel": "Hide Untrained",
"DG.UnnaturalSheet.NotesLabel": "Notes",
"DG.UnnaturalSheet.ShortDescriptionFallbackText": "Description of creature or creature type",
"DG.UnnaturalSheet.ShortDescriptionPlaceholder": "Description of creature or creature type",
"DG.UnnaturalSheet.ShowUntrainedSkillsLabel": "Show Untrained",
"DG.UnnaturalSheet.Tabs.NotesTabLabel": "Skills & Notes",
"DG.UnnaturalSheet.Tabs.ItemsTabLabel": "Attacks & Abilities",
+28
View File
@@ -68,6 +68,9 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) {
this.actor,
);
// Prepare subname info placeholder.
context.subnameInfoPlaceholder = this._prepareSubnameInfoPlaceholder();
// Early return if this is a vehicle.
if (this.actor.type === "vehicle") return context;
@@ -174,6 +177,31 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) {
/* --------- Context Preparation Functions --------- */
/**
* Prepares the subname info placeholder based on the actor type.
* Returns a localized string that acts as a placeholder for different
* types of actors, such as "unnatural", "vehicle", or defaulting to
* "agent" type.
*
* @returns {string} The localized placeholder string for the actor's subname info.
*/
_prepareSubnameInfoPlaceholder() {
let subnameInfoPlaceholder = "";
switch (this.actor.type) {
case "unnatural":
subnameInfoPlaceholder =
"DG.UnnaturalSheet.ShortDescriptionPlaceholder";
break;
case "vehicle":
subnameInfoPlaceholder = "DG.VehicleSheet.DescriptionPlaceHolder";
break;
default:
subnameInfoPlaceholder = "DG.AgentSheet.ProfessionPlaceholder";
break;
}
return game.i18n.localize(subnameInfoPlaceholder);
}
/**
* Sorts the skills on the actor sheet based on the appropriate localized entry.
* For the Japanese language, the sort label is the ruby text.
+1 -1
View File
@@ -23,7 +23,7 @@
<input name="system.biography.profession"
type="text"
value="{{actor.system.biography.profession}}"
placeholder="{{localize 'DG.FallbackText.ProfessionAndOrRank'}}" />
placeholder="{{subnameInfoPlaceholder}}" />
</h2>
</div>
</div>