Skip to content

Better localization for promptLocation #1980

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
16 changes: 8 additions & 8 deletions modules/model/item/components/locational.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,34 @@ export class LocationalItemModel extends BaseItemModel {
async promptLocation() {
let location = await Dialog.wait({
title: game.i18n.localize("Location"),
content: "Choose Location",
content: game.i18n.localize("Dialog.ChooseLocation"),
buttons: {
l: {
label: `${game.i18n.localize("Left")} ${this.location.value}`,
label: game.i18n.format("Dialog.LeftLocation", {location: this.location.value}),
callback: () => {
return "l";
}
},
r: {
label: `${game.i18n.localize("Right")} ${this.location.value}`,
label: game.i18n.format("Dialog.RightLocation", {location: this.location.value}),
callback: () => {
return "r";
}
}
}
})

});

let locationkey = game.wfrp4e.utility.findKey(this.location.value, game.wfrp4e.config.promptLocations, { caseInsensitive: true })
let displayLocation = this.location.value;

if (location == "l") {
displayLocation = `${game.i18n.localize("Left")} ${this.location.value}`
displayLocation = game.i18n.format("Dialog.LeftLocation", {location: this.location.value});
}
if (location == "r") {
displayLocation = `${game.i18n.localize("Right")} ${this.location.value}`
displayLocation = game.i18n.format("Dialog.RightLocation", {location: this.location.value});
}

this.parent.updateSource({ "system.location": { key: location + this.location.value, value: displayLocation } })
this.parent.updateSource({ "system.location": { key: location + locationkey, value: displayLocation } });
}

usesLocation(weapon) {
Expand Down
13 changes: 13 additions & 0 deletions modules/system/config-wfrp4e.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ WFRP4E.toTranslate = [
"difficultyLabels",
"difficultyNames",
"locations",
"promptLocations",
"availability",
"trappingTypes",
"trappingCategories",
Expand Down Expand Up @@ -585,6 +586,18 @@ WFRP4E.locations = {
"lLeg": "WFRP4E.Locations.lLeg",
}

WFRP4E.promptLocations = {
"Head": "WFRP4E.Locations.head",
"Body": "WFRP4E.Locations.body",
"Arm": "WFRP4E.Locations.arm",
"Leg": "WFRP4E.Locations.leg",
"Ear": "WFRP4E.Locations.ear",
"Eye": "WFRP4E.Locations.eye",
"Hand": "WFRP4E.Locations.hand",
"Foot": "WFRP4E.Locations.foot",
"Toe": "WFRP4E.Locations.toe",
};

// Trapping Availability
WFRP4E.availability = {
"None": "-",
Expand Down
8 changes: 8 additions & 0 deletions static/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,9 @@
"DIALOG.GainPrayerContent" : "Gaining this miracle will cost {xp} XP.",
"DIALOG.ErrorMustSelectItem" : "Must select at least 1 Item",
"DIALOG.ItemDialog" : "Item Dialog",
"Dialog.ChooseLocation" : "Choose Location",
"Dialog.LeftLocation" : "Left {location}",
"Dialog.RightLocation" : "Right {location}",

"CHAT.Quickcasting" : "Quick Casting",
"CHAT.CareerChoose" : "Choose Your Career",
Expand Down Expand Up @@ -1079,6 +1082,11 @@
"WFRP4E.Locations.lLeg": "Left Leg",
"WFRP4E.Locations.arm": "Arm",
"WFRP4E.Locations.leg": "Leg",
"WFRP4E.Locations.ear": "Ear",
"WFRP4E.Locations.eye": "Eye",
"WFRP4E.Locations.hand": "Hand",
"WFRP4E.Locations.foot": "Foot",
"WFRP4E.Locations.toe": "Toe",

"WFRP4E.ScatterTable": "Scatter",
"WFRP4E.Scatter.TopLeft": "Top Left",
Expand Down