diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f588018..5b9f01a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/_document-sheet-registrar.zip # Create a zip file with all files required by the module to add to the release - - run: zip -r ./_document-sheet-registrar.zip module.json LICENSE scripts/ + - run: zip -r ./_document-sheet-registrar.zip module.json LICENSE scripts/ lang/ # Create a release for this specific version - name: Update Release with Files diff --git a/lang/en.json b/lang/en.json new file mode 100644 index 0000000..1f3e388 --- /dev/null +++ b/lang/en.json @@ -0,0 +1,15 @@ +{ + "_document-sheet-registrar": { + "title": "Lib: Document Sheet Registrar", + "ui": { + "warn": { + "no-sheet-found": "There is not a sheet `{sheet}` registered to display this document. You may need to enable an associated module." + } + }, + "console": { + "log": { + "init": "Document Sheet Registrar: Initialized" + } + } + } +} \ No newline at end of file diff --git a/module.json b/module.json index 48055c9..4c37144 100644 --- a/module.json +++ b/module.json @@ -7,6 +7,13 @@ "manifestPlusVersion": "1.1.0", "minimumCoreVersion": "0.8.8", "compatibleCoreVersion": "0.8.8", + "languages": [ + { + "lang": "en", + "name": "English", + "path": "lang/en.json" + } + ], "authors": [ { "name": "zeel", diff --git a/scripts/document-sheet-registrar.js b/scripts/document-sheet-registrar.js index 0370bb3..f8cde67 100644 --- a/scripts/document-sheet-registrar.js +++ b/scripts/document-sheet-registrar.js @@ -95,6 +95,8 @@ export default class DocumentSheetRegistrar { * @memberof DocumentSheetRegistrar */ static initializeDocumentSheets() { + console.log(game.i18n.localize("_document-sheet-registrar.console.log.init")); + for (let doc of this.documentTypes) { // Skip any collection that already has a sheet registration method if (doc.collection.registerSheet) continue; @@ -297,7 +299,12 @@ export default class DocumentSheetRegistrar { const override = this.getFlag("core", "sheetClass"); if (sheets[override]) return sheets[override].cls; const classes = Object.values(sheets); - if (!classes.length) return null; + if (!classes.length) { + ui.notifications.warn( + game.i18n.format("_document-sheet-registrar.ui.warn.no-sheet-found", { sheet: override }) + ); + return null; + } return (classes.find(s => s.default) ?? classes.pop()).cls; }