Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translate +{stat} at end of trigger on move roll popup and stat tooltips #1039

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Next Release

- Fix an i18n issue with the translation of stats in the pre-roll dialog ([#1039](https://github.com/ben/foundry-ironsworn/pull/1039/files)) - thanks [@sharak](https://github.com/sharak)!

## 1.24.9

- Set a default icon for stellar objects, at least when changing their subtype
Expand Down
12 changes: 7 additions & 5 deletions src/module/rolls/ironsworn-roll-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ export function formatRollPlusStat(stat: string, initialCaps = false) {
* // returns "roll highest of spirit, heart, wits" for en.json
*/
export function formatRollMethod(rollMethod: DFRollMethod, stats: string[]) {
// skip if there's no choice to be made
if (stats.length === 1) {
return formatRollPlusStat(stats[0])
}
// canonical triggers have 2 stats; there's a good chance a nice string already exists, so we check for that first.
const localizedStats = stats.map((stat) =>
game.i18n.localize('IRONSWORN.' + stat.capitalize())
)

// skip if there's no choice to be made
if (localizedStats.length === 1) {
return formatRollPlusStat(localizedStats[0])
}

// canonical triggers have 2 stats; there's a good chance a nice string already exists, so we check for that first.
const methodKeyRoot = `IRONSWORN.roll method.${rollMethod}`
const possibleNiceKey = `${methodKeyRoot}.${stats.length}`
if (game.i18n.has(possibleNiceKey)) {
Expand Down
2 changes: 1 addition & 1 deletion src/module/vue/components/attr-box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div
class="block"
:class="{ [$style.box]: true, ...classes }"
:data-tooltip="formatRollPlusStat(attr, true)"
:data-tooltip="formatRollPlusStat(i18nKey, true)"
@click="click">
<label :class="$style.label">{{ $t(i18nKey) }}</label>
<div class="flexrow">
Expand Down
Loading