How rklos/wng-system-translation-pl works
Project Type and Purpose
• This is a Foundry VTT “system translation” module: a plugin that provides Polish translations for the Wrath & Glory RPG system on the Foundry Virtual Tabletop platform.
• It is neither a full-stack web app nor a microservice suite, but a client-side plugin with a build pipeline that produces static assets (JSON, compiled templates, JavaScript) which are loaded by Foundry VTT at runtime.
High-Level Architecture Components
a. Foundry VTT Host
• The sandboxed browser-based application that discovers and loads modules/plugins.
• Provides the runtime environment (UI, chat system, actor sheets, i18n subsystem).
b. Wrath & Glory Core System (External Dependency)
• The official Foundry system package by Moo-Man. Provides data model, default English templates, UI components.
c. Translation Module
• module.json: metadata, dependency declaration on the core system.
• src/lang/*.json: translation key/value pairs for “system” and “custom” terms.
• src/template/**/*.hbs: Handlebars templates overriding or augmenting core UI (chat messages, dialogs, item traits).
• src/scripts/*.js & utils: small runtime scripts (e.g., reorder-skills) that further adapt behavior on game startup.
d. Build Pipeline
• rollup.config.js + .rollup/list-templates.js: orchestrate bundling of JS modules and templates into a single distributable file (usually dist/bundle.js).
• scripts/*.js: Node scripts to merge JSONs, generate template lists, report changes, used by CI workflows.
• GitHub Actions workflows (.github/workflows/*.yml): automate building on tag and generating change reports.
e. Distribution Package
• The final ZIP (or GitHub release) containing module.json, bundle.js, JSON data, templates—ready for installation into Foundry VTT.
Relationships and Data Flows
• At build time:
• JSON sources (src/lang) + Handlebars templates (src/template) + JS scripts → Rollup & custom scripts → bundled assets.
• CI workflows trigger builds and publish artifacts.
• At runtime in Foundry VTT:
• Foundry loads module.json → sees dependency on Wrath & Glory core → loads core system first.
• Module’s bundle.js registers translation strings with Foundry’s i18n API and overrides template partials.
• When rendering Actor sheets or chat messages, Foundry calls the overridden Handlebars templates, pulling in translated labels.
Architectural Patterns & Design Principles
• Plugin/Extension Pattern: the module declares itself to Foundry and plugs into its hook system.
• Build-then-Deploy: static site/app style—separate build pipeline produces immutable artifacts.
• Conventions-over-Configuration: relying on Foundry’s established directory/layout conventions (lang/, template/).
• Template Overriding: using Handlebars partials to override or extend core system views.