Auto-translate trappings
This commit is contained in:
parent
37b88c1507
commit
9688136a7c
@ -69,6 +69,35 @@ Hooks.once('init', () => {
|
|||||||
}
|
}
|
||||||
return talents_list;
|
return talents_list;
|
||||||
},
|
},
|
||||||
|
"career_trappings": (trappings_list) => {
|
||||||
|
var compendium = game.packs.find(p => p.collection === 'wfrp4e.trappings');
|
||||||
|
var i;
|
||||||
|
var len = trappings_list.length;
|
||||||
|
var re = /(.*)\((.*)\)/i;
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
var transl = compendium.i18nName( trappings_list[i] );
|
||||||
|
if ( transl == trappings_list[i] ) {
|
||||||
|
var res = re.exec( trappings_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 );
|
||||||
|
if (translw != transl) {
|
||||||
|
var res2 = re.exec(translw);
|
||||||
|
transl = res2[1] + "(" + subword + ")";
|
||||||
|
} else {
|
||||||
|
s1 = res[1].trim() + " ( )";
|
||||||
|
translw = compendium.i18nName( s1 );
|
||||||
|
var res2 = re.exec(translw);
|
||||||
|
transl = res2[1] + "(" + subword + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trappings_list[i] = transl;
|
||||||
|
}
|
||||||
|
return trappings_list;
|
||||||
|
},
|
||||||
// To avoid duplicateing class for all careers
|
// To avoid duplicateing class for all careers
|
||||||
"career_class": (value) => {
|
"career_class": (value) => {
|
||||||
return game.i18n.localize( value.trim() );
|
return game.i18n.localize( value.trim() );
|
||||||
|
@ -16,7 +16,11 @@
|
|||||||
"careergroup": {
|
"careergroup": {
|
||||||
"path": "data.careergroup.value",
|
"path": "data.careergroup.value",
|
||||||
"converter": "career_careergroup"
|
"converter": "career_careergroup"
|
||||||
}
|
},
|
||||||
|
"trappings": {
|
||||||
|
"path": "data.trappings",
|
||||||
|
"converter": "career_trappings"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"entries": [
|
"entries": [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user