Skip to content

Commit

Permalink
Fix for Settings names not rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasarooniZ committed Aug 14, 2024
1 parent 17f50d7 commit d7532fa
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ export function registerSettings() {
const ty =
setting === "type" ? String : new foundry.data.fields.ColorField();
const config = {
name: localizeSetting(path, isPlayer, type),
hint: localizeSettingHint(path, isPlayer, type),
name: localizeName(path, isPlayer, type),
hint: localize(`${path}.hint`),
scope: level,
config: true,
default: def,
Expand All @@ -126,12 +126,14 @@ function localize(key) {
return game.i18n.localize(`${MODULE_ID}.module-settings.${key}`);
}

function localizeSetting(path, isPlayer, type) {
return getPrefix(isPlayer, type) + localize(`${path}.name`);
}

function localizeSettingHint(path, isPlayer, type) {
return getPrefix(isPlayer, type) + localize(`${path}.hint`);
function localizeName(path, isPlayer, type) {
const playType = isPlayer ? "player" : type;
return (
(isPlayer ? getPrefix(playType) : "") +
getPrefix(type) +
" " +
localize(`${path}.name`)
);
}

function getDefault(isPlayer, setting, type) {
Expand All @@ -144,9 +146,9 @@ function getDefault(isPlayer, setting, type) {
return null;
}

function getPrefix(isPlayer, type) {
function getPrefix(prefix) {
const path = `${MODULE_ID}.module-settings.auto-coloring.prefixes.`;
return game.i18n.localize(`${path}${isPlayer ? "player" : ""}${type}`);
return game.i18n.localize(`${path}${prefix}`);
}

export function resolvePlayerWorldSetting(settingPath) {
Expand Down

0 comments on commit d7532fa

Please sign in to comment.