Merge pull request #767 from Foundryborne/fix/762-custom-domain-localization

[Fix] 762 - Custom Domain Localization
This commit is contained in:
Chris Ryan 2025-08-10 19:36:49 +10:00 committed by GitHub
commit 33ac683a91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 29 additions and 10 deletions

View file

@ -359,6 +359,11 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
context.community = { ...this.setup.community, compendium: 'communities' };
context.class = { ...this.setup.class, compendium: 'classes' };
context.subclass = { ...this.setup.subclass, compendium: 'subclasses' };
const allDomainData = CONFIG.DH.DOMAIN.allDomains();
context.classDomains = context.class.uuid
? context.class.system.domains.map(key => game.i18n.localize(allDomainData[key].label))
: [];
context.domainCards = Object.keys(this.setup.domainCards).reduce((acc, x) => {
acc[x] = { ...this.setup.domainCards[x], compendium: 'domains' };
return acc;

View file

@ -60,6 +60,17 @@ export default class DHClass extends BaseDataItem {
/* -------------------------------------------- */
get domainData() {
const allDomainData = CONFIG.DH.DOMAIN.allDomains();
return this.domains.map(key => {
const domain = allDomainData[key];
return {
...domain,
label: game.i18n.localize(domain.label)
};
});
}
get hopeFeatures() {
return this.features.filter(x => x.type === CONFIG.DH.ITEM.featureSubTypes.hope).map(x => x.item);
}

View file

@ -33,6 +33,11 @@ export default class DHDomainCard extends BaseDataItem {
};
}
get domainLabel() {
const allDomainData = CONFIG.DH.DOMAIN.allDomains();
return game.i18n.localize(allDomainData[this.domain].label);
}
/* -------------------------------------------- */
/**@override */
@ -71,7 +76,7 @@ export default class DHDomainCard extends BaseDataItem {
_getTags() {
const tags = [
game.i18n.localize(`DAGGERHEART.CONFIG.DomainCardTypes.${this.type}`),
game.i18n.localize(`DAGGERHEART.GENERAL.Domain.${this.domain}.label`),
this.domainLabel,
`${game.i18n.localize('DAGGERHEART.ITEMS.DomainCard.recallCost')}: ${this.recallCost}`
];
@ -85,7 +90,7 @@ export default class DHDomainCard extends BaseDataItem {
_getLabels() {
const labels = [
game.i18n.localize(`DAGGERHEART.CONFIG.DomainCardTypes.${this.type}`),
game.i18n.localize(`DAGGERHEART.GENERAL.Domain.${this.domain}.label`),
this.domainLabel,
{
value: `${this.recallCost}`, //converts the number to a string
icons: ['fa-bolt']