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

@ -14,7 +14,7 @@ This is the community repo for the Foundry VTT system _Foundryborne_ Daggerheart
## User Install ## User Install
1. **recommended** Searching for _Daggerheart_ or _Foundryborne_ in the System Instalaltion dialgoe of the FoundryVTT admin settings. 1. **Recommended** Searching for _Daggerheart_ or _Foundryborne_ in the System Installation dialogue of the FoundryVTT admin settings.
2. Pasting `https://raw.githubusercontent.com/Foundryborne/daggerheart/refs/heads/main/system.json` into the Install System dialog on the Setup menu of the application. 2. Pasting `https://raw.githubusercontent.com/Foundryborne/daggerheart/refs/heads/main/system.json` into the Install System dialog on the Setup menu of the application.
3. Downloading one of the .zip archives from the Releases page and extracting it into your foundry Data folder, under Data/systems/daggerheart. 3. Downloading one of the .zip archives from the Releases page and extracting it into your foundry Data folder, under Data/systems/daggerheart.

View file

@ -359,6 +359,11 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
context.community = { ...this.setup.community, compendium: 'communities' }; context.community = { ...this.setup.community, compendium: 'communities' };
context.class = { ...this.setup.class, compendium: 'classes' }; context.class = { ...this.setup.class, compendium: 'classes' };
context.subclass = { ...this.setup.subclass, compendium: 'subclasses' }; 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) => { context.domainCards = Object.keys(this.setup.domainCards).reduce((acc, x) => {
acc[x] = { ...this.setup.domainCards[x], compendium: 'domains' }; acc[x] = { ...this.setup.domainCards[x], compendium: 'domains' };
return acc; 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() { get hopeFeatures() {
return this.features.filter(x => x.type === CONFIG.DH.ITEM.featureSubTypes.hope).map(x => x.item); 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 */ /**@override */
@ -71,7 +76,7 @@ export default class DHDomainCard extends BaseDataItem {
_getTags() { _getTags() {
const tags = [ const tags = [
game.i18n.localize(`DAGGERHEART.CONFIG.DomainCardTypes.${this.type}`), 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}` `${game.i18n.localize('DAGGERHEART.ITEMS.DomainCard.recallCost')}: ${this.recallCost}`
]; ];
@ -85,7 +90,7 @@ export default class DHDomainCard extends BaseDataItem {
_getLabels() { _getLabels() {
const labels = [ const labels = [
game.i18n.localize(`DAGGERHEART.CONFIG.DomainCardTypes.${this.type}`), 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 value: `${this.recallCost}`, //converts the number to a string
icons: ['fa-bolt'] icons: ['fa-bolt']

View file

@ -10,7 +10,7 @@
} }
.character-row .domains-section img { .character-row .domains-section img {
filter: invert(88%) sepia(98%) saturate(1784%) hue-rotate(311deg) brightness(104%) contrast(91%); filter: @golden-filter;
} }
} }
}, { }, {
@ -20,7 +20,7 @@
} }
.character-row .domains-section img { .character-row .domains-section img {
filter: invert(87%) sepia(15%) saturate(343%) hue-rotate(333deg) brightness(110%) contrast(87%); filter: brightness(0) saturate(100%);
} }
} }
}); });

View file

@ -10,9 +10,7 @@
{{#each domainCards as |domainCard id|}} {{#each domainCards as |domainCard id|}}
<div class="selections-container domain-card" data-card="{{id}}"> <div class="selections-container domain-card" data-card="{{id}}">
{{#> "systems/daggerheart/templates/components/card-preview.hbs" domainCard }} {{#> "systems/daggerheart/templates/components/card-preview.hbs" domainCard }}
{{#each @root.class.system.domains }} {{#each @root.classDomains }}<div>{{this}}</div>{{/each}}
<div>{{localize (concat "DAGGERHEART.GENERAL.Domain." this ".label")}}</div>
{{/each}}
{{/"systems/daggerheart/templates/components/card-preview.hbs"}} {{/"systems/daggerheart/templates/components/card-preview.hbs"}}
</div> </div>
{{/each}} {{/each}}

View file

@ -87,9 +87,9 @@
</div> </div>
{{#if document.system.class.value}} {{#if document.system.class.value}}
<div class="domains-section"> <div class="domains-section">
{{#each document.system.class.value.system.domains as |domain|}} {{#each document.system.class.value.system.domainData as |data|}}
<div class="domain"> <div class="domain">
<img src="{{concat 'systems/daggerheart/assets/icons/domains/' domain '.svg'}}" alt="" data-tooltip="{{localize (concat 'DAGGERHEART.GENERAL.Domain.' domain '.label')}}" /> <img src="{{data.src}}" alt="" data-tooltip="{{data.label}}" />
</div> </div>
{{/each}} {{/each}}
</div> </div>