You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jason Godesky edited this page Jul 19, 2026
·
1 revision
scopeLocalizer returns a version of game.i18n.localize with a prefix always prepended to it.
Parameters
...prefix: string[]
The strings provided are concatenated with periods between them, so you can write it as one dot-separated string like you might normally, as an array of strings, or any combination.
// These all do the same thing.scopeLocalizer('path.to.section')scopeLocalizer('path','to','section')scopeLocalizer('path.to','section')scopeLocalizer('path','to.section')
Returns
A new method that you can call like game.i18n.localize, where the prefix can be assumed.
Examples
import{scopeLocalizer}from'@revolutionarygamesco/common-foundryvtt'// If your dictionary has a bunch of entries under my-module.exclamations...constt=scopeLocalizer('my-module','exclamations')t('gadzooks')// my-module.exclamations.gadzookst('gumdang')// my-module.exclamations.gumdangt('blast')// my-module.exclamations.blast