Closed dmrickey closed 1 year ago
tokenActionHudCoreApiReady
is called from within the ready
hook. When is game.i18n.translations.COMBAT.TurnEnd
defined?
I'm not sure, it's a core string. There is a separate i18nInit
hook. But I would assume that should have already been fired by the time ready
is fired
The expected sequence is:
ready
hook is called.tokenActionHudCoreApiReady
hook within a ready
hook call handler.tokenActionHudSystemReady
hook within tokenActionHudCoreApiReady
hook call handlers.tokenActionHudSystemReady
hook call handler.I've not had any issue with game.i18n.localize
calls within the build phase, but I've not used game.i18n.translations
anywhere.
Calling game.i18n.localize
seems to work fine. This is specifically trying to use a core foundry value that's already been pre-localized and cached. As far as I know this is how I should be accessing strings localized by foundry
I've swapped it to game.i18n.localize('COMBAT.TurnEnd')
which apparently is a correct way to fetch this specific string. I imagine this will work as intended and the problem I was running into was that even though localization was ready, fetching it directly wasn't working because it hadn't been cached by anything yet so that specific value wasn't directly available.
One of the pf1 system devs was testing with v11 and ran into this issue during startup.
Looking into it, it's me accessing
game.i18n.translations.COMBAT.TurnEnd
while the HUD is being built. I'm not sure how he got a token selected during startup, but it seems like that must be firing off before the foundryready
hook which doesn't seem right.