Auto-adapte translation tables
This commit is contained in:
		| @@ -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 ) => { | ||||
|    | ||||
| @@ -392,7 +408,6 @@ Hooks.once('ready', () => { | ||||
|     game.packs = new Collection( pack_array ); | ||||
|   } | ||||
|    | ||||
|   /* Uncomment this to auto-create the translation tables  | ||||
|   let compmod = "wfrp4e"; | ||||
|   // Check various settings in the installation   | ||||
|   game.modules.forEach((module, name) => { | ||||
| @@ -400,7 +415,9 @@ Hooks.once('ready', () => { | ||||
|       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); | ||||
|   */ | ||||
|    | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|   "name": "WH4-fr-translation", | ||||
|   "title": "Traduction du module WH4 en Français.", | ||||
|   "description": "La traduction du module WH4.", | ||||
|   "version": "1.1.0", | ||||
|   "version": "1.1.1", | ||||
|   "minimumCoreVersion" : "0.6.0", | ||||
|   "compatibleCoreVersion": "1.0.0", | ||||
|   "author": "LeRatierBretonnien", | ||||
|   | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user