Skip to content

Commit 369f091

Browse files
committed
ADD - Dice permission config panel translations
1 parent 1e57686 commit 369f091

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/module/dialogs/ModifyDicePermissionsConfig.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,22 @@ export default class ModifyDicePermissionsConfig extends FormApplication {
1212
}
1313

1414
getData() {
15+
const roleLabel = key => {
16+
// key: "PLAYER", "TRUSTED", "ASSISTANT", "GAMEMASTER"
17+
const cap = key.charAt(0) + key.slice(1).toLowerCase(); // "Player", "Trusted", ...
18+
const i18nKey = `USER.Role${cap}`; // e.g. "USER.RolePlayer"
19+
const localized = game.i18n.localize(i18nKey);
20+
// If no translation is found, fall back to a pretty name
21+
return localized !== i18nKey ? localized : cap.replace(/Gm/i, 'GM');
22+
};
23+
1524
return {
1625
roles: Object.entries(CONST.USER_ROLES)
1726
.filter(([key, val]) => typeof val === 'number')
1827
.map(([key, val]) => ({
1928
key,
2029
val,
21-
label: game.i18n.localize(`USER.Role${key.capitalize()}`),
30+
label: roleLabel(key),
2231
checked: this.settings[val]
2332
}))
2433
};

src/system.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "Anima Beyond Fantasy",
44
"description": "Unofficial Anima Beyond Fantasy system for Foundry VTT",
55
"version": "2.0.1",
6-
"compatibility": { "minimum": "13", "verified": "13.345" },
6+
"compatibility": { "minimum": "13", "verified": "13.348" },
77
"url": "https://github.com/AnimaBeyondDevelop/AnimaBeyondFoundry",
88
"manifest": "https://raw.githubusercontent.com/AnimaBeyondDevelop/AnimaBeyondFoundry/main/src/system.json",
99
"changelog": "https://github.com/AnimaBeyondDevelop/AnimaBeyondFoundry/releases/tag/v2.0.1",

src/templates/dialog/config/modify-dice-formulas.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<form autocomplete="off">
22
<div class="form-group">
3-
<label>{{localize "anima.permissions.modifyDiceFormulasPermission.label"}}</label>
3+
<label>{{localize "anima.permissions.modifyDiceFormulasPermission.title"}}</label>
44
<p class="notes">{{localize "anima.permissions.modifyDiceFormulasPermission.hint"}}</p>
55
</div>
66

0 commit comments

Comments
 (0)