new consumable types
Tried adding localization strings for some new consumable types, but keep getting this ("
DND5E.Consumable[...]
") no matter what. I'm 99% I have followed all guides on localization to the point. en.json
in the module.json, etc etc, with all the needed strings inside.C
Calego•802d ago
How are you adding new consumable types?
Z
Zhell•802d ago
Hooks.on('ready')
, overriding CONFIG.DND5E.consumableTypes
C
Calego•802d ago
kk, looks like
CONFIG.DND5E.consumableTypes
has the output of game.i18n.localize
cached during setup
hook,
So adding to that after that point you'll need to provide the already-localized versionsC
Calego•802d ago
https://gitlab.com/foundrynet/dnd5e/-/blob/master/dnd5e.js#L149
This little thing does that, it runs through the
CONFIG.DND5E
keys provided and replaces the values with their localized versionsGitLab
dnd5e.js · master · Foundry Network / Foundry VTT 5th Edition
An implementation of the Dungeons & Dragons 5th Edition game system for Foundry Virtual Tabletop (http://foundryvtt.com). This work is permitted under the Open...
Z
Zhell•802d ago
I'd just add that hook (on 'setup'?), as is, with
localizeKeys
and sortKeys = ['consumableTypes']
? Easy as that? 🤔C
Calego•802d ago
nono, you'd want something like this:
the important thing is that you do the
game.i18n.localize
part yourself, since the 5e system believes it doesn't need to when it uses values from CONFIG.DND5E.consumableTypes
Z
Zhell•802d ago
What is
MY_KEY
in this example? Tried CONFIG.DND5E.consumableTypes.elixir = game.i18n.localize("DND5E.ConsumableElixir")
in the console as a test, but that changes its name to... well DND5E.ConsumableElixirC
Calego•802d ago
MY_KEY
is a localization key you would define in your module's en.json
. I wouldn't recommend using DND5E.Whatever
as that implies it was added by the dnd5e package.
Here's a more complete example:
You could do this in your en.json
:
To make what you pasted here work, but this is not recommended.Z
Zhell•802d ago
But that is what I had done. 🤔
C
Calego•802d ago
curious
can you paste what you've got in here? or is it hosted somewhere we can see?
Z
Zhell•802d ago
en.json?
C
Calego•802d ago
and the bit of your js that deals with the hook
Z
Zhell•802d ago
custom-itemTypes.mjs
:
C
Calego•802d ago
I take back half of what I have said
Z
Zhell•802d ago
😬
C
Calego•802d ago
https://gitlab.com/foundrynet/dnd5e/-/blob/master/module/apps/ability-use-dialog.js#L169
Here's where the string that's displayed is being composed.
Spot the problem
GitLab
module/apps/ability-use-dialog.js · master · Foundry Network / Foun...
An implementation of the Dungeons & Dragons 5th Edition game system for Foundry Virtual Tabletop (http://foundryvtt.com). This work is permitted under the Open...
C
Calego•802d ago
Instead of assuming that the value desired is in
CONFIG.DND5E.consumableTypes
... the localization string is constructed ad-hoc out of the consumable type on the item.
sigh
SO, You definitely need to add these strings to the en.json
with the DND5E.
prefix
And, since this doesn't really care about the consumableTypes
value, you need to make sure your key is structured so that it's going to work with that capitalize()
Z
Zhell•802d ago
ie 'elixir' should work but not 'potionPill'
C
Calego•802d ago
"DND5E.ConsumablePotionTonic": "Tonic",
Might need to be:
"DND5E.ConsumablePotiontonic": "Tonic",
capitalize
apparently isn't a normal string method... so I can't tell but in-foundry try this from console:
Z
Zhell•802d ago
returns
'PotionTonic'
C
Calego•802d ago
wtf
Z
Zhell•802d ago
🤷
C
Calego•802d ago
so then
potionTonic
would end up looking for DND5E.ConsumablePotionTonic
, which you have...Z
Zhell•802d ago
Yeah and Elixir, Bomb, etc etc, they should all work
(... also apparently 'ammo' doesn't work either. I didn't add that, I just kept it in because I wanted to keep it)
C
Calego•802d ago
Ok, you said you tried
game.i18n.localize(...
from console and it didn't do it?
like just as a test of the localization setupZ
Zhell•802d ago
Z
Zhell•802d ago
Interestingly...
Z
Zhell•802d ago
and just for good measure
C
Calego•802d ago
if there's no key found it spits back what you give it
show me your module manifest in full
Z
Zhell•802d ago
C
Calego•802d ago
oh
you're gonna hate this
trailing comma
Z
Zhell•802d ago
You're right.
C
Calego•802d ago
did that do it?
Z
Zhell•802d ago
Gonna test real quick, but hold on, there are commas in the system folder's en.json
C
Calego•802d ago
it's the trailing comma that makes JSON mad
i.e. the last one shouldn't have a comma, the rest should
Z
Zhell•802d ago
oh gosh darn it
C
Calego•802d ago
yup
may I recommend #screaming-into-the-void
that was a journey lol
Z
Zhell•802d ago
It works now. Thank you.
C
Calego•802d ago
happy to help 🙂
Want results from more Discord servers?
More Postsspell-compendium-5e alpha1Overriding onDropItem & onSortItemYou'd override them in your sheet class.getter & setter wrapper for settingsI'm trying to use a getter & setter pair as an interface for `game.settings.get` and `game.settings.scrollable tab contentsIt is possible, and you're firmly in the css and DOM structure side of development with this line ofJr devI'm cleaning out my bookmarks and accidentally came back to this article. Potentially useful startinHTCPackage: `hero-creation-tool`System Specific CSSI'm not 100% about this, but it is worth watching out that your solution doesn't actually end up beiadvancement-wipCommander register apitalking about permissions, im working on the registering api for the Commander, and I wanted to ask Azgaars Blurry MapHey all. I'm taking a look at my importer for Azgaar's Fantasy Map Generator and wondering how I canccjmk overlaybut for what I wanted I think I *needed* to append it there so that I can overlay the whole screencliits very very early alpha demoMonarch APIAlright, adventurous ones: I have a Beta version of Monarch with the new components API!
Manifest: compacted chat cardsModules create problems to solve problems... Today's problem: "When I roll an attack, it eats the whdragdrop shenneneginsRight now, a user can drag a spell onto their character sheet. I store that in a 'spell' array and leffect mini modulesI've gotten to the point where I'm confident in releasing a slurry of tiny no-config Active Effect rdamage application hooksNew 5e Hook ideas, gimme yer thoughts:
`Hooks.call('Actor5e.preDamageApplied')`
args: `damageAmounthook conventionsRegarding hooks, is the convention that _all_ `pre...` hooks are executed on the machine that initiaexpand arraysIs there a way to `expandObject` except for an Array?edit-owned-item-effectI've made an abomination. This hacks its way past the limitations surrounding editing effects on own