asacolips-projects / boilerplate

Boilerplate system for FoundryVTT to use as a starting point for your own system's development. Follow along with the [accompanying tutorial](https://foundryvtt.wiki/en/development/guides/SD-tutorial) on the wiki.
Other
22 stars 11 forks source link

Localization isn't working #7

Closed asacolips closed 6 months ago

asacolips commented 2 years ago

In GitLab by @geoidesic on Aug 28, 2022, 20:10

Here's the inspector log:

commons.js:11970 Foundry VTT | Foundry Commons Framework Loaded
foundry.js:77639 _______________________________________________________________
 _____ ___  _   _ _   _ ____  ______   __ __     _______ _____ 
|  ___/ _ \| | | | \ | |  _ \|  _ \ \ / / \ \   / |_   _|_   _|
| |_ | | | | | | |  \| | | | | |_) \ V /   \ \ / /  | |   | |  
|  _|| |_| | |_| | |\  | |_| |  _ < | |     \ V /   | |   | |  
|_|   \___/ \___/|_| \_|____/|_| \_\|_|      \_/    |_|   |_|  
===============================================================
foundry.js:77649 Foundry VTT | Reestablishing existing session 1836af68cc08c6f54abb159b
foundry.js:7515 Foundry VTT | Connected to server socket using session 1836af68cc08c6f54abb159b
foundry.js:7609 Foundry VTT | Initializing Foundry Virtual Tabletop Game
foundry.js:3035 Foundry VTT | Synchronized official game time in 4ms
foundry.js:6755 Foundry VTT | Retrieved and compiled template systems/gammafall/templates/actor/parts/actor-features.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template systems/gammafall/templates/actor/parts/actor-items.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template systems/gammafall/templates/actor/parts/actor-spells.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template systems/gammafall/templates/actor/parts/actor-effects.html
foundry.js:6639 Foundry VTT | Loaded localization file lang/en.json
foundry.js:6639 Foundry VTT | Loaded localization file systems/gammafall/lang/en.json
foundry.js:4943 Foundry VTT | Rendering SceneNavigation
foundry.js:4943 Foundry VTT | Rendering Notifications
foundry.js:4943 Foundry VTT | Rendering Sidebar
foundry.js:4943 Foundry VTT | Rendering PlayerList
foundry.js:4943 Foundry VTT | Rendering Hotbar
foundry.js:4943 Foundry VTT | Rendering Pause
foundry.js:4943 Foundry VTT | Rendering SceneControls
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/hud/navigation.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/sidebar.html
foundry.js:4943 Foundry VTT | Rendering ActorDirectory
foundry.js:4943 Foundry VTT | Rendering CardsDirectory
foundry.js:4943 Foundry VTT | Rendering ChatLog
foundry.js:4943 Foundry VTT | Rendering CombatTracker
foundry.js:4943 Foundry VTT | Rendering CompendiumDirectory
foundry.js:4943 Foundry VTT | Rendering ItemDirectory
foundry.js:4943 Foundry VTT | Rendering JournalDirectory
foundry.js:4943 Foundry VTT | Rendering PlaylistDirectory
foundry.js:4943 Foundry VTT | Rendering SceneDirectory
foundry.js:4943 Foundry VTT | Rendering Settings
foundry.js:4943 Foundry VTT | Rendering RollTableDirectory
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/user/players.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/hud/hotbar.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/hud/pause.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/hud/controls.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/folder-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/folder-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/chat-log.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/combat-tracker.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/compendium-directory.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/folder-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/folder-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/scene-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/folder-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/settings.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/folder-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/playlist-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/folder-partial.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-directory.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-directory.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/chat-message.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-directory.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-directory.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-directory.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/document-directory.html
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/sidebar/playlists-directory.html
foundry.js:61541 Foundry VTT | Fonts loaded and ready.
utils.min.mjs:8 
    PixiJS 6.5.1 - ✰ WebGL 2 ✰      http://www.pixijs.com/    ♥♥♥ 
