Refactor comments and questions from French to English

Updated all comments and user prompts in athshield.js from French to English for better code readability and broader usability. No functional changes were made.
This commit is contained in:
Sandro642 2024-10-24 18:18:52 +02:00
parent 96e0ca12f4
commit 297a3a099c

View File

@ -2,78 +2,78 @@ const fs = require('fs')
const readline = require('readline') const readline = require('readline')
const path = require('path') const path = require('path')
// Chemin vers le fichier de configuration // Path to the configuration file
const configPath = path.join(__dirname, 'variables.athshield') const configPath = path.join(__dirname, 'variables.athshield')
// Charger les variables depuis le fichier // Load the variables from the file
function loadConfig() { function loadConfig() {
const rawData = fs.readFileSync(configPath) const rawData = fs.readFileSync(configPath)
return JSON.parse(rawData.toString()) // Convertir Buffer en string return JSON.parse(rawData.toString()) // Convert Buffer to string
} }
// Sauvegarder les variables dans le fichier // Save the variables to the file
function saveConfig(config) { function saveConfig(config) {
const data = JSON.stringify(config, null, 2) const data = JSON.stringify(config, null, 2)
fs.writeFileSync(configPath, data) fs.writeFileSync(configPath, data)
} }
// Création de l'interface readline // Create the readline interface
const rl = readline.createInterface({ const rl = readline.createInterface({
input: process.stdin, input: process.stdin,
output: process.stdout output: process.stdout
}) })
// Fonction pour poser les questions à l'utilisateur // Function to ask questions to the user
function startCLI() { function startCLI() {
const config = loadConfig() const config = loadConfig()
rl.question('Voulez-vous activer Athena\'s Shield ? (oui/non) : ', (answer) => { rl.question('Would you like to activate Athena\'s Shield? (yes/no): ', (answer) => {
if (answer.trim().startsWith('//')) { if (answer.trim().startsWith('//')) {
console.log('Ceci est un commentaire, la ligne est ignorée.') console.log('This is a comment; the line is ignored.')
rl.close() rl.close()
return return
} }
if (answer.toLowerCase() === 'oui') { if (answer.toLowerCase() === 'yes') {
config.athenaShieldActivated = true config.athenaShieldActivated = true
rl.question('Voulez-vous cacher ou bloquer le menu ? (cacher/bloquer) : ', (menuAnswer) => { rl.question('Would you like to hide or block the menu? (hide/block): ', (menuAnswer) => {
if (menuAnswer.trim().startsWith('//')) { if (menuAnswer.trim().startsWith('//')) {
console.log('Ceci est un commentaire, la ligne est ignorée.') console.log('This is a comment; the line is ignored.')
rl.close() rl.close()
return return
} }
if (menuAnswer.toLowerCase() === 'cacher') { if (menuAnswer.toLowerCase() === 'hide') {
config.menuVisibility = 'hidden' // Change to 'hidden' config.menuVisibility = 'hidden' // Change to 'hidden'
console.log(`Athena's Shield activé. Menu caché.`) console.log(`Athena's Shield activated. Menu hidden.`)
} else if (menuAnswer.toLowerCase() === 'bloquer') { } else if (menuAnswer.toLowerCase() === 'block') {
config.menuVisibility = 'blocked' // Change to 'blocked' config.menuVisibility = 'blocked' // Change to 'blocked'
console.log(`Athena's Shield activé. Menu bloqué.`) console.log(`Athena's Shield activated. Menu blocked.`)
} else { } else {
console.log('Option non valide pour le menu.') console.log('Invalid option for the menu.')
rl.close() rl.close()
return return
} }
// Sauvegarder la configuration modifiée // Save the modified configuration
saveConfig(config) saveConfig(config)
rl.close() rl.close()
}) })
} else if (answer.toLowerCase() === 'non') { } else if (answer.toLowerCase() === 'no') {
console.log('Athena\'s Shield non activé. Fermeture du CLI.') console.log('Athena\'s Shield not activated. Closing the CLI.')
config.athenaShieldActivated = false config.athenaShieldActivated = false
config.menuVisibility = 'visible' // Remettre la valeur par défaut config.menuVisibility = 'visible' // Reset to default value
// Sauvegarder la configuration modifiée // Save the modified configuration
saveConfig(config) saveConfig(config)
rl.close() rl.close()
} else { } else {
console.log('Réponse non valide.') console.log('Invalid response.')
rl.close() rl.close()
} }
}) })
} }
// Lancer le CLI // Launch the CLI
startCLI() startCLI()