customize subname info placeholder per-sheet
This commit is contained in:
+3
-2
@@ -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",
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user