mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 21:29:13 +00:00
Refactor comments and CSS for improved clarity in Khoj plugin
- Translated comments from French to English for better accessibility and understanding. - Updated CSS comment for loading animation to reflect the change in language. - Enhanced code readability by ensuring consistent language usage across multiple files. - Improved user experience by clarifying the purpose of various functions and settings in the codebase.
This commit is contained in:
@@ -59,18 +59,18 @@ export default class Khoj extends Plugin {
|
|||||||
// Add a settings tab so the user can configure khoj
|
// Add a settings tab so the user can configure khoj
|
||||||
this.addSettingTab(new KhojSettingTab(this.app, this));
|
this.addSettingTab(new KhojSettingTab(this.app, this));
|
||||||
|
|
||||||
// Démarrer le timer de synchronisation
|
// Start the sync timer
|
||||||
this.startSyncTimer();
|
this.startSyncTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Méthode pour démarrer le timer de synchronisation
|
// Method to start the sync timer
|
||||||
private startSyncTimer() {
|
private startSyncTimer() {
|
||||||
// Nettoyer l'ancien timer s'il existe
|
// Clean up the old timer if it exists
|
||||||
if (this.indexingTimer) {
|
if (this.indexingTimer) {
|
||||||
clearInterval(this.indexingTimer);
|
clearInterval(this.indexingTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Démarrer un nouveau timer avec l'intervalle configuré
|
// Start a new timer with the configured interval
|
||||||
this.indexingTimer = setInterval(async () => {
|
this.indexingTimer = setInterval(async () => {
|
||||||
if (this.settings.autoConfigure) {
|
if (this.settings.autoConfigure) {
|
||||||
this.settings.lastSync = await updateContentIndex(
|
this.settings.lastSync = await updateContentIndex(
|
||||||
@@ -79,10 +79,10 @@ export default class Khoj extends Plugin {
|
|||||||
this.settings.lastSync
|
this.settings.lastSync
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, this.settings.syncInterval * 60 * 1000); // Convertir les minutes en millisecondes
|
}, this.settings.syncInterval * 60 * 1000); // Convert minutes to milliseconds
|
||||||
}
|
}
|
||||||
|
|
||||||
// Méthode publique pour redémarrer le timer (appelée depuis les paramètres)
|
// Public method to restart the timer (called from settings)
|
||||||
public restartSyncTimer() {
|
public restartSyncTimer() {
|
||||||
this.startSyncTimer();
|
this.startSyncTimer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export class KhojSearchModal extends SuggestModal<SearchResult> {
|
|||||||
find_similar_notes: boolean;
|
find_similar_notes: boolean;
|
||||||
query: string = "";
|
query: string = "";
|
||||||
app: App;
|
app: App;
|
||||||
currentController: AbortController | null = null; // Pour annuler les requêtes
|
currentController: AbortController | null = null; // To cancel requests
|
||||||
isLoading: boolean = false;
|
isLoading: boolean = false;
|
||||||
loadingEl: HTMLElement;
|
loadingEl: HTMLElement;
|
||||||
|
|
||||||
@@ -37,11 +37,11 @@ export class KhojSearchModal extends SuggestModal<SearchResult> {
|
|||||||
this.loadingEl.style.zIndex = "1000";
|
this.loadingEl.style.zIndex = "1000";
|
||||||
this.loadingEl.style.display = "none";
|
this.loadingEl.style.display = "none";
|
||||||
|
|
||||||
// Ajouter l'élément au modal
|
// Add the element to the modal
|
||||||
this.modalEl.appendChild(this.loadingEl);
|
this.modalEl.appendChild(this.loadingEl);
|
||||||
|
|
||||||
// Customize empty state message
|
// Customize empty state message
|
||||||
// @ts-ignore - Accès à la propriété privée pour personnaliser le message
|
// @ts-ignore - Access to private property to customize the message
|
||||||
this.emptyStateText = "";
|
this.emptyStateText = "";
|
||||||
|
|
||||||
// Register Modal Keybindings to Rerank Results
|
// Register Modal Keybindings to Rerank Results
|
||||||
@@ -99,7 +99,7 @@ export class KhojSearchModal extends SuggestModal<SearchResult> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getSuggestions(query: string): Promise<SearchResult[]> {
|
async getSuggestions(query: string): Promise<SearchResult[]> {
|
||||||
// Ne pas afficher le chargement si la requête est vide
|
// Do not show loading if the query is empty
|
||||||
if (!query.trim()) {
|
if (!query.trim()) {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.updateLoadingState();
|
this.updateLoadingState();
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ export class KhojSettingTab extends PluginSettingTab {
|
|||||||
.onChange(async (value) => {
|
.onChange(async (value) => {
|
||||||
this.plugin.settings.syncInterval = parseInt(value);
|
this.plugin.settings.syncInterval = parseInt(value);
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
// Redémarrer le timer avec le nouvel intervalle
|
// Restart the timer with the new interval
|
||||||
this.plugin.restartSyncTimer();
|
this.plugin.restartSyncTimer();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -311,13 +311,13 @@ class FolderSuggestModal extends SuggestModal<string> {
|
|||||||
const folders = new Set<string>();
|
const folders = new Set<string>();
|
||||||
folders.add(''); // Root folder
|
folders.add(''); // Root folder
|
||||||
|
|
||||||
// Récupérer tous les fichiers et extraire les chemins des dossiers
|
// Get all files and extract folder paths
|
||||||
this.app.vault.getAllLoadedFiles().forEach(file => {
|
this.app.vault.getAllLoadedFiles().forEach(file => {
|
||||||
const folderPath = file.parent?.path;
|
const folderPath = file.parent?.path;
|
||||||
if (folderPath) {
|
if (folderPath) {
|
||||||
folders.add(folderPath);
|
folders.add(folderPath);
|
||||||
|
|
||||||
// Ajouter aussi tous les dossiers parents
|
// Also add all parent folders
|
||||||
let parent = folderPath;
|
let parent = folderPath;
|
||||||
while (parent.includes('/')) {
|
while (parent.includes('/')) {
|
||||||
parent = parent.substring(0, parent.lastIndexOf('/'));
|
parent = parent.substring(0, parent.lastIndexOf('/'));
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ export async function updateContentIndex(vault: Vault, setting: KhojSetting, las
|
|||||||
})
|
})
|
||||||
// Filter files based on specified folders
|
// Filter files based on specified folders
|
||||||
.filter(file => {
|
.filter(file => {
|
||||||
// Si aucun dossier n'est spécifié, synchroniser tous les fichiers
|
// If no folders are specified, sync all files
|
||||||
if (setting.syncFolders.length === 0) return true;
|
if (setting.syncFolders.length === 0) return true;
|
||||||
// Sinon, vérifier si le fichier est dans un des dossiers spécifiés
|
// Otherwise, check if the file is in one of the specified folders
|
||||||
return setting.syncFolders.some(folder =>
|
return setting.syncFolders.some(folder =>
|
||||||
file.path.startsWith(folder + '/') || file.path === folder
|
file.path.startsWith(folder + '/') || file.path === folder
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -813,7 +813,7 @@ img.copy-icon {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Animation de chargement */
|
/* Loading animation */
|
||||||
.khoj-loading {
|
.khoj-loading {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user