swade-fr-content-neoflip/module/modules/swade-fr-init.js
2022-02-06 17:48:39 +01:00

144 lines
6.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const __compFolderTranslation = [
{
compendium: 'swade-core-rules.swade-vehicles',
words: [
{source: 'Vehicles', translation: 'Véhicules' },
{source: 'Aircraft', translation: 'Avions' },
{source: 'Civilian', translation: 'Civils' },
{source: 'Modern Military Aircraft', translation: 'Avions Militaires Modernes' },
{source: 'World War II Military Aircraft', translation: 'Avions Seconde Guerre Mondiale' },
]
}
]
class FolderTranslate {
static async translateFolders() {
for (let tData of __compFolderTranslation) {
let pack = game.packs.get(tData.compendium);
let wasLocked = false;
if (pack.locked) {
await pack.configure({locked: false})
wasLocked = true;
}
let folders = await game.CF.FICFolderAPI.loadFolders(tData.compendium);
for (let trans of tData.words) {
let folderToChange = folders.contents.find(f => f.name === trans.source );
if (folderToChange ) {
await game.CF.FICFolderAPI.renameFolder(folderToChange, trans.translation);
}
}
if ( wasLocked) {
await pack.configure({locked: true})
}
}
}
}
/************************************************************************************/
Hooks.once('translateCompendiumFolders', () => {
console.log("LOADED !!!!!!")
});
/************************************************************************************/
Hooks.once('init', () => {
if(typeof Babele !== 'undefined') {
console.log("BABELE LOADED !!!");
Babele.get().register({
module: 'swade-fr',
lang: 'fr',
dir: 'compendiums'
});
Babele.get().registerConverters({
"gear_skill": (skill) => {
if (skill) {
if (skill == 'Fighting') return 'Combat';
if (skill == 'Shooting') return 'Tir';
console.log("UNKOWN SKILL", skill);
}
return skill;
},
"gear_range": (range) => {
if (range) {
if (range== 'Cone Template') return 'Gabarit de cone';
}
return range;
},
"gear_ammo": (ammo) => {
if (ammo) {
if (ammo== 'Arrows/Bolts') return 'Flèches/Carreaux';
if (ammo== 'Canister Shot (Cannon)') return 'Cartouches (Canon)';
if (ammo== 'Shrapnel Shot (Cannon)') return 'Shrapnel (Canon)';
if (ammo== 'Solid Shot (Cannon)') return 'Solide (Canon)';
if (ammo== 'Bullets, Medium') return 'Balles, Moyenne';
if (ammo== 'Shotgun Shells') return 'Cartouche de Shotgun';
if (ammo== 'Laser Battery, Pistol') return 'Batterie pour laser, Pistolet';
if (ammo== 'Laser Battery, Rifle / SMG') return 'Batterie pour laser, Fusil';
}
return ammo;
},
"powers_duration": (duration) => {
if ( duration == 'One hour') return '1 heure';
if ( duration == 'Instant (slot); 5 (speed)') return 'Instantanée (apathie), 5 (vitesse)';
if ( duration == '(boost); Instant (lower)') return '5 (augmentation), Instantanée (diminution)';
if ( duration == 'Instant') return 'Instantannée';
if ( duration == 'Until the end of the victim\'s next turn') return 'Jusquà la fin du prochain tour de la victime';
if ( duration == 'A brief conversation of about five minutes') return 'Une brève conversation d\'environ 5 minutes';
if ( duration == '5 (detect), one hour (conceal)') return '5 (détection), 1 heure (dissimulation)';
if ( duration == 'Instant (Sound); 5 (Silence)') return 'Instantanée (son), 5 (silence)';
return duration;
},
"powers_range": (range) => {
if ( range == 'Smarts x5 (Sound); Smarts (Silence)')
return 'Intellect ×5 (son), Intellect (silence)';
if ( range == "Cone Template")
return "Gabarit de cône"
if ( range == "Touch")
return "Toucher"
if ( range == "Sm")
return "Intellect"
if ( range == "Sm x 2" || range == "Sm x2")
return "Intellect x2"
if ( range == "Self")
return "Personnel"
return range;
},
"powers_rank": (rank) => {
if ( rank == 'Novice') return 'Novice';
if ( rank == 'Seasoned') return 'Aguerri';
if ( rank == 'Veteran') return 'Vétéran';
if ( rank == 'Heroic') return 'Héroïque';
return rank;
}
} );
}
});
/************************************************************************************/
const transFolder = { "Actor": "Acteur", "Edges": "Atouts"}
const subFolder = { 'Social Edges': 'Atouts sociaux', 'Background Edges': 'Atouts de Background', 'Combat Edges': 'Atouts de combat',
'Leadership Edges': 'Atouts de commandement', 'Legendary Edges': 'Atouts légendaires', 'Power Edges': 'Atouts de pouvoir',
'Professional Edges': 'Atouts professionnels', 'Weird Edges': 'Atouts étranges', 'Edges': 'Atouts', 'Hindrances': 'Handicaps', 'Skills': 'Compétences',
'Equipment': 'Equipement', 'Ammo': 'Munitions', 'Armor': 'Armure', 'Common Gear': 'Matériel commun', 'Modern Firearms': 'Armes à feu modernes',
'Personal Weapons': 'Armes', 'Special Weapons': 'Armes spéciales', 'Bullet': 'Balles', 'Cannon': 'Canon', 'Laser Battery': 'Batterie Laser',
'Adventuring Gear': 'Matériel d\'aventure', 'Animals and Tack': 'Animaux', 'Clothing': 'Vêtements', 'Computers & Electronics':'Ordinateurs et Electroniques',
'Firearms Accessories': 'Accessoires armes à feu', 'Food': 'Nourriture', 'Personal Defense': 'Auto-défense', 'Futuristic': 'Futuriste',
'Medieval & Ancient': 'Médiévale et Antiquité', 'Modern': 'Moderne', 'Shields': 'Boucliers', 'Laser (Futuristic)': 'Laser (Fururiste)',
'Machine Guns': 'Mitraillettes', 'Pistols': 'Pistolets', 'Rifles': 'Fusils', 'Submachine Guns': 'Semi-automatiques', 'Cannons': 'Canons',
'Catapults': 'Catapultes', 'Flamethrowers': 'Lance-flammes', 'Rocket Launchers & Torpedoes': 'Lance roquettes et torpilles',
'Vehicular Weapons': 'Armes de véhicules' }
/************************************************************************************/
Hooks.once('ready', () => {
//FolderTranslate.translateFolders()
});