Fix babele regression

This commit is contained in:
sladecraven 2022-10-03 12:01:04 +02:00
parent 429715a416
commit 563c63d0a7
2 changed files with 11 additions and 6 deletions

View File

@ -272,6 +272,7 @@ Hooks.once('init', () => {
} }
var trait_fr = game.babele.translate( compmod+'.traits', { name: name_en }, true ); var trait_fr = game.babele.translate( compmod+'.traits', { name: name_en }, true );
//console.log(">>>>> Trait ?", name_en, nbt, trait_fr, trait_fr.name, special); //console.log(">>>>> Trait ?", name_en, nbt, trait_fr, trait_fr.name, special);
trait_fr.name = trait_fr.name || trait_en.name
trait_en.name = nbt + trait_fr.name + special; trait_en.name = nbt + trait_fr.name + special;
if ( trait_fr.system && trait_fr.system.description && trait_fr.system.description.value ) { if ( trait_fr.system && trait_fr.system.description && trait_fr.system.description.value ) {
trait_en.system.description.value = trait_fr.system.description.value; trait_en.system.description.value = trait_fr.system.description.value;
@ -294,6 +295,7 @@ Hooks.once('init', () => {
} }
var trait_fr = game.babele.translate( compmod+'.skills', { name: name_en }, true ); var trait_fr = game.babele.translate( compmod+'.skills', { name: name_en }, true );
//console.log(">>>>> Skill ?", name_en, special, trait_fr.name, trait_fr); //console.log(">>>>> Skill ?", name_en, special, trait_fr.name, trait_fr);
trait_fr.name = trait_fr.name || name_en
if (trait_fr.name != name_en) { // Translation OK if (trait_fr.name != name_en) { // Translation OK
trait_en.name = trait_fr.name + special; trait_en.name = trait_fr.name + special;
if ( trait_fr.system ) { if ( trait_fr.system ) {
@ -304,12 +306,14 @@ Hooks.once('init', () => {
} else if ( trait_en.type == "prayer") { } else if ( trait_en.type == "prayer") {
var trait_fr = game.babele.translate( compmod+'.prayers', { name: name_en }, true); var trait_fr = game.babele.translate( compmod+'.prayers', { name: name_en }, true);
//console.log(">>>>> Prayer ?", name_en, special, trait_fr.name ); //console.log(">>>>> Prayer ?", name_en, special, trait_fr.name );
trait_fr.name = trait_fr.name || trait_en.name
trait_en.name = trait_fr.name + special; trait_en.name = trait_fr.name + special;
if ( trait_fr.system && trait_fr.system.description && trait_fr.system.description.value ) if ( trait_fr.system && trait_fr.system.description && trait_fr.system.description.value )
trait_en.system.description.value = trait_fr.system.description.value; trait_en.system.description.value = trait_fr.system.description.value;
} else if ( trait_en.type == "spell") { } else if ( trait_en.type == "spell") {
var trait_fr = game.babele.translate( compmod+'.spells', { name: name_en }, true); var trait_fr = game.babele.translate( compmod+'.spells', { name: name_en }, true)
trait_fr.name = trait_fr.name || name_en
if ( trait_fr.name == name_en ) { // If no translation, test eisspells if ( trait_fr.name == name_en ) { // If no translation, test eisspells
trait_fr = game.babele.translate( 'wfrp4e-eis.eisspells', { name: name_en }, true); trait_fr = game.babele.translate( 'wfrp4e-eis.eisspells', { name: name_en }, true);
} }
@ -327,13 +331,14 @@ Hooks.once('init', () => {
name_en = res[1].trim(); // Get the root talent name, no parenthesis this time... 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 special = " (" + game.i18n.localize( res[2].trim() ) + ")"; // And the special keyword
} }
var trait_fr = game.babele.translate( compmod+'.talents', { name: name_en }, true ); var trait_fr = game.babele.translate( compmod+'.talents', { name: name_en }, true )
trait_fr.name = trait_fr.name || name_en
//console.log(">>>>> Talent ?", trait_fr, name_en, special, trait_fr.name); //console.log(">>>>> Talent ?", trait_fr, name_en, special, trait_fr.name);
if ( trait_fr.name != "Sprinter" && trait_fr.name == name_en) { // If no translation, test ugtalents if ( trait_fr.name != "Sprinter" && trait_fr.name == name_en) { // If no translation, test ugtalents
trait_fr = game.babele.translate( 'wfrp4e-unofficial-grimoire.ug-careerstalentstraits', { name: name_en }, true ); trait_fr = game.babele.translate( 'wfrp4e-unofficial-grimoire.ug-careerstalentstraits', { name: name_en }, true );
} }
if ( trait_fr.name == "Sprinter" || trait_fr.name != name_en) { // Talent translated! if ( trait_fr.name == "Sprinter" || trait_fr.name != name_en) { // Talent translated!
trait_en.name = trait_fr.name.trim() + special; trait_en.name = trait_fr.name.trim() + special
if ( trait_fr.system ) { // Why ??? if ( trait_fr.system ) { // Why ???
trait_en.system.description.value = trait_fr.system.description.value; trait_en.system.description.value = trait_fr.system.description.value;
} }
@ -341,7 +346,7 @@ Hooks.once('init', () => {
} else if ( trait_en.type == "career") { } else if ( trait_en.type == "career") {
var career_fr = game.babele.translate( compmod+'.careers', trait_en, true ); var career_fr = game.babele.translate( compmod+'.careers', trait_en, true );
console.log(">>>>> Career ?", name_en, career_fr.name ); console.log(">>>>> Career ?", name_en, career_fr.name );
trait_en.name = career_fr.name; trait_en.name = career_fr.name || trait_en.name
trait_en.system = duplicate(career_fr.system); trait_en.system = duplicate(career_fr.system);
} else if ( trait_en.type == "trapping" || trait_en.type == "weapon" || trait_en.type == "armour" || trait_en.type == "container" || trait_en.type == "money") { } else if ( trait_en.type == "trapping" || trait_en.type == "weapon" || trait_en.type == "armour" || trait_en.type == "container" || trait_en.type == "money") {

View File

@ -8,7 +8,7 @@
} }
], ],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr", "url": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr",
"version": "6.2.7", "version": "6.2.8",
"esmodules": [ "esmodules": [
"babele-register.js", "babele-register.js",
"addon-register.js", "addon-register.js",
@ -136,7 +136,7 @@
} }
], ],
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/raw/v10/module.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/raw/v10/module.json",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-6.2.7.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-6.2.8.zip",
"id": "wh4-fr-translation", "id": "wh4-fr-translation",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",