Auto-adapte translation tables

This commit is contained in:
LeRatierBretonnien 2020-07-05 15:24:11 +02:00
parent 46330eed61
commit 7f7dc2bf10
3 changed files with 38 additions and 21 deletions

View File

@ -236,6 +236,22 @@ const __create_translation_tables = async (compmod) => {
} }
} }
/************************************************************************************
* The default static compendium of translation tables must be aut-mapped to the relevant
* compendium content name (ie either wfrp4e or wfrp4e-content up to now).
* */
const __auto_patch_translation_journal_compendium = async (compmod) => {
let compData = game.packs.get( "WH4-fr-translation.tables-des-traductions" );
compData.locked = false;
let translEntries = await compData.getContent();
for (let entryData of translEntries ) {
let mydata = duplicate(entryData.data);
mydata.content = mydata.content.replace(/__TO_REPLACE__/g, compmod );
entryData.update( mydata );
}
compData.locked = true;
}
/************************************************************************************/ /************************************************************************************/
const __check_fix_wrong_modules = ( chatFlag, patchFinished ) => { const __check_fix_wrong_modules = ( chatFlag, patchFinished ) => {
@ -392,7 +408,6 @@ Hooks.once('ready', () => {
game.packs = new Collection( pack_array ); game.packs = new Collection( pack_array );
} }
/* Uncomment this to auto-create the translation tables
let compmod = "wfrp4e"; let compmod = "wfrp4e";
// Check various settings in the installation // Check various settings in the installation
game.modules.forEach((module, name) => { game.modules.forEach((module, name) => {
@ -400,7 +415,9 @@ Hooks.once('ready', () => {
compmod = "wfrp4e-content"; compmod = "wfrp4e-content";
} }
} ); } );
// Auto-create translation journal tables __auto_patch_translation_journal_compendium( compmod )
/* Uncomment this to auto-create the translation tables
Auto-create translation journal tables
__create_translation_tables(compmod); __create_translation_tables(compmod);
*/ */

View File

@ -3,7 +3,7 @@
"name": "WH4-fr-translation", "name": "WH4-fr-translation",
"title": "Traduction du module WH4 en Français.", "title": "Traduction du module WH4 en Français.",
"description": "La traduction du module WH4.", "description": "La traduction du module WH4.",
"version": "1.1.0", "version": "1.1.1",
"minimumCoreVersion" : "0.6.0", "minimumCoreVersion" : "0.6.0",
"compatibleCoreVersion": "1.0.0", "compatibleCoreVersion": "1.0.0",
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",

File diff suppressed because one or more lines are too long