From 6fc9d20d5d3c037619ee6af421eda9518bb796b4 Mon Sep 17 00:00:00 2001 From: Matheus Clemente Date: Wed, 25 Oct 2023 19:55:51 -0300 Subject: [PATCH] Update pf2e.js Fix #330 and https://github.com/foundryvtt/pf2e/issues/10911 --- src/module/providers/pf2e.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/module/providers/pf2e.js b/src/module/providers/pf2e.js index 62d4118..ace658a 100644 --- a/src/module/providers/pf2e.js +++ b/src/module/providers/pf2e.js @@ -214,4 +214,23 @@ export default class pf2eLanguageProvider extends LanguageProvider { } return filtered; } + + getUserLanguages(actor) { + let knownLanguages = new Set(); + let literateLanguages = new Set(); + if (actor.system?.traits?.languages) { + for (let lang of actor.system.traits.languages.value) { + if (lang in CONFIG.PF2E.languages) { + knownLanguages.add(lang); + } + } + if (actor.system.traits.languages.custom) { + for (let lang of actor.system.traits.languages.custom.split(/[,;]/)) { + const key = lang.trim().toLowerCase(); + knownLanguages.add(key); + } + } + } + return [knownLanguages, literateLanguages]; + } }