This commit is contained in:
sladecraven 2022-02-05 00:23:39 +01:00
parent e50d93c147
commit a2618629a1
3 changed files with 54 additions and 39 deletions

View File

@ -56,6 +56,7 @@
"SWADE.Die": "Dé",
"SWADE.WildDie": "Dé Joker",
"SWADE.Mod": "Modificateur",
"SWADE.Modifier": "Modificateur",
"SWADE.BenniesSpend": "Dépenser un Jeton",
"SWADE.BenniesGive": "Donner un Jeton",
"SWADE.BenniesRefresh": "Réinitialiser les Jetons",
@ -78,6 +79,7 @@
"SWADE.Weapons": "Armes",
"SWADE.MeleeWeapons": "Armes de contact",
"SWADE.RangedWeapons": "Armes à distance",
"SWADE.Range._name": "Portée",
"SWADE.Armors": "Armures",
"SWADE.Shields": "Boucliers",
"SWADE.Biography": "Historique",
@ -100,6 +102,7 @@
"SWADE.HeartAttack": "Arrêt cardiaque",
"SWADE.OnFire": "En feu",
"SWADE.Poisoned": "Empoisonné",
"SWADE.Cover.Shield": "Couvert de bouclier",
"SWADE.CoverShield": "Couvert de bouclier",
"SWADE.Reach": "Allonge",
"SWADE.Torch": "Torche",
@ -116,6 +119,7 @@
"SWADE.Mag": "Coups",
"SWADE.Parry": "Parade",
"SWADE.Cover": "Couvert",
"SWADE.Cover._name": "Couvert",
"SWADE.Notes": "Notes",
"SWADE.ActionsEffects": "Actions et Effets",
"SWADE.Actions": "Actions",

View File

@ -1,7 +1,7 @@
{
"name": "swade-fr",
"title": "SWADE Core Rules en Français - *NON-OFFICIEL*",
"description": "Traduction française du système SWADE <p>*** Join the official Discord server: <a href='https://discord.gg/foundryvtt'> Official Discord</a></p><p>*** Rejoignez la communauté Francophone: <a href='https://discord.gg/pPSDNJk'>Francophone Discord</a></p>",
"description": "Traduction française du système SWADE <p>*** Join the official Discord server: <a href=\"https://discord.gg/foundryvtt\"> Official Discord</a></p><p>*** Rejoignez la communauté Francophone: <a href=\"https://discord.gg/pPSDNJk\">Francophone Discord</a></p>",
"author": "Team Swade, La Fonderie",
"authors": [
{
@ -42,9 +42,9 @@
],
"url": "https://gitlab.com/sasmira/swade-fr",
"flags": {},
"version": "0.18.4.2",
"version": "0.19.0.0",
"minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "1.0.0",
"compatibleCoreVersion": "9",
"scripts": [],
"esmodules": [
"modules/swade-fr-init.js"
@ -83,4 +83,4 @@
"protected": false,
"coreTranslation": false,
"library": false
}
}

View File

@ -1,4 +1,48 @@
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 Militaires 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) {
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) {
pack.configure({locked: true})
}
}
}
}
/************************************************************************************/
Hooks.once('translateCompendiumFolders', () => {
console.log("LOADED !!!!!!")
});
/************************************************************************************/
Hooks.once('init', () => {
@ -91,42 +135,9 @@ const subFolder = { 'Social Edges': 'Atouts sociaux', 'Background Edges': 'Atout
'Catapults': 'Catapultes', 'Flamethrowers': 'Lance-flammes', 'Rocket Launchers & Torpedoes': 'Lance roquettes et torpilles',
'Vehicular Weapons': 'Armes de véhicules' }
/************************************************************************************/
const __translate_sub_folders = async (packName) => {
let pack = game.packs.get(packName)
pack.locked = false;
let folderEntityIds = pack.index.filter(x => x.name === "#[CF_tempEntity]");
for ( let index of folderEntityIds) {
let folderEntity = await pack.getEntity(index._id);
//console.log("Fold1", folderEntity);
let newName = subFolder[folderEntity.data.flags.cf.name];
if ( newName) {
await pack.updateEntity({ _id: index._id, 'flags.cf.name': newName } );
}
}
}
/************************************************************************************/
const __fix_folder_names = async ( ) => {
if ( game.customFolders.compendium.folders ) {
for ( let [key, trans] in transFolder) {
for ( let folder of game.customFolders.compendium.folders.entries) {
folder.name = trans;
folder.save(false);
}
}
}
__translate_sub_folders("swade-core-rules.swade-edges");
__translate_sub_folders("swade-core-rules.swade-hindrances");
__translate_sub_folders("swade-core-rules.swade-equipment");
}
/************************************************************************************/
Hooks.once('ready', () => {
//if (game.user.isGM) {
//setTimeout( __fix_folder_names, 4000, true, false);
//}
FolderTranslate.translateFolders()
});