foundry.js:20677 Foundry VTT | Viewing Scene Foundry Virtual Tabletop
foundry.js:23323 Foundry VTT | Drawing game canvas for scene Foundry Virtual Tabletop
foundry.js:25536 Foundry VTT | Loaded nue/defaultscene/fvtt-background.webp (2%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/acid.svg (4%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/blood.svg (6%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/biohazard.svg (8%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/poison.svg (10%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/sun.svg (12%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/regen.svg (14%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/degen.svg (16%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/upgrade.svg (18%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/downgrade.svg (20%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/invisible.svg (22%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/target.svg (24%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/eye.svg (27%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/angel.svg (29%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/fire-shield.svg (31%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/ice-shield.svg (33%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/mage-shield.svg (35%)
foundry.js:25536 Foundry VTT | Loaded nue/defaultscene/fvtt-logo.webp (37%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/combat.svg (39%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/cowled.svg (41%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/aura.svg (43%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/padlock.svg (45%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/up.svg (47%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/down.svg (49%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/skull.svg (51%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/light.svg (53%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/holy-shield.svg (55%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/light-off.svg (57%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/explosion.svg (59%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/sound.svg (61%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/sound-off.svg (63%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/door-closed-outline.svg (65%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/door-open-outline.svg (67%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/door-secret-outline.svg (69%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/door-locked-outline.svg (71%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/unconscious.svg (73%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/sleep.svg (76%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/daze.svg (78%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/falling.svg (80%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/net.svg (82%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/paralysis.svg (84%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/wing.svg (86%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/blind.svg (88%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/deaf.svg (90%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/silenced.svg (92%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/terror.svg (94%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/fire.svg (96%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/frozen.svg (98%)
foundry.js:25536 Foundry VTT | Loaded icons/svg/lightning.svg (100%)
foundry.js:29907 Foundry VTT | Drawing the WeatherEffects canvas layer
foundry.js:29907 Foundry VTT | Drawing the CanvasBackgroundAlterationEffects canvas layer
foundry.js:29907 Foundry VTT | Drawing the CanvasIlluminationEffects canvas layer
foundry.js:29907 Foundry VTT | Drawing the CanvasColorationEffects canvas layer
foundry.js:29907 Foundry VTT | Drawing the CanvasVisibility canvas layer
foundry.js:29907 Foundry VTT | Drawing the GridLayer canvas layer
foundry.js:29907 Foundry VTT | Drawing the DrawingsLayer canvas layer
foundry.js:29907 Foundry VTT | Drawing the TemplateLayer canvas layer
foundry.js:29907 Foundry VTT | Drawing the TilesLayer canvas layer
foundry.js:29907 Foundry VTT | Drawing the WallsLayer canvas layer
foundry.js:29907 Foundry VTT | Drawing the TokenLayer canvas layer
foundry.js:29907 Foundry VTT | Drawing the SoundsLayer canvas layer
foundry.js:29907 Foundry VTT | Drawing the LightingLayer canvas layer
foundry.js:29907 Foundry VTT | Drawing the NotesLayer canvas layer
foundry.js:29907 Foundry VTT | Drawing the ControlsLayer canvas layer
foundry.js:4943 Foundry VTT | Rendering HeadsUpDisplay
foundry.js:57571 Foundry Virtual Tabletop requires a minimum screen resolution of 1024px by 700px or greater. Your display currently has an effective resolution of 957px by 872px, as a result many features of the software may not work properly.
fetch @ foundry.js:57571
notify @ foundry.js:57498
error @ foundry.js:57534
_displayUsabilityErrors @ foundry.js:7652
initialize @ foundry.js:7636
await in initialize (async)
window.addEventListener.once @ foundry.js:77654
foundry.js:6755 Foundry VTT | Retrieved and compiled template templates/hud/hud.html
foundry.js:4943 Foundry VTT | Rendering GammaFallItemSheet
foundry.js:6755 Foundry VTT | Retrieved and compiled template systems/gammafall/templates/item/item-weapon-sheet.html
foundry.js:711 d {description: undefined, fileName: undefined, lineNumber: undefined, endLineNumber: undefined, message: 'An error occurred while rendering GammaFallItemSheet 27. Missing helper: "localization"', …}description: undefinedendLineNumber: undefinedfileName: undefinedlineNumber: undefinedmessage: "An error occurred while rendering GammaFallItemSheet 27. Missing helper: \"localization\""name: "Error"number: undefinedstack: "Error: An error occurred while rendering GammaFallItemSheet 27. Missing helper: \"localization\"\n    at Object.<anonymous> (http://localhost:30000/scripts/handlebars.min.js:27:9680)\n    at Object.c (http://localhost:30000/scripts/handlebars.min.js:27:19853)\n    at Object.eval [as main] (eval at createFunctionContext (http://localhost:30000/scripts/handlebars.min.js:29:1808), <anonymous>:19:157)\n    at c (http://localhost:30000/scripts/handlebars.min.js:27:15429)\n    at d (http://localhost:30000/scripts/handlebars.min.js:27:15744)\n    at e (http://localhost:30000/scripts/handlebars.min.js:28:22748)\n    at renderTemplate (http://localhost:30000/scripts/foundry.js:6816:10)\n    at async GammaFallItemSheet._renderInner (http://localhost:30000/scripts/foundry.js:5127:16)\n    at async GammaFallItemSheet._renderInner (http://localhost:30000/scripts/foundry.js:5688:18)\n    at async GammaFallItemSheet._render (http://localhost:30000/scripts/foundry.js:4958:19)"[[Prototype]]: Error
    at Object.<anonymous> (http://localhost:30000/scripts/handlebars.min.js:27:5241)
    at b (http://localhost:30000/scripts/handlebars.min.js:27:330)
    at Object.<anonymous> (http://localhost:30000/scripts/handlebars.min.js:27:2069)
    at b (http://localhost:30000/scripts/handlebars.min.js:27:330)
    at Object.<anonymous> (http://localhost:30000/scripts/handlebars.min.js:27:1435)
    at b (http://localhost:30000/scripts/handlebars.min.js:27:330)
    at Object.<anonymous> (http://localhost:30000/scripts/handlebars.min.js:27:792)
    at b (http://localhost:30000/scripts/handlebars.min.js:27:330)
    at http://localhost:30000/scripts/handlebars.min.js:27:417
    at http://localhost:30000/scripts/handlebars.min.js:27:422
onError @ foundry.js:711
(anonymous) @ foundry.js:4913
Promise.catch (async)
render @ foundry.js:4911
render @ foundry.js:6247
_onClickDocumentName @ foundry.js:59223
dispatch @ jquery.min.js:2
v.handle @ jquery.min.js:2

I took the item sheet and replaced:

<a class="item" data-tab="description">Description</a>

With...

<a class="item" data-tab="description">{{localization "GAMMAFALL.AbilityStr"}}</a>

Also I wasn't able to get i18n working inside `helpers/config.mjs – I built a select from a config definition but it pulls through literals: Template

<select name="data.level">
        {{#select data.level}}
        {{#each config.levels as |name type|}}
        <option value="{{type}}">{{name}}</option>
        {{/each}}
        {{/select}}
      </select>

Config

GAMMAFALL.levels = {
  "1": "GAMMAFALL.levels.1.name",
  "2": "GAMMAFALL.levels.2.name",
  "3": "GAMMAFALL.levels.3.name",
  "4": "GAMMAFALL.levels.4.name",
  "5": "GAMMAFALL.levels.5.name",
}
asacolips commented 2 years ago

In GitLab by @Asacolips on Aug 30, 2022, 09:49

@geoidesic the localization helper is localize, not localization. For example:

<a class="item" data-tab="description">{{localize "GAMMAFALL.AbilityStr"}}</a>