Skip to content

Commit 0c50f5c

Browse files
committed
[#238] Handle label to name switch
1 parent ad22509 commit 0c50f5c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/configurations/conditions.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export function getSettingDefault(key = null) {
9292
if ( key ) return data;
9393

9494
Object.values(data).forEach(value => {
95-
value.name = game.i18n.localize(value.name);
95+
value.name = game.i18n.localize(value?.name ?? value?.label);
9696
});
9797

9898
const sortedData = Object.fromEntries(
@@ -136,7 +136,7 @@ function buildData(config) {
136136
const conditionTypes = {};
137137

138138
Object.entries(data).forEach(([key, value]) => {
139-
const conditionName = game.i18n.localize(value.name);
139+
const conditionName = game.i18n.localize(value?.name ?? value?.label);
140140
if ( conditionName > bloodied.conditionType.name && !conditionTypes.bloodied ) {
141141
conditionTypes.bloodied = bloodied.conditionType;
142142
conditionTypes.bloodied.sheet = true;
@@ -154,7 +154,7 @@ function buildData(config) {
154154
} else {
155155
data[statusEffect.id] = statusEffect;
156156
data[statusEffect.id].img = statusEffect.img;
157-
data[statusEffect.id].name = statusEffect.name;
157+
data[statusEffect.id].name = statusEffect?.name ?? statusEffect?.label;
158158
}
159159
};
160160

@@ -204,7 +204,7 @@ export function setConfig(data = null) {
204204
Object.entries(data)
205205
.filter(([_, value]) => value.visible || value.visible === undefined)
206206
.forEach(([key, value]) => {
207-
const localisedName = game.i18n.localize(value.name ?? value);
207+
const localisedName = game.i18n.localize(value?.name ?? value?.label ?? value);
208208

209209
// Merge with default config in case their are any new properties
210210
value = foundry.utils.mergeObject(foundry.utils.deepClone(getSettingDefault(key)) ?? {}, value);

0 commit comments

Comments
 (0)