Fix babele regression
This commit is contained in:
parent
563c63d0a7
commit
822bc58f9f
@ -148,7 +148,7 @@ Hooks.once('init', () => {
|
|||||||
module: 'wh4-fr-translation',
|
module: 'wh4-fr-translation',
|
||||||
lang: 'fr',
|
lang: 'fr',
|
||||||
dir: 'compendium'
|
dir: 'compendium'
|
||||||
});
|
})
|
||||||
|
|
||||||
Babele.get().registerConverters({
|
Babele.get().registerConverters({
|
||||||
|
|
||||||
@ -161,6 +161,7 @@ Hooks.once('init', () => {
|
|||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
skills_list[i] = skills_list[i].trim();
|
skills_list[i] = skills_list[i].trim();
|
||||||
var transl = game.babele.translate(compmod+'.skills', { name: skills_list[i] }, true ).name;
|
var transl = game.babele.translate(compmod+'.skills', { name: skills_list[i] }, true ).name;
|
||||||
|
if (!transl) transl = skills_list[i]
|
||||||
//console.log("List ...", skills_list[i]);
|
//console.log("List ...", skills_list[i]);
|
||||||
if ( transl == skills_list[i] ) {
|
if ( transl == skills_list[i] ) {
|
||||||
var res = re.exec( skills_list[i] );
|
var res = re.exec( skills_list[i] );
|
||||||
@ -206,6 +207,7 @@ Hooks.once('init', () => {
|
|||||||
var re = /(.*)\((.*)\)/i;
|
var re = /(.*)\((.*)\)/i;
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
var transl = game.babele.translate(compmod+'.talents', { name: talents_list[i]}, true ).name;
|
var transl = game.babele.translate(compmod+'.talents', { name: talents_list[i]}, true ).name;
|
||||||
|
if (!transl) transl = talents_list[i]
|
||||||
if ( transl == talents_list[i] ) {
|
if ( transl == talents_list[i] ) {
|
||||||
var res = re.exec( talents_list[i]);
|
var res = re.exec( talents_list[i]);
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -251,7 +253,7 @@ Hooks.once('init', () => {
|
|||||||
var special = "";
|
var special = "";
|
||||||
var nbt = "";
|
var nbt = "";
|
||||||
var name_en = trait_en.name.trim(); // strip \r in some traits name
|
var name_en = trait_en.name.trim(); // strip \r in some traits name
|
||||||
if (trait_en.name.length == 0) {
|
if (!trait_en.name || trait_en.name.length == 0) {
|
||||||
console.log("Wrong item name found!!!!")
|
console.log("Wrong item name found!!!!")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -306,20 +308,20 @@ 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_fr.name = trait_fr.name || name_en
|
||||||
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);
|
||||||
}
|
}
|
||||||
if ( trait_fr.name == name_en ) { // If no translation, test unofficial grimoire
|
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);
|
trait_fr = game.babele.translate( 'wfrp4e-unofficial-grimoire.ug-spells', { name: name_en }, true);
|
||||||
}
|
}
|
||||||
|
trait_fr.name = trait_fr.name || name_en
|
||||||
//console.log(">>>>> Spell ?", name_en, special, trait_fr.name );
|
//console.log(">>>>> Spell ?", name_en, special, trait_fr.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 )
|
||||||
@ -345,14 +347,14 @@ 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 );
|
career_fr.name = career_fr.name || trait_en.name
|
||||||
trait_en.name = career_fr.name || trait_en.name
|
console.log(">>>>> Career ?", career_fr.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") {
|
||||||
var trapping_fr = game.babele.translate( compmod+'.trappings', trait_en, true );
|
var trapping_fr = game.babele.translate( compmod+'.trappings', trait_en, true );
|
||||||
//console.log(">>>>> Trapping ?", name_en, trapping_fr.name);
|
//console.log(">>>>> Trapping ?", name_en, trapping_fr.name);
|
||||||
trait_en.name = trapping_fr.name || trait_en.name
|
trapping_fr.name = trapping_fr.name || trait_en.name
|
||||||
if ( trapping_fr.system) {
|
if ( trapping_fr.system) {
|
||||||
trait_en.system.description = trapping_fr.system.description;
|
trait_en.system.description = trapping_fr.system.description;
|
||||||
}
|
}
|
||||||
@ -363,8 +365,12 @@ Hooks.once('init', () => {
|
|||||||
},
|
},
|
||||||
// To avoid duplicateing class for all careers
|
// To avoid duplicateing class for all careers
|
||||||
"generic_localization": (value) => {
|
"generic_localization": (value) => {
|
||||||
if ( value )
|
let ret = value
|
||||||
return game.i18n.localize( value.trim() );
|
if ( value ) {
|
||||||
|
ret = game.i18n.localize( value.trim() );
|
||||||
|
if (!ret) ret = value
|
||||||
|
}
|
||||||
|
return ret
|
||||||
},
|
},
|
||||||
"trapping_qualities_flaws": (value) => {
|
"trapping_qualities_flaws": (value) => {
|
||||||
if ( value ) {
|
if ( value ) {
|
||||||
@ -384,7 +390,9 @@ Hooks.once('init', () => {
|
|||||||
newQF[i].name = "TrapBlade"; // Auto-patch, without space!
|
newQF[i].name = "TrapBlade"; // Auto-patch, without space!
|
||||||
//console.log("PATCHED", trim);
|
//console.log("PATCHED", trim);
|
||||||
}
|
}
|
||||||
newQF[i].name = game.i18n.localize( newQF[i].name ) ;
|
let oldName = newQF[i].name
|
||||||
|
newQF[i].name = game.i18n.localize( oldName )
|
||||||
|
if (!newQF[i].name) newQF[i].name = oldName
|
||||||
}
|
}
|
||||||
return newQF;
|
return newQF;
|
||||||
}
|
}
|
||||||
@ -400,10 +408,13 @@ Hooks.once('init', () => {
|
|||||||
}
|
}
|
||||||
// Per default
|
// Per default
|
||||||
var compendium = game.packs.find(p => p.collection === compmod+'.careers');
|
var compendium = game.packs.find(p => p.collection === compmod+'.careers');
|
||||||
if ( compendium )
|
if ( compendium ) {
|
||||||
return game.babele.translate(compmod+'.careers', { name: value } ).name;
|
let newName = game.babele.translate(compmod+'.careers', { name: value } ).name
|
||||||
else
|
if (!newName) newName = value
|
||||||
|
return newName
|
||||||
|
} else {
|
||||||
ui.notifications.error("Impossible de trouver la carrière " + value + ". Elle n'est probablement pas traduite.", { permanent: true })
|
ui.notifications.error("Impossible de trouver la carrière " + value + ". Elle n'est probablement pas traduite.", { permanent: true })
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"mutations_modifier": (value) => { // This is really UGLYYYY i know, but i started like this and discovered afterward that many strings were not easy to automate... Sorry :)
|
"mutations_modifier": (value) => { // This is really UGLYYYY i know, but i started like this and discovered afterward that many strings were not easy to automate... Sorry :)
|
||||||
//console.log("Parsing mutation :", value);
|
//console.log("Parsing mutation :", value);
|
||||||
@ -434,7 +445,7 @@ Hooks.once('init', () => {
|
|||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
"talent_name": (name, translation) => {
|
"talent_name": (name, translation) => {
|
||||||
console.log("NAME !!!", name, translation);
|
console.log("NAME !!!", name, translation)
|
||||||
},
|
},
|
||||||
"effects": (effects, translations) => {
|
"effects": (effects, translations) => {
|
||||||
if ( !effects) return;
|
if ( !effects) return;
|
||||||
|
@ -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.8",
|
"version": "6.2.9",
|
||||||
"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.8.zip",
|
"download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-6.2.9.zip",
|
||||||
"id": "wh4-fr-translation",
|
"id": "wh4-fr-translation",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "10",
|
"minimum": "10",
|
||||||
|
Loading…
Reference in New Issue
Block a user