Add missing translated fields

This commit is contained in:
2020-03-31 17:44:46 +02:00
parent b0a121abbc
commit 98239b44ae
9 changed files with 70 additions and 12 deletions

View File

@ -52,11 +52,10 @@ Hooks.once('init', () => {
if (res) {
//console.log("Matched/split:", res[1], res[2]);
var subword = game.i18n.localize(res[2].trim() );
var s1 = res[1].trim() + " ()";
var s1 = res[1].trim(); // No () in talents table
var translw = compendium.i18nName( s1 );
if (translw != transl) {
var res2 = re.exec(translw);
transl = res2[1] + "(" + subword + ")";
transl = translw + "(" + subword + ")";
} else {
s1 = res[1].trim() + " ( )";
translw = compendium.i18nName( s1 );
@ -99,14 +98,29 @@ Hooks.once('init', () => {
return trappings_list;
},
// To avoid duplicateing class for all careers
"career_class": (value) => {
"generic_localization": (value) => {
return game.i18n.localize( value.trim() );
},
"trapping_qualities_flaws": (value) => {
var list = value.split( "," );
var i=0;
var re = /(.*) (\d+)/i;
for (i=0; i<list.length; i++) {
var splitted = re.exec( list[i].trim() );
if ( splitted ) {
//console.log("FOund:", splitted[0], splitted[1], splitted[2] );
list[i] = game.i18n.localize( splitted[1] ) + " " + splitted[2];
} else {
list[i] = game.i18n.localize( list[i].trim() ) ;
}
}
return list.toString();
},
// 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 );
}
}
});
}