Sync to v1.2 WH4

This commit is contained in:
LeRatierBretonnien 2020-04-14 17:16:25 +02:00
parent 5c70f1f69a
commit 406ed08925
2 changed files with 10 additions and 9 deletions

View File

@ -175,26 +175,27 @@ Hooks.once('init', () => {
Babele.get().registerConverters({
"career_skills": (skills_list) => {
//console.log( "Thru here ..." );
var compendium = game.packs.find(p => p.collection === 'wfrp4e.skills');
//console.log( "Thru here ...", compendium, skills_list);
var i;
var len = skills_list.length;
var re = /(.*)\((.*)\)/i;
for (i = 0; i < len; i++) {
var transl = compendium.i18nName( skills_list[i] );
var transl = compendium.i18nName( { name: skills_list[i] } );
//console.log("List ...", skills_list[i]);
if ( transl == skills_list[i] ) {
var res = re.exec( skills_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() + " ()";
var translw = compendium.i18nName( s1 );
var translw = compendium.i18nName( { name: s1} );
if (translw != s1) {
var res2 = re.exec(translw);
transl = res2[1] + "(" + subword + ")";
} else {
s1 = res[1].trim() + " ( )";
translw = compendium.i18nName( s1 );
translw = compendium.i18nName( { name: s1} );
var res2 = re.exec(translw);
transl = res2[1] + "(" + subword + ")";
}
@ -210,19 +211,19 @@ Hooks.once('init', () => {
var len = talents_list.length;
var re = /(.*)\((.*)\)/i;
for (i = 0; i < len; i++) {
var transl = compendium.i18nName( talents_list[i] );
var transl = compendium.i18nName( { name: talents_list[i]} );
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.i18nName( s1 );
var translw = compendium.i18nName( { name: s1 } );
if (translw != s1) {
transl = translw + "(" + subword + ")";
} else {
s1 = res[1].trim() + " ( )";
translw = compendium.i18nName( s1 );
translw = compendium.i18nName( { name: s1 } );
var res2 = re.exec(translw);
transl = res2[1] + "(" + subword + ")";
}
@ -257,7 +258,7 @@ Hooks.once('init', () => {
// Search back in careers the translated name of the groupe (as it is the name of the level career itself)
"career_careergroup": (value) => {
var compendium = game.packs.find(p => p.collection === 'wfrp4e.careers');
return compendium.i18nName( value );
return compendium.i18nName( { name: value } );
},
// Auto-translate duration
"spells_duration_range_target_damage": (value) => {

View File

@ -2,7 +2,7 @@
"name": "WH4-fr-translation",
"title": "Traduction du module WH4 en Français.",
"description": "La traduction du module WH4.",
"version": "0.49",
"version": "0.50",
"minimumCoreVersion" : "0.5.1",
"compatibleCoreVersion": "0.5.4",
"author": "LeRatierBretonnien",