First fixes for 4.0/0.8.X
This commit is contained in:
parent
7ba0d03d56
commit
716a27f6ad
@ -113,7 +113,7 @@ const __create_translation_tables = async (compmod) => {
|
||||
* */
|
||||
const __auto_patch_translation_journal_compendium = async (compmod) => {
|
||||
if (game.user.isGM) {
|
||||
let compData = game.packs.get( "WH4-fr-translation.tables-des-traductions" );
|
||||
/*let compData = game.packs.get( "WH4-fr-translation.tables-des-traductions" );
|
||||
compData.locked = false;
|
||||
let translEntries = await compData.getContent();
|
||||
for (let entryData of translEntries ) {
|
||||
@ -121,7 +121,7 @@ const __auto_patch_translation_journal_compendium = async (compmod) => {
|
||||
mydata.content = mydata.content.replace(/wfrp4e-content/g, compmod );
|
||||
entryData.update( mydata );
|
||||
}
|
||||
compData.locked = true;
|
||||
compData.locked = true;*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,13 +213,13 @@ const __check_fix_wrong_modules = ( chatFlag, patchFinished ) => {
|
||||
/************************************************************************************/
|
||||
const __add_actors_translation = ( ) => {
|
||||
const lang = game.settings.get('core', 'language');
|
||||
if ( lang == "fr" ) {
|
||||
if ( lang == "fr" ) {
|
||||
let pack_array = [];
|
||||
game.packs.forEach((pack, name) => {
|
||||
let newpack = pack;
|
||||
if(!pack.translated && pack.entity === 'Actor') {
|
||||
for ( let metadata of game.data.packs ) {
|
||||
if(!game.babele.isTranslated(metadata) && metadata.documentName === 'Actor') {
|
||||
console.log("PACK : ", metadata);
|
||||
let translations = {
|
||||
"label": pack.metadata.name,
|
||||
"label": metadata.name,
|
||||
"mapping": {
|
||||
"name": "name",
|
||||
"description": "details.biography.value",
|
||||
@ -239,24 +239,26 @@ const __add_actors_translation = ( ) => {
|
||||
"entries": [
|
||||
]
|
||||
};
|
||||
newpack = new TranslatedCompendium(pack, translations);
|
||||
console.log("Actor compendium has been replaced !!!!", pack.metadata.name);
|
||||
game.babele.packs.set(collection, new TranslatedCompendium(metadata, translation));
|
||||
//newpack = new TranslatedCompendium(pack, translations);
|
||||
//console.log("Actor compendium has been replaced !!!!", pack.metadata.name);
|
||||
}
|
||||
//console.log("Parsing pack", newpack);
|
||||
if (newpack.metadata.name == "forien-armoury" ) {
|
||||
newpack.mapping.mapping["qualities"] = {
|
||||
console.log("Parsing pack", metadata);
|
||||
if (!game.babele.isTranslated(metadata) && metadata.name == "forien-armoury" ) {
|
||||
/** TODO !!!/
|
||||
metadata.mapping.mapping["qualities"] = {
|
||||
"path": "data.qualities.value",
|
||||
"converter": "trapping_qualities_flaws"
|
||||
};
|
||||
newpack.mapping.mapping["flaws"] = {
|
||||
metadata.mapping.mapping["flaws"] = {
|
||||
"path": "data.flaws.value",
|
||||
"converter": "trapping_qualities_flaws"
|
||||
};
|
||||
console.log("Forien armoury patched !!");
|
||||
|
||||
console.log("Forien armoury patched !!");*/
|
||||
}
|
||||
pack_array.push( [name, newpack ] );
|
||||
} );
|
||||
game.packs = new Collection( pack_array );
|
||||
//pack_array.push( [name, newpack ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,8 +205,8 @@ Hooks.once('init', () => {
|
||||
});
|
||||
|
||||
Babele.get().registerConverters({
|
||||
|
||||
"career_skills": (skills_list) => {
|
||||
var compendium = game.packs.find(p => p.collection === compmod+'.skills');
|
||||
//console.log( "Thru here ...", compendium, skills_list);
|
||||
if ( skills_list ) {
|
||||
var i;
|
||||
@ -214,7 +214,7 @@ Hooks.once('init', () => {
|
||||
var re = /(.*)\((.*)\)/i;
|
||||
for (i = 0; i < len; i++) {
|
||||
skills_list[i] = skills_list[i].trim();
|
||||
var transl = compendium.translate( { name: skills_list[i] } ).name;
|
||||
var transl = game.babele.translate(compmod+'.skills', { name: skills_list[i] }, true ).name;
|
||||
//console.log("List ...", skills_list[i]);
|
||||
if ( transl == skills_list[i] ) {
|
||||
var res = re.exec( skills_list[i] );
|
||||
@ -222,13 +222,13 @@ Hooks.once('init', () => {
|
||||
//console.log("Matched/split:", res[1], res[2]);
|
||||
var subword = game.i18n.localize(res[2].trim() );
|
||||
var s1 = res[1].trim() + " ()";
|
||||
var translw = compendium.translate( { name: s1} ).name;
|
||||
var translw = game.babele.translate(compmod+'.skills', { name: s1}, true ).name;
|
||||
if (translw != s1) {
|
||||
var res2 = re.exec(translw);
|
||||
transl = res2[1] + "(" + subword + ")";
|
||||
} else {
|
||||
s1 = res[1].trim() + " ( )";
|
||||
translw = compendium.translate( { name: s1} ).name;
|
||||
translw = game.babele.translate(compmod+'.skills', { name: s1}, true ).name;
|
||||
var res2 = re.exec(translw);
|
||||
transl = res2[1] + "(" + subword + ")";
|
||||
}
|
||||
@ -239,6 +239,7 @@ Hooks.once('init', () => {
|
||||
}
|
||||
return skills_list;
|
||||
},
|
||||
|
||||
"npc_details": (details) => {
|
||||
//console.log("DETAILS: ", details);
|
||||
let newDetails = duplicate(details);
|
||||
@ -250,6 +251,7 @@ Hooks.once('init', () => {
|
||||
newDetails.class.value = game.i18n.localize(details.class.value);
|
||||
return newDetails;
|
||||
},
|
||||
|
||||
"career_talents": (talents_list) => {
|
||||
var compendium = game.packs.find(p => p.collection === compmod+'.talents');
|
||||
var i;
|
||||
@ -257,19 +259,19 @@ Hooks.once('init', () => {
|
||||
var len = talents_list.length;
|
||||
var re = /(.*)\((.*)\)/i;
|
||||
for (i = 0; i < len; i++) {
|
||||
var transl = compendium.translate( { name: talents_list[i]} ).name;
|
||||
var transl = game.babele.translate(compmod+'.talents', { name: talents_list[i]}, true ).name;
|
||||
if ( transl == talents_list[i] ) {
|
||||
var res = re.exec( talents_list[i]);
|
||||
if (res) {
|
||||
//console.log("Matched/split:", res[1], res[2]);
|
||||
var subword = game.i18n.localize(res[2].trim() );
|
||||
var s1 = res[1].trim(); // No () in talents table
|
||||
var translw = compendium.translate( { name: s1 } ).name;
|
||||
var translw = game.babele.translate(compmod+'.talents', { name: s1 }, true ).name;
|
||||
if (translw != s1) {
|
||||
transl = translw + "(" + subword + ")";
|
||||
} else {
|
||||
s1 = res[1].trim() + " ( )";
|
||||
translw = compendium.translate( { name: s1 } ).name;
|
||||
translw = game.babele.translate(compmod+'.talents', { name: s1 }, true ).name;
|
||||
var res2 = re.exec(translw);
|
||||
transl = res2[1] + "(" + subword + ")";
|
||||
}
|
||||
@ -294,18 +296,6 @@ Hooks.once('init', () => {
|
||||
return chars;
|
||||
},
|
||||
"bestiary_traits": (beast_traits, translations) => {
|
||||
var fulltraits = game.packs.get(compmod+'.traits');
|
||||
var fullskills = game.packs.get(compmod+'.skills');
|
||||
var fulltalents = game.packs.get(compmod+'.talents');
|
||||
var fullcareers = game.packs.get(compmod+'.careers');
|
||||
var fulltrappings = game.packs.get(compmod+'.trappings');
|
||||
var fullspells = game.packs.get(compmod+'.spells');
|
||||
var fullprayers = game.packs.get(compmod+'.prayers');
|
||||
var eisitems = game.packs.get('eis.eisitems');
|
||||
var eisspells = game.packs.get('eis.eisspells');
|
||||
var ugtalents = game.packs.get('wfrp4e-unofficial-grimoire.ug-careerstalentstraits');
|
||||
var ugspells = game.packs.get('wfrp4e-unofficial-grimoire.ug-spells');
|
||||
//console.log("Comp :", compmod, fulltraits);
|
||||
|
||||
for (let trait_en of beast_traits)
|
||||
{
|
||||
@ -326,13 +316,13 @@ Hooks.once('init', () => {
|
||||
name_en = res[1]; // Get the root traits name
|
||||
special = " (" + game.i18n.localize( res[2].trim() ) + ")"; // And the special keyword
|
||||
}
|
||||
var trait_fr = fulltraits.translate( { name: name_en } );
|
||||
//console.log(">>>>> Trait ?", name_en, nbt, trait_fr.name, special);
|
||||
var trait_fr = game.babele.translate( compmod+'.traits', { name: name_en }, true );
|
||||
//console.log(">>>>> Trait ?", name_en, nbt, trait_fr, trait_fr.name, special);
|
||||
trait_en.name = nbt + trait_fr.name + special;
|
||||
if ( trait_fr.data && trait_fr.data.description && trait_fr.data.description.value ) {
|
||||
trait_en.data.description.value = trait_fr.data.description.value;
|
||||
} else if ( eisitems ) { // No description in the FR compendium -> test other compendium if presenr
|
||||
trait_fr = eisitems.translate( { name: name_en } );
|
||||
trait_fr = game.babele.translate( 'eis.eisitems', { name: name_en }, true);
|
||||
trait_en.name = nbt + trait_fr.name + special;
|
||||
if ( trait_fr.data && trait_fr.data.description && trait_fr.data.description.value )
|
||||
trait_en.data.description.value = trait_fr.data.description.value;
|
||||
@ -348,27 +338,29 @@ Hooks.once('init', () => {
|
||||
name_en = res[1].trim(); // Get the root skill name
|
||||
special = " (" + game.i18n.localize( res[2].trim() ) + ")"; // And the special keyword
|
||||
}
|
||||
var trait_fr = fullskills.translate( { name: name_en } );
|
||||
var trait_fr = game.babele.translate( compmod+'.skills', { name: name_en }, true );
|
||||
//console.log(">>>>> Skill ?", name_en, special, trait_fr.name, trait_fr);
|
||||
if (trait_fr.translated) {
|
||||
if (trait_fr.name != name_en) { // Translation OK
|
||||
trait_en.name = trait_fr.name + special;
|
||||
if ( trait_fr.data ) {
|
||||
trait_en.data.description.value = trait_fr.data.description.value;
|
||||
}
|
||||
}
|
||||
|
||||
} else if ( trait_en.type == "prayer") {
|
||||
var trait_fr = fullprayers.translate( { name: name_en } );
|
||||
var trait_fr = game.babele.translate( compmod+'.prayers', { name: name_en }, true);
|
||||
//console.log(">>>>> Prayer ?", name_en, special, trait_fr.name );
|
||||
trait_en.name = trait_fr.name + special;
|
||||
if ( trait_fr.data && trait_fr.data.description && trait_fr.data.description.value )
|
||||
trait_en.data.description.value = trait_fr.data.description.value;
|
||||
|
||||
} else if ( trait_en.type == "spell") {
|
||||
var trait_fr = fullspells.translate( { name: name_en } );
|
||||
if ( (!trait_fr.data || !trait_fr.data.description || !trait_fr.data.description.value) && eisspells) { // If no translation, test eisspells
|
||||
trait_fr = eisspells.translate( { name: name_en } );
|
||||
var trait_fr = game.babele.translate( compmod+'.spells', { name: name_en }, true);
|
||||
if ( trait_fr.name == name_en ) { // If no translation, test eisspells
|
||||
trait_fr = game.babele.translate( 'eis.eisspells', { name: name_en }, true);
|
||||
}
|
||||
if ( (!trait_fr.data || !trait_fr.data.description || !trait_fr.data.description.value) && ugspells) { // If no translation, test eisspells
|
||||
trait_fr = ugspells.translate( { name: name_en } );
|
||||
if ( trait_fr.name == name_en ) { // If no translation, test unofficial grimoire
|
||||
trait_fr = game.babele.translate( 'wfrp4e-unofficial-grimoire.ug-spells', { name: name_en }, true);
|
||||
}
|
||||
//console.log(">>>>> Spell ?", name_en, special, trait_fr.name );
|
||||
trait_en.name = trait_fr.name + special;
|
||||
@ -381,24 +373,24 @@ Hooks.once('init', () => {
|
||||
name_en = res[1].trim(); // Get the root talent name, no parenthesis this time...
|
||||
special = " (" + game.i18n.localize( res[2].trim() ) + ")"; // And the special keyword
|
||||
}
|
||||
var trait_fr = fulltalents.translate( { name: name_en } );
|
||||
var trait_fr = game.babele.translate( compmod+'.talents', { name: name_en }, true );
|
||||
//console.log(">>>>> Talent ?", name_en, special, trait_fr.name);
|
||||
if ( (!trait_fr.data || !trait_fr.data.description || !trait_fr.data.description.value) && ugtalents) { // If no translation, test ugtalents
|
||||
trait_fr = ugtalents.translate( { name: name_en } );
|
||||
if ( trait_fr.name == name_en) { // If no translation, test ugtalents
|
||||
trait_fr = game.babele.translate( 'wfrp4e-unofficial-grimoire.ug-careerstalentstraits', { name: name_en }, true );
|
||||
}
|
||||
if ( trait_fr.translated) {
|
||||
if ( trait_fr.name != name_en) { // Talent translated!
|
||||
trait_en.name = trait_fr.name + special;
|
||||
if ( trait_fr.data ) { // Why ???
|
||||
trait_en.data.description.value = trait_fr.data.description.value;
|
||||
}
|
||||
}
|
||||
} else if ( trait_en.type == "career") {
|
||||
var career_fr = fullcareers.translate( trait_en );
|
||||
var career_fr = game.babele.translate( compmod+'.careers', trait_en, true );
|
||||
console.log(">>>>> Career ?", name_en, career_fr.name );
|
||||
trait_en.name = career_fr.name;
|
||||
trait_en.data = duplicate(career_fr.data);
|
||||
} else if ( trait_en.type == "trapping" || trait_en.type == "weapon" || trait_en.type == "armour" || trait_en.type == "container" || trait_en.type == "money") {
|
||||
var trapping_fr = fulltrappings.translate( trait_en );
|
||||
var trapping_fr = game.babele.translate( compmod+'.trappings', trait_en, true );
|
||||
//console.log(">>>>> Trapping ?", name_en, trapping_fr.name);
|
||||
trait_en.name = trapping_fr.name;
|
||||
if ( trapping_fr.data) {
|
||||
@ -449,7 +441,7 @@ Hooks.once('init', () => {
|
||||
// Per default
|
||||
var compendium = game.packs.find(p => p.collection === compmod+'.careers');
|
||||
if ( compendium )
|
||||
return compendium.translate( { name: value } ).name;
|
||||
return game.babele.translate(compmod+'.careers', { name: value } ).name;
|
||||
else
|
||||
ui.notifications.error("Impossible de trouver la carrière " + value + ". Elle n'est probablement pas traduite.", { permanent: true })
|
||||
},
|
||||
|
@ -2,9 +2,9 @@
|
||||
"name": "WH4-fr-translation",
|
||||
"title": "WFRP4e - Core Module en français.",
|
||||
"description": "Traduction Française pour Warhammer v4.",
|
||||
"version": "1.6.6",
|
||||
"minimumCoreVersion" : "0.7.1",
|
||||
"compatibleCoreVersion": "0.8.7",
|
||||
"version": "4.0.0",
|
||||
"minimumCoreVersion" : "0.8.0",
|
||||
"compatibleCoreVersion": "0.8.8",
|
||||
"author": "LeRatierBretonnien",
|
||||
"dependencies": [
|
||||
{
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user