Merge branch 'master' into 'master'

Sync

See merge request sasmira/swade-fr!18
This commit is contained in:
Leratier Bretonnien 2022-02-04 23:30:03 +00:00
commit 19c8dbf3f6
3 changed files with 54 additions and 39 deletions

View File

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

View File

@ -1,7 +1,7 @@
{ {
"name": "swade-fr", "name": "swade-fr",
"title": "SWADE Core Rules en Français - *NON-OFFICIEL*", "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", "author": "Team Swade, La Fonderie",
"authors": [ "authors": [
{ {
@ -42,9 +42,9 @@
], ],
"url": "https://gitlab.com/sasmira/swade-fr", "url": "https://gitlab.com/sasmira/swade-fr",
"flags": {}, "flags": {},
"version": "0.18.4.2", "version": "0.19.0.0",
"minimumCoreVersion": "0.8.0", "minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "1.0.0", "compatibleCoreVersion": "9",
"scripts": [], "scripts": [],
"esmodules": [ "esmodules": [
"modules/swade-fr-init.js" "modules/swade-fr-init.js"
@ -83,4 +83,4 @@
"protected": false, "protected": false,
"coreTranslation": false, "coreTranslation": false,
"library": 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', () => { 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', 'Catapults': 'Catapultes', 'Flamethrowers': 'Lance-flammes', 'Rocket Launchers & Torpedoes': 'Lance roquettes et torpilles',
'Vehicular Weapons': 'Armes de véhicules' } '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', () => { Hooks.once('ready', () => {
//if (game.user.isGM) {
//setTimeout( __fix_folder_names, 4000, true, false); FolderTranslate.translateFolders()
//}
}); });