Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

refactor(frontend:i18n): remove unused translations, update locale handling, and add unused_translations.js to detect unused keys

johaven7a0af47bc89f
diff --git a/backend/src/applications/users/constants/user.ts b/backend/src/applications/users/constants/user.ts
index 4d105f53..d1d0157a 100644
--- a/backend/src/applications/users/constants/user.ts
+++ b/backend/src/applications/users/constants/user.ts
@@ -53,18 +53,11 @@ export enum USER_ONLINE_STATUS {
OFFLINE
}
-export const USER_ONLINE_STATUS_LIST = ['available', 'busy', 'absent', 'offline']
-
export enum USER_NOTIFICATION {
APPLICATION,
APPLICATION_EMAIL
}
-export const USER_NOTIFICATION_TEXT = {
- APPLICATION: 'application',
- APPLICATION_EMAIL: 'application & email'
-} as const
-
export const USER_SECRET = {
TWO_FA_SECRET: 'twoFaSecret',
RECOVERY_CODES: 'recoveryCodes',
diff --git a/frontend/src/app/applications/admin/components/dialogs/admin-user-dialog.component.ts b/frontend/src/app/applications/admin/components/dialogs/admin-user-dialog.component.ts
index cccae95e..a3a434c4 100644
--- a/frontend/src/app/applications/admin/components/dialogs/admin-user-dialog.component.ts
+++ b/frontend/src/app/applications/admin/components/dialogs/admin-user-dialog.component.ts
@@ -20,13 +20,7 @@ import {
faUserPlus,
faUsers
} from '@fortawesome/free-solid-svg-icons'
-import {
- USER_LOGIN_VALIDATION,
- USER_NOTIFICATION_TEXT,
- USER_PERMISSION,
- USER_PERMS_SEP,
- USER_ROLE
-} from '@sync-in-server/backend/src/applications/users/constants/user'
+import { USER_LOGIN_VALIDATION, USER_PERMISSION, USER_PERMS_SEP, USER_ROLE } from '@sync-in-server/backend/src/applications/users/constants/user'
import type { CreateUserDto, UpdateUserDto } from '@sync-in-server/backend/src/applications/users/dto/create-or-update-user.dto'
import type { SearchMembersDto } from '@sync-in-server/backend/src/applications/users/dto/search-members.dto'
import type { TwoFaVerifyResult } from '@sync-in-server/backend/src/authentication/interfaces/two-fa-setup.interface'
@@ -46,7 +40,7 @@ import { TimeDateFormatPipe } from '../../../../common/pipes/time-date-format.pi
import { LayoutService } from '../../../../layout/layout.service'
import { UserSearchComponent } from '../../../users/components/utils/user-search.component'
import { MemberModel } from '../../../users/models/member.model'
-import { USER_ICON, USER_LANGUAGE_AUTO, USER_PASSWORD_CHANGE_TEXT } from '../../../users/user.constants'
+import { USER_ICON, USER_LANGUAGE_AUTO, USER_NOTIFICATION_TEXT, USER_PASSWORD_CHANGE_TEXT } from '../../../users/user.constants'
import { UserService } from '../../../users/user.service'
import { AdminService } from '../../admin.service'
import { AdminUserModel } from '../../models/admin-user.model'
diff --git a/frontend/src/app/applications/files/services/files-tasks.service.ts b/frontend/src/app/applications/files/services/files-tasks.service.ts
index a0a49048..d83d134a 100644
--- a/frontend/src/app/applications/files/services/files-tasks.service.ts
+++ b/frontend/src/app/applications/files/services/files-tasks.service.ts
@@ -25,14 +25,37 @@ export class FilesTasksService {
private readonly http = inject(HttpClient)
private readonly layout = inject(LayoutService)
private readonly store = inject(StoreService)
- private readonly onDone = {
- [FILE_OPERATION.DELETE]: { title: 'Deletion', fileEvent: { delete: true } as Partial<FileEvent> },
- [FILE_OPERATION.MOVE]: { title: 'Move', fileEvent: { delete: true, reloadFocusOnDst: true } as Partial<FileEvent> },
- [FILE_OPERATION.COPY]: { title: 'Copy', fileEvent: { reload: true, focus: true } as Partial<FileEvent> },
- [FILE_OPERATION.DOWNLOAD]: { title: 'Download', fileEvent: { reload: true, focus: true } as Partial<FileEvent> },
- [FILE_OPERATION.UPLOAD]: { title: 'Upload', fileEvent: { reload: true, focus: true } as Partial<FileEvent> },
- [FILE_OPERATION.COMPRESS]: { title: 'Compression', fileEvent: { reload: true, focus: true } as Partial<FileEvent> },
- [FILE_OPERATION.DECOMPRESS]: { title: 'Decompression', fileEvent: { reload: true, focus: true } as Partial<FileEvent> }
+ private readonly onDone: Partial<
+ Record<
+ FILE_OPERATION,
+ { fileEvent: Partial<Pick<FileEvent, 'reload' | 'focus' | 'reloadFocusOnDst' | 'delete'>>; msg: { failed: string; success: string } }
+ >
+ > = {
+ [FILE_OPERATION.DELETE]: {
+ fileEvent: { delete: true },
+ msg: { success: 'Deletion done', failed: 'Deletion failed' }
+ },
+ [FILE_OPERATION.MOVE]: {
+ fileEvent: { delete: true, reloadFocusOnDst: true },
+ msg: { success: 'Move done', failed: 'Move failed' }
+ },
+ [FILE_OPERATION.COPY]: { msg: { success: 'Copy done', failed: 'Copy failed' }, fileEvent: { reload: true, focus: true } as Partial<FileEvent> },
+ [FILE_OPERATION.DOWNLOAD]: {
+ fileEvent: { reload: true, focus: true },
+ msg: { success: 'Download done', failed: 'Download failed' }
+ },
+ [FILE_OPERATION.UPLOAD]: {
+ fileEvent: { reload: true, focus: true },
+ msg: { success: 'Upload done', failed: 'Upload failed' }
+ },
+ [FILE_OPERATION.COMPRESS]: {
+ fileEvent: { reload: true, focus: true },
+ msg: { success: 'Compression done', failed: 'Compression failed' }
+ },
+ [FILE_OPERATION.DECOMPRESS]: {
+ fileEvent: { reload: true, focus: true },
+ msg: { success: 'Decompression done', failed: 'Decompression failed' }
+ }
}
private watcher: Subscription = null
private watch = timer(1000, 1000).pipe(tap(() => this.doWatch()))
@@ -148,7 +171,7 @@ export class FilesTasksService {
private taskDone(task: FileTask) {
if (task.type in this.onDone) {
if (this.onDone[task.type].fileEvent) {
- const fileEvent: FileEvent = { ...this.onDone[task.type].fileEvent, status: task.status }
+ const fileEvent: Partial<FileEvent> = { ...this.onDone[task.type].fileEvent, status: task.status }
if (task.type === FILE_OPERATION.COPY || task.type === FILE_OPERATION.MOVE) {
fileEvent.filePath = task.props.src.path
fileEvent.fileName = task.props.src.name
@@ -160,16 +183,16 @@ export class FilesTasksService {
fileEvent.archiveId = task.props.compressInDirectory === false ? task.id : null
}
}
- this.store.filesOnEvent.next(fileEvent)
+ this.store.filesOnEvent.next(fileEvent as FileEvent)
}
if (task.status === FileTaskStatus.SUCCESS) {
if (task.type === FILE_OPERATION.DELETE) {
this.removeDeletedChildTasks(task)
} else {
- this.layout.sendNotification('info', `${this.onDone[task.type].title} done`, task.name)
+ this.layout.sendNotification('info', this.onDone[task.type].msg.success, task.name)
}
} else {
- this.layout.sendNotification('error', `${this.onDone[task.type].title} failed`, task.name, {
+ this.layout.sendNotification('error', this.onDone[task.type].msg.failed, task.name, {
error: { message: task.result }
} as HttpErrorResponse)
}
diff --git a/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts b/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts
index b2b0cd93..84bea3c4 100644
--- a/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts
+++ b/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts
@@ -113,7 +113,7 @@ export class NotificationsComponent implements AfterViewInit {
return updatedNotifications
})
},
- error: (e: HttpErrorResponse) => this.layout.sendNotification('error', 'Notifications', 'Unable to mark as read', e)
+ error: (e: HttpErrorResponse) => this.layout.sendNotification('error', 'Notifications', 'Mark as read', e)
})
}
}
diff --git a/frontend/src/app/applications/sync/components/shared/sync-path-settings.component.html b/frontend/src/app/applications/sync/components/shared/sync-path-settings.component.html
index 8317c534..4574affa 100644
--- a/frontend/src/app/applications/sync/components/shared/sync-path-settings.component.html
+++ b/frontend/src/app/applications/sync/components/shared/sync-path-settings.component.html
@@ -98,10 +98,10 @@
style="width: 70px"
type="number">
<select [(ngModel)]="syncPath.settings.scheduler.unit" class="form-select form-select-sm">
- <option l10nTranslate [ngValue]="SYNC_PATH_SCHEDULER_UNIT.DISABLED">{{ SYNC_PATH_SCHEDULER_UNIT.DISABLED }}</option>
- <option l10nTranslate [ngValue]="SYNC_PATH_SCHEDULER_UNIT.MINUTE">{{ SYNC_PATH_SCHEDULER_UNIT.MINUTE }}s</option>
- <option l10nTranslate [ngValue]="SYNC_PATH_SCHEDULER_UNIT.HOUR">{{ SYNC_PATH_SCHEDULER_UNIT.HOUR }}s</option>
- <option l10nTranslate [ngValue]="SYNC_PATH_SCHEDULER_UNIT.DAY">{{ SYNC_PATH_SCHEDULER_UNIT.DAY }}s</option>
+ <option [ngValue]="SYNC_PATH_SCHEDULER_UNIT.DISABLED" l10nTranslate>disabled</option>
+ <option [ngValue]="SYNC_PATH_SCHEDULER_UNIT.MINUTE" l10nTranslate>scheduler_unit_minute</option>
+ <option [ngValue]="SYNC_PATH_SCHEDULER_UNIT.HOUR" l10nTranslate>scheduler_unit_hour</option>
+ <option [ngValue]="SYNC_PATH_SCHEDULER_UNIT.DAY" l10nTranslate>scheduler_unit_day</option>
</select>
</div>
</div>
diff --git a/frontend/src/app/applications/sync/components/sync-paths.component.html b/frontend/src/app/applications/sync/components/sync-paths.component.html
index a9915c7b..d5d4a912 100644
--- a/frontend/src/app/applications/sync/components/sync-paths.component.html
+++ b/frontend/src/app/applications/sync/components/sync-paths.component.html
@@ -81,7 +81,7 @@
</div>
</div>
}
- <div [tooltip]="('Scheduler: ' + store.clientScheduler() | translate:locale.language)" container="body">
+ <div [tooltip]="(('Scheduler' | translate:locale.language) + ': ' + (store.clientScheduler() | translate:locale.language))" container="body">
<div class="btn-group btn-group-sm me-1" dropdown>
<button class="btn btn-sm {{store.clientScheduler() === CLIENT_SCHEDULER_STATE.DISABLED ? 'btn-warning' : 'btn-success'}} dropdown-toggle" dropdownToggle type="button">
@if (store.clientScheduler() === CLIENT_SCHEDULER_STATE.DISABLED) {
diff --git a/frontend/src/app/applications/users/components/dialogs/user-guest-dialog.component.ts b/frontend/src/app/applications/users/components/dialogs/user-guest-dialog.component.ts
index ac46b0e2..fee9e078 100644
--- a/frontend/src/app/applications/users/components/dialogs/user-guest-dialog.component.ts
+++ b/frontend/src/app/applications/users/components/dialogs/user-guest-dialog.component.ts
@@ -10,7 +10,7 @@ import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faAddressCard, faPen, faPlus, faShieldHalved, faSpinner, faUsers, faUsersGear } from '@fortawesome/free-solid-svg-icons'
-import { USER_LOGIN_VALIDATION, USER_NOTIFICATION_TEXT, USER_ROLE } from '@sync-in-server/backend/src/applications/users/constants/user'
+import { USER_LOGIN_VALIDATION, USER_ROLE } from '@sync-in-server/backend/src/applications/users/constants/user'
import type { CreateUserDto, UpdateUserDto } from '@sync-in-server/backend/src/applications/users/dto/create-or-update-user.dto'
import type { SearchMembersDto } from '@sync-in-server/backend/src/applications/users/dto/search-members.dto'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
@@ -24,7 +24,7 @@ import { LayoutService } from '../../../../layout/layout.service'
import { UserType } from '../../interfaces/user.interface'
import { GuestUserModel } from '../../models/guest.model'
import { MemberModel, ownerToMember } from '../../models/member.model'
-import { USER_ICON, USER_LANGUAGE_AUTO, USER_PASSWORD_CHANGE_TEXT } from '../../user.constants'
+import { USER_ICON, USER_LANGUAGE_AUTO, USER_NOTIFICATION_TEXT, USER_PASSWORD_CHANGE_TEXT } from '../../user.constants'
import { UserService } from '../../user.service'
import { UserSearchComponent } from '../utils/user-search.component'
diff --git a/frontend/src/app/applications/users/components/sidebar/user-onlines.component.ts b/frontend/src/app/applications/users/components/sidebar/user-onlines.component.ts
index c50a928b..2b70db66 100644
--- a/frontend/src/app/applications/users/components/sidebar/user-onlines.component.ts
+++ b/frontend/src/app/applications/users/components/sidebar/user-onlines.component.ts
@@ -5,11 +5,12 @@
*/
import { Component, computed, inject, Signal } from '@angular/core'
-import { USER_ONLINE_STATUS, USER_ONLINE_STATUS_LIST } from '@sync-in-server/backend/src/applications/users/constants/user'
+import { USER_ONLINE_STATUS } from '@sync-in-server/backend/src/applications/users/constants/user'
import { L10nTranslateDirective } from 'angular-l10n'
import { AutoResizeDirective } from '../../../../common/directives/auto-resize.directive'
import { StoreService } from '../../../../store/store.service'
import { UserOnlineModel } from '../../models/user-online.model'
+import { USER_ONLINE_STATUS_LIST } from '../../user.constants'
@Component({
selector: 'app-onlines',
diff --git a/frontend/src/app/applications/users/components/sidebar/user-profile.component.html b/frontend/src/app/applications/users/components/sidebar/user-profile.component.html
index 525f00c0..0c3b5164 100755
--- a/frontend/src/app/applications/users/components/sidebar/user-profile.component.html
+++ b/frontend/src/app/applications/users/components/sidebar/user-profile.component.html
@@ -46,7 +46,7 @@
(ngModelChange)="setOnlineStatus($event)"
class="form-select form-select-sm mt-1">
@for (s of allOnlineStatus; track $index) {
- <option [ngValue]="allOnlineStatus.indexOf(s)" l10nTranslate>{{ s | capitalize }}</option>
+ <option [ngValue]="allOnlineStatus.indexOf(s)">{{ s | translate:locale.language | capitalize }}</option>
}
</select>
</div>
diff --git a/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts b/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts
index ac1bc002..86400a5a 100644
--- a/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts
+++ b/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts
@@ -9,8 +9,7 @@ import { FormsModule } from '@angular/forms'
import { RouterLink } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faCircleHalfStroke, faCog, faPowerOff, faUserAlt, faUserSecret } from '@fortawesome/free-solid-svg-icons'
-import { USER_ONLINE_STATUS_LIST } from '@sync-in-server/backend/src/applications/users/constants/user'
-import { L10nTranslateDirective } from 'angular-l10n'
+import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
import { Subscription } from 'rxjs'
import { APP_URL } from '../../../../app.constants'
import { AuthService } from '../../../../auth/auth.service'
@@ -20,7 +19,7 @@ import { LayoutService } from '../../../../layout/layout.service'
import { StoreService } from '../../../../store/store.service'
import { logoDarkUrl, logoUrl } from '../../../files/files.constants'
import { UserType } from '../../interfaces/user.interface'
-import { USER_PATH } from '../../user.constants'
+import { USER_ONLINE_STATUS_LIST, USER_PATH } from '../../user.constants'
import { UserService } from '../../user.service'
@Component({
@@ -33,12 +32,13 @@ import { UserService } from '../../user.service'
}
}
`,
- imports: [FormsModule, RouterLink, CapitalizePipe, FaIconComponent, L10nTranslateDirective]
+ imports: [FormsModule, RouterLink, CapitalizePipe, FaIconComponent, L10nTranslateDirective, L10nTranslatePipe]
})
export class UserProfileComponent implements OnDestroy {
protected readonly logoDarkUrl = logoDarkUrl
protected readonly logoUrl = logoUrl
protected readonly store = inject(StoreService)
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly USER_PATH = USER_PATH
protected readonly allOnlineStatus = USER_ONLINE_STATUS_LIST
protected appBaseUrl = `${APP_URL.WEBSITE}`
diff --git a/frontend/src/app/applications/users/components/user-account.component.html b/frontend/src/app/applications/users/components/user-account.component.html
index df09dca8..1b48a01c 100755
--- a/frontend/src/app/applications/users/components/user-account.component.html
+++ b/frontend/src/app/applications/users/components/user-account.component.html
@@ -26,7 +26,7 @@
(ngModelChange)="setOnlineStatus($event)"
class="form-select form-select-sm my-auto mt-2">
@for (n of allOnlineStatus; track $index) {
- <option [ngValue]="allOnlineStatus.indexOf(n)" l10nTranslate>{{ n | capitalize }}</option>
+ <option [ngValue]="allOnlineStatus.indexOf(n)">{{ n | translate:locale.language | capitalize }}</option>
}
</select>
</div>
@@ -162,7 +162,8 @@
<button [disabled]="!newPassword || !oldPassword || newPassword.length < passwordMinLength"
(click)="submitPassword()"
class="d-flex btn btn-xs btn-primary text-nowrap"
- type="button" l10nTranslate>Update
+ type="button" l10nTranslate>
+ Update
</button>
</div>
</div>
diff --git a/frontend/src/app/applications/users/components/user-account.component.ts b/frontend/src/app/applications/users/components/user-account.component.ts
index 2d3f801b..a82eb3c1 100644
--- a/frontend/src/app/applications/users/components/user-account.component.ts
+++ b/frontend/src/app/applications/users/components/user-account.component.ts
@@ -9,11 +9,7 @@ import { Component, inject, OnDestroy } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faCopy, faKey } from '@fortawesome/free-solid-svg-icons'
-import {
- USER_NOTIFICATION_TEXT,
- USER_ONLINE_STATUS_LIST,
- USER_PASSWORD_MIN_LENGTH
-} from '@sync-in-server/backend/src/applications/users/constants/user'
+import { USER_PASSWORD_MIN_LENGTH } from '@sync-in-server/backend/src/applications/users/constants/user'
import { UserAppPassword } from '@sync-in-server/backend/src/applications/users/interfaces/user-secrets.interface'
import { WEBDAV_BASE_PATH } from '@sync-in-server/backend/src/applications/webdav/constants/routes'
import { TWO_FA_HEADER_CODE, TWO_FA_HEADER_PASSWORD } from '@sync-in-server/backend/src/authentication/constants/auth'
@@ -33,7 +29,7 @@ import { TimeDateFormatPipe } from '../../../common/pipes/time-date-format.pipe'
import { LayoutService } from '../../../layout/layout.service'
import { StoreService } from '../../../store/store.service'
import { UserType } from '../interfaces/user.interface'
-import { USER_ICON, USER_LANGUAGE_AUTO, USER_PATH, USER_TITLE } from '../user.constants'
+import { USER_ICON, USER_LANGUAGE_AUTO, USER_NOTIFICATION_TEXT, USER_ONLINE_STATUS_LIST, USER_PATH, USER_TITLE } from '../user.constants'
import { UserService } from '../user.service'
import { UserAuth2faEnableDialogComponent } from './dialogs/user-auth-2fa-enable-dialog.component'
import { UserAuthManageAppPasswordsDialogComponent } from './dialogs/user-auth-manage-app-passwords-dialog.component'
diff --git a/frontend/src/app/applications/users/models/user-online.model.ts b/frontend/src/app/applications/users/models/user-online.model.ts
index b938bf1f..beee994e 100644
--- a/frontend/src/app/applications/users/models/user-online.model.ts
+++ b/frontend/src/app/applications/users/models/user-online.model.ts
@@ -4,9 +4,10 @@
* See the LICENSE file for licensing details
*/
-import { USER_ONLINE_STATUS, USER_ONLINE_STATUS_LIST } from '@sync-in-server/backend/src/applications/users/constants/user'
+import { USER_ONLINE_STATUS } from '@sync-in-server/backend/src/applications/users/constants/user'
import type { UserOnline } from '@sync-in-server/backend/src/applications/users/interfaces/websocket.interface'
import { popFromObject } from '@sync-in-server/backend/src/common/shared'
+import { USER_ONLINE_STATUS_LIST } from '../user.constants'
import { userAvatarUrl } from '../user.functions'
export class UserOnlineModel implements UserOnline {
diff --git a/frontend/src/app/applications/users/user.constants.ts b/frontend/src/app/applications/users/user.constants.ts
index e15ab7f3..ed491fad 100644
--- a/frontend/src/app/applications/users/user.constants.ts
+++ b/frontend/src/app/applications/users/user.constants.ts
@@ -25,6 +25,14 @@ export const USER_TITLE = {
APPS: 'Applications'
} as const
+export const USER_NOTIFICATION_TEXT = {
+ APPLICATION: 'application',
+ APPLICATION_EMAIL: 'application and email'
+} as const
+
+// Indexes correspond to status number of `USER_ONLINE_STATUS`
+export const USER_ONLINE_STATUS_LIST = ['available', 'busy', 'absent', 'offline']
+
export const USER_ICON = {
ACCOUNT: faUser,
CLIENTS: faLaptop,
diff --git a/frontend/src/app/layout/navbar/navbar.component.ts b/frontend/src/app/layout/navbar/navbar.component.ts
index 83d555fc..d0ca6d78 100644
--- a/frontend/src/app/layout/navbar/navbar.component.ts
+++ b/frontend/src/app/layout/navbar/navbar.component.ts
@@ -8,9 +8,9 @@ import { Location } from '@angular/common'
import { Component, inject, OnDestroy } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faAngleLeft, faAngleRight } from '@fortawesome/free-solid-svg-icons'
-import { USER_ONLINE_STATUS_LIST } from '@sync-in-server/backend/src/applications/users/constants/user'
import { Subscription } from 'rxjs'
import { UserType } from '../../applications/users/interfaces/user.interface'
+import { USER_ONLINE_STATUS_LIST } from '../../applications/users/user.constants'
import { StoreService } from '../../store/store.service'
import { BreadcrumbComponent } from '../breadcrumb/breadcrumb.component'
import { TAB_MENU } from '../layout.interfaces'
diff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.json
index f5c9fe36..149d34e1 100644
--- a/frontend/src/i18n/fr.json
+++ b/frontend/src/i18n/fr.json
@@ -13,14 +13,10 @@
"Login already used": "Identifiant déjà utilisé",
"You are already logged in": "Vous êtes déjà connecté",
"Name already used": "Nom déjà utilisé",
- "Label already used": "Label déjà utilisé",
- "Location already used": "Emplacement déjà utilisé",
"Token has expired": "Le token a expiré",
"Confirm": "Confirmer",
"Cancel": "Annuler",
"Close": "Fermer",
- "navigation": "navigation",
- "Navigation": "Navigation",
"Server connection error": "Erreur de connexion au serveur",
"Filter": "Filtrer",
"Filters": "Filtres",
@@ -34,17 +30,8 @@
"Type to search for groups to add": "Tapez pour rechercher des groupes à ajouter",
"Type to search for users to add": "Tapez pour rechercher des utilisateurs à ajouter",
"Type to search for managers to add": "Tapez pour rechercher des manageurs à ajouter",
- "Search for groups": "Rechercher des groupes",
- "Search for users": "Rechercher des utilisateurs",
- "Search for shares": "Rechercher des partages",
- "Search for wallets": "Rechercher des portefeuilles",
- "Search for guests or wallets": "Rechercher des invités ou des portefeuilles",
- "Escape key to exit": "Echap pour sortir",
- "No items found": "Aucun élément trouvé",
"Member since": "Membre depuis",
- "Management": "Gestion",
"Windows Manager": "Gestionnaire de fenêtres",
- "View all": "Tout voir",
"Mark as read": "Marquer comme lu",
"See": "Voir",
"no_task": "Aucune tâche",
@@ -54,26 +41,22 @@
"nb_active_tasks": "{{ nba }} tâches en cours sur {{ nb }}",
"nb_elements": "{{nb}} élément(s)",
"nb_actions": "{{nb}} action(s)",
- "No message": "Aucun message",
"one_message": "{{ nb }} nouveau message",
"nb_messages": "{{ nb }} nouveaux messages",
"one_notification": "{{ nb }} notification non lue",
"nb_notifications": "{{ nb }} notifications non lues",
"Application": "Application",
- "Application and Email": "Application et Email",
+ "application": "application",
+ "application and email": "application et email",
"Notification": "Notification",
"Notifications": "Notifications",
"Event": "Évènement",
- "Folders": "Dossiers",
"File": "Fichier",
"Files": "Fichiers",
- "Members files": "Fichiers des membres",
"Personal files": "Fichiers personnels",
"for personal files": "pour les fichiers personnels",
"Personal": "Personnels",
"External": "Externe",
- "Share files": "Fichiers des partages",
- "Share space": "Espace de partage",
"Share status": "État du partage",
"Share description": "Description du partage",
"No recent files": "Aucun fichier récent",
@@ -88,7 +71,7 @@
"groups": "groupes",
"Parent group": "Groupe parent",
"Group updated": "Groupe mis à jour",
- "Group added": "Groupe ajouté",
+ "Group created": "Groupe créé",
"Group not found": "Groupe non trouvé",
"Group error": "Groupe erreur",
"Set as group manager": "Définir comme manageur de groupe",
@@ -121,12 +104,9 @@
"Users": "Utilisateurs",
"users": "utilisateurs",
"New user": "Nouvel utilisateur",
- "Author": "Auteur",
"account": "compte",
"Account": "Compte",
"Account status": "Status du compte",
- "Message": "Message",
- "Messages": "Messages",
"Email": "Email",
"Email already used": "Email déjà utilisé",
"First name": "Prénom",
@@ -167,10 +147,8 @@
"Configuration": "Configuration",
"Applications": "Applications",
"applications": "applications",
- "Authorized applications": "Applications autorisées",
"Permissions inherited from groups": "Permissions héritées des groupes",
"Only the group will be deleted, the members will no longer be part of it.": "Seul le groupe sera supprimé, les membres n'en feront plus partie.",
- "Wallets and guests will not be deleted": "Les portefeuilles et les invités ne seront pas supprimés",
"Avatar": "Avatar",
"Update": "Mettre à jour",
"current password": "mot de passe actuel",
@@ -191,10 +169,8 @@
"Full-text search preference updated": "Préférence de recherche full-text mise à jour",
"Unable to update notification preference": "Impossible de mettre à jour la préférence de notification",
"Unable to update full-text search preference": "Impossible de mettre à jour la préférence de recherche full-text",
- "Unable to open document, missing configuration": "Impossible d'ouvrir le document, configuration manquante",
"Unable to open document": "Impossible d'ouvrir le document",
"Home": "Accueil",
- "Content": "Contenu",
"Recents": "Récents",
"recents": "recents",
"Trash": "Corbeille",
@@ -214,7 +190,7 @@
"desktop_app_sync": "Synchronisation depuis l'application de bureau",
"webdav_access": "Accès WebDAV",
"Create share": "Créer le partage",
- "Update share": "Modifier le partage",
+ "Edit share": "Modifier le partage",
"Delete share": "Supprimer le partage",
"Child shares": "Partages enfants",
"webdav": "WebDAV",
@@ -229,7 +205,6 @@
"Edit space": "Modifier l'espace",
"Delete space": "Supprimer l'espace",
"Create a new share": "Créer un nouveau partage",
- "Edit share": "Modifier le partage",
"Type to search for space to select": "Tapez pour rechercher l'espace à sélectionner",
"Anchor to a space": "Ancrer à un espace",
"Anchor files to a space": "Ancrer les fichiers dans un espace",
@@ -253,15 +228,9 @@
"You are no longer a member of the parent share, your child share has been deleted": "Vous n'êtes plus membre du partage parent, votre partage enfant a été supprimé",
"anchored": "a ancré",
"unanchored": "a désancré",
- "Share removed": "Partage supprimé",
"Share not found": "Partage non trouvé",
- "Root share not found": "Racine du Partage non trouvé",
- "You must add at least one file to the share": "Vous devez ajouter au moins un fichier au partage",
- "Share updated": "Partage mis à jour",
- "Share added": "Partage ajouté",
"Go to": "Aller",
"Location": "Emplacement",
- "Label": "Label",
"Name and location are required": "Nom et emplacement sont requis",
"Parent location already exists in files": "L'emplacement parent existe déjà dans les fichiers",
"Check the location": "Vérifier l'emplacement",
@@ -274,22 +243,13 @@
"The location is a directory": "L'emplacement est un répertoire",
"The file is locked": "Le fichier est verrouillé",
"This share is protected by a password": "Ce partage est protégé par un mot de passe",
- "you do not have write permission on this share": "vous n'avez pas la permission d'écrire sur ce partage",
- "you do not have write permission on this destination": "vous n'avez pas la permission d'écrire sur cette destination",
- "you do not have move permission on this share": "vous n'avez pas la permission de déplacer sur ce partage",
- "you do not have delete permission on this share": "vous n'avez pas la permission de supprimer sur ce partage",
- "you do not have access permission on this share": "vous n'avez pas la permission d'accéder à ce partage",
"You do not have share permission": "Vous n'avez pas la permission de partager",
- "you do not have permissions": "vous n'avez pas les permissions",
"You can not share a space": "Vous ne pouvez pas partager un espace",
"You can not remove an anchored file": "vous ne pouvez pas supprimer un fichier ancré",
"You are not allowed to write here": "Vous n'êtes pas autorisé à écrire ici",
"You are not allowed to do this action": "Vous n'êtes pas autorisé à effectuer cette action",
"You can not move an anchored file": "Vous ne pouvez pas déplacer un fichier ancré",
"You can not move a locked file": "Vous ne pouvez pas déplacer un fichier verrouillé",
- "destination of the copy/move not found": "la destination du copier/déplacer n'a pas été trouvée",
- "an error occurred while moving the archive": "une erreur s'est produite durant le déplacement de l'archive",
- "anchored by me": "ancré par moi",
"Anchored": "Ancré",
"Anchored by": "Ancré par",
"Manage my anchored files": "Gérer mes fichiers ancrés",
@@ -374,9 +334,7 @@
"Modified": "Modifié",
"modified": "modifié",
"Tasks": "Tâches",
- "Task completed": "Tâche terminée",
"Download from URL": "Télécharger depuis une URL",
- "Upload completed": "Envoi terminé",
"Upload files": "Envoyer des fichiers",
"Upload folders": "Envoyer des dossiers",
"Folder name": "Nom du dossier",
@@ -387,11 +345,8 @@
"File permissions": "Permissions du fichier",
"Text": "Texte",
"Rich Text Format": "Texte Enrichi",
- "Select a document type": "Sélectionnez un type de document",
"Forbidden characters": "Caractères interdits",
- "Element not found": "Élément non trouvé",
"Elements": "Éléments",
- "file(s) to add": "fichier(s) à ajouter",
"Malformed URL": "URL mal formée",
"New": "Nouveau",
"Folder": "Dossier",
@@ -421,63 +376,35 @@
"Delete user": "Supprimer l'utilisateur",
"Delete all user files": "Supprimer tous les fichiers de l'utilisateur",
"share": "partage",
- "share(s)": "partage(s)",
"Share name": "Nom du partage",
"New share": "Nouveau partage",
"New share link": "Nouveau lien de partage",
"New link": "Nouveau lien",
"Edit children shares": "Modifier les partages enfants",
- "Remove share": "Supprimer le partage",
- "Edit anchors": "Modifier les ancres",
- "The share name is required": "Le nom du partage est requis",
- "No longer share": "Ne plus partager",
"Link": "Lien",
"link": "lien",
"Links": "Liens",
"links": "liens",
- "Link name": "Nom du lien",
"Link copied": "Lien copié",
"Link created": "Lien créé",
"Link deleted": "Lien supprimé",
- "Link updated": "Lien mis à jour",
"Link error": "Erreur lien",
"Copy link": "Copier le lien",
"Edit link": "Modifier le lien",
- "Details": "Détails",
- "Hide details": "Cacher les détails",
- "Show details": "Montrer les détails",
"Guest Link": "Lien Invité",
"Guest name": "Nom de l'invité",
"Guest email": "Email de l'invité",
"Guest language": "Langue de l'invité",
"Guest": "Invité",
"Guests": "Invités",
- "Shared guests": "Invités partagés",
- "My guests": "Mes invités",
"guest": "invité",
"guests": "invités",
"New guest": "Nouvel invité",
"Edit guest": "Modifier l'invité",
- "Delete guest": "Supprimer l'invité",
"Guest created": "Invité créé",
"Guest deleted": "Invité supprimé",
"Guest updated": "Invité mis à jour",
"Guest error": "Invité erreur",
- "Wallet": "Portefeuille",
- "wallet": "portefeuille",
- "wallets": "portefeuilles",
- "Wallets": "Portefeuilles",
- "Wallet from owner": "Portefeuille du propriétaire",
- "Parent wallet": "Portefeuille parent",
- "Select the wallet": "Sélectionner le portefeuille",
- "Select the parent wallet": "Sélectionner le portefeuille parent",
- "Select the owner": "Sélectionner le propriétaire",
- "Delete wallet": "Supprimer le portefeuille",
- "New wallet": "Nouveau portefeuille",
- "Wallet added": "Portefeuille ajoutée",
- "Wallet deleted": "Portefeuille supprimé",
- "Wallet updated": "Portefeuille mis à jour",
- "Add a guest link": "Ajouter un lien invité",
"Add an external location": "Ajouter un emplacement externe",
"External location": "Emplacement externe",
"Select a file": "Sélectionner un fichier",
@@ -489,14 +416,12 @@
"none": "aucun",
"The maximum number of access allowed to the link is exceeded": "Le nombre maximum d'accès autorisé au lien est dépassé",
"Set a password": "Définir un mot de passe",
- "Enter your password to confirm": "Entrez votre mot de passe pour confirmer",
"Enter your password": "Entrez votre mot de passe",
"Permissions": "Permissions",
"No permissions": "Pas de permissions",
"Owner": "Propriétaire",
"Me": "Moi",
"Shared": "Partagé",
- "Sharer": "Partageur",
"Created": "Créé",
"Created & Modified": "Créé & Modifié",
"Creation date": "Date de création",
@@ -513,17 +438,12 @@
"Unable to update user groups": "Impossible de mettre à jour les groupes de l'utilisateur",
"User created": "Utilisateur créé",
"User updated": "Utilisateur mis à jour",
- "User deleted": "Utilisateur supprimé",
"User not found": "Utilisateur non trouvé",
- "User error": "Utilisateur erreur",
"Edit user": "Modifier l'utilisateur",
"Impersonate identity": "Emprunter l'identitié",
- "Users added": "Utilisateurs ajoutés",
- "Member removed": "Membre supprimé",
"Type": "Type",
"Description": "Description",
"Visibility": "Visibilité",
- "If the owner is defined, all deleted files are moved to owner trash else all files are deleted permanently": "Si le propriétaire est défini, tous les fichiers supprimés sont déplacés dans la corbeille du propriétaire, sinon tous les fichiers sont supprimés définitivement",
"Unknown error !": "Erreur inconnue !",
"Unknown": "Inconnu",
"Expiration": "Expiration",
@@ -539,50 +459,23 @@
"commented": "a commenté",
"No recent comments": "Pas de commentaire récent",
"Write a comment ...": "Ecrire un commentaire ...",
- "Write a message ...": "Ecrire un message ...",
- "wrote": "a écrit",
"yes": "oui",
"no": "non",
"Client": "Client",
"Clients": "Clients",
- "is online": "est en ligne",
- "is offline": "est hors ligne",
- "Available": "Disponible",
- "Busy": "Occupé",
- "Absent": "Absent",
- "Offline": "Hors ligne",
+ "available": "disponible",
+ "busy": "occupé",
+ "absent": "absent",
+ "offline": "hors ligne",
"View": "Voir",
- "Viewer": "Visionneuse",
"Session has expired": "La session a expiré",
- "Connection interrupted with the server": "Connexion interrompue avec le serveur",
- "If the problem persists, please contact an administrator": "Si le problème persiste, veuillez contacter un administrateur",
"Please sign in": "Veuillez vous reconnecter",
- "desktop application": "application de bureau",
- "Desktop Applications": "Applications de bureau",
- "command line interface": "interface en ligne de commande",
"days": "jours",
"day": "jour",
- "chats": "chats",
- "Start a conversation": "Démarrer une conversation",
- "Topic name": "Nom du sujet",
- "Open Topic": "Ouvrir le sujet",
- "Invite users": "Inviter des utilisateurs",
- "Leave": "Quitter",
"Delete": "Supprimer",
- "has left the chat": "a quitté le chat",
- "has deleted the chat": "a supprimé le chat",
- "has been invited to this chat": "a été invité dans ce chat",
- "has been removed from the chat": "a été supprimé de ce chat",
- "is now a chat administrator": "est maintenant un administrateur du chat",
- "is no longer a chat administrator": "n'est plus un administrateur du chat",
- "The members can invite others users to join this chat": "Les membres peuvent inviter d'autres utilisateurs à rejoindre ce chat",
- "You are the administrator of this conversation": "Vous êtes l'administrateur de cette conversation",
- "The chat is public, you can invite others users to join": "Le chat est publique, vous pouvez inviter d'autres utilisateurs à rejoindre",
- "The chat is private, only administrators can invite the users to join": "Le caht est privé, seuls les administrateurs peuvent inviter des utilisateurs à rejoindre",
"Scheduler": "Planificateur",
- "Scheduler: disabled": "Planificateur: désactivé",
- "Scheduler: async": "Planificateur: parallèle",
- "Scheduler: seq": "Planificateur: séquentiel",
+ "async": "parallèle",
+ "seq": "séquentiel",
"Transfers": "Transferts",
"Simulate": "Simuler",
"Reset": "Réinitialiser",
@@ -590,14 +483,12 @@
"Action": "Action",
"Added": "Ajouté",
"Removed": "Supprimé",
- "Changed": "Modifié",
"Copied": "Copié",
"Moved": "Déplacé",
"Filtered": "Filtré",
"Error": "Erreur",
"Server": "Serveur",
"Direction": "Direction",
- "Side": "Côté",
"Conflict": "Conflit",
"Show filtered files": "Afficher les fichiers filtrés",
"recent": "récent",
@@ -612,14 +503,14 @@
"Enable": "Activer",
"disabled": "désactivé",
"Disable": "Désactiver",
- "hours": "heures",
- "minutes": "minutes",
+ "scheduler_unit_hour": "heures",
+ "scheduler_unit_minute": "minutes",
+ "scheduler_unit_day": "jours",
"You must have permission to modify the server folder to choose a different sync mode": "Vous devez avoir la permission de modifier le dossier du serveur pour choisir une autre mode de synchronisation",
"upload only": "envoyer seulement",
"download only": "télécharger seulement",
"both": "les deux",
"never": "jamais",
- "More infos": "Plus d'infos",
"Clear events": "Effacer les évènements",
"Events from": "Les évènements de",
"All syncs": "Toutes les synchronisations",
@@ -646,8 +537,6 @@
"The parent directory is already synced": "Le dossier parent est déjà synchronisé",
"This folder already exists": "Ce dossier existe déjà",
"This file already exists": "Ce fichier existe déjà",
- "You do not have permission to access this share": "Vous n'avez pas le droit d'accéder à ce partage",
- "You can not create a folder in the root of shares": "Vous ne pouvez pas créer de dossier à la racine des partages",
"This directory is not accessible": "Ce répertoire n'est pas accessible",
"This directory is read-only, you will not be able to modify it": "Ce répertoire est en lecture seule, vous ne pourrez pas le modifier",
"Please select the server directory to sync, if it doesn't exist you can create it.": "Veuillez sélectionner le répertoire du serveur à synchroniser, s'il n'existe pas, vous pourrez le créer.",
@@ -667,8 +556,6 @@
"the server’s files take precedence": "les fichiers du serveur ont la priorité",
"the files in": "les fichiers de",
"will be preferred": "seront préférés",
- "The remote folder is empty, the contents of the local folder will be deleted, add file in local folder to confirm and sync changes": "Le dossier distant est vide, le contenu du dossier local sera supprimé, ajoutez un fichier dans le dossier local pour confirmer et synchroniser les modifications",
- "The local folder is empty, the contents of the remote folder will be deleted, add file in remote folder to confirm and sync changes": "Le dossier local est vide, le contenu du dossier distant sera supprimé, ajoutez un fichier dans le dossier distant pour confirmer et synchroniser les modifications",
"Loading...": "Chargement...",
"No results": "Pas de résultats",
"Download ARM64 version": "Télécharger la version ARM64",
@@ -687,7 +574,6 @@
"Recovery code": "Code de récupération",
"Use a recovery code": "Utiliser un code de récupération",
"Authentication code": "Code d'authentification",
- "TOTP Verification": "Vérification TOTP",
"Secret copied": "Secret copié",
"Recovery codes copied": "Codes de récupération copiés",
"Invalid code": "Code invalide",
@@ -708,7 +594,6 @@
"Or enter this secret manually": "Ou entrez ce secret manuellement",
"Valid with your TOTP code": "Validez avec votre code TOTP",
"The secret has expired": "Le secret a expiré",
- "The secret is missing": "Le secret est absent",
"Keep these codes in a safe place. They will allow you to access your account if you lose access to your two-factor authentication.": "Conservez ces codes en lieu sûr. Ils vous permettront d’accéder à votre compte si vous perdez l’accès à votre authentification à deux facteurs.",
"These recovery codes are for one-time use only and will only be displayed here once.": "Ces codes de récupération sont à usage unique et ne seront affichés qu’une seule fois ici."
}
diff --git a/scripts/unused_translations.js b/scripts/unused_translations.js
new file mode 100644
index 00000000..309fc089
--- /dev/null
+++ b/scripts/unused_translations.js
@@ -0,0 +1,243 @@
+#!/usr/bin/env node
+/*
+ * Copyright (C) 2012-2025 Johan Legrand <[email protected]>
+ * This file is part of Sync-in | The open source file sync and share solution
+ * See the LICENSE file for licensing details
+ */
+
+/**
+ * Script: unused_translations.js
+ *
+ * Purpose:
+ * - Read frontend/i18n/fr.json
+ * - Extract and flatten all keys (dot notation, e.g., "section.sub.title")
+ * - Search each key across all .ts and .html files of the project
+ * - Matches must be for the full phrase (no partial substring) and case-insensitive
+ * - Print the list of unused keys
+ *
+ * Usage:
+ * - node scripts/unused_translations.js
+ * - Options:
+ * --print-used Also print found keys with first occurrence
+ * --root=<path> Project root path (default: process.cwd())
+ * --translations=<p> Path to translation file (default: frontend/i18n/fr.json)
+ * --include=<path> Start directory for scanning files (default: project root)
+ * --quiet Reduced output (only print unused keys)
+ *
+ * Notes:
+ * - Word boundaries are adapted to i18n keys (allowed characters: [A-Za-z0-9_.-]).
+ * - Ignored directories: node_modules, .git, dist, build, out, coverage, tmp, .idea, .vscode
+ */
+
+const fs = require('fs')
+const path = require('path')
+
+const argv = process.argv.slice(2)
+const argMap = new Map(
+ argv
+ .filter((a) => a.startsWith('--'))
+ .map((a) => {
+ const [k, ...rest] = a.replace(/^--/, '').split('=')
+ return [k, rest.length ? rest.join('=') : true]
+ })
+)
+
+const PROJECT_ROOT = path.resolve(process.cwd(), argMap.get('root') || '')
+const TRANSLATION_FILE = path.resolve(PROJECT_ROOT, argMap.get('translations') || 'frontend/src/i18n/fr.json')
+// Directory to start scanning from (defaults to project root)
+const SEARCH_ROOT = path.resolve(PROJECT_ROOT, argMap.get('include') || '')
+
+const PRINT_USED = Boolean(argMap.get('print-used'))
+const QUIET = Boolean(argMap.get('quiet'))
+
+const IGNORED_DIRS = new Set(['node_modules', '.git', 'dist', 'build', 'out', 'coverage', 'tmp', '.idea', '.vscode'])
+
+// Static list of keys to ignore when reporting unused translations.
+// Add exact key strings as they appear in fr.json.
+const IGNORE_UNUSED_KEYS = ['Sync already exists', 'nb_elements', 'one_message', 'nb_messages']
+
+function readJson(filePath) {
+ try {
+ const raw = fs.readFileSync(filePath, 'utf8')
+ return JSON.parse(raw)
+ } catch (e) {
+ console.error(`Error: cannot read/parse "${filePath}": ${e.message}`)
+ process.exit(2)
+ }
+}
+
+function flattenKeys(obj, prefix = '') {
+ const keys = []
+ const isObject = (v) => v && typeof v === 'object' && !Array.isArray(v)
+
+ for (const [k, v] of Object.entries(obj || {})) {
+ const current = prefix ? `${prefix}.${k}` : k
+ if (isObject(v)) {
+ keys.push(...flattenKeys(v, current))
+ } else {
+ // Add final leaf key (we don't filter by value type)
+ keys.push(current)
+ }
+ }
+ return keys
+}
+
+function walkFiles(startDir) {
+ const result = []
+ function walk(dir) {
+ let entries
+ try {
+ entries = fs.readdirSync(dir, { withFileTypes: true })
+ } catch {
+ // Permission issues / broken symlinks
+ return
+ }
+ for (const entry of entries) {
+ const fullPath = path.join(dir, entry.name)
+ if (entry.isDirectory()) {
+ if (IGNORED_DIRS.has(entry.name)) continue
+ walk(fullPath)
+ } else if (entry.isFile()) {
+ if (fullPath.endsWith('.ts') && !fullPath.endsWith('.d.ts')) {
+ result.push(fullPath)
+ } else if (fullPath.endsWith('.html')) {
+ result.push(fullPath)
+ }
+ }
+ }
+ }
+ walk(startDir)
+ return result
+}
+
+function escapeRegExp(str) {
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+}
+
+/**
+ * Remove comments from file contents before searching:
+ * - For .ts: removes /* ... *\/ block comments and // line comments (only when starting at line start or after whitespace)
+ * - For .html: removes <!-- ... --> comments
+ */
+function stripComments(filePath, text) {
+ if (filePath.endsWith('.ts')) {
+ // Remove block comments
+ const withoutBlock = text.replace(/\/\*[\s\S]*?\*\//g, '')
+ // Remove line comments that start at line start or after whitespace
+ const withoutLine = withoutBlock.replace(/(^|\s)\/\/.*$/gm, '$1')
+ return withoutLine
+ }
+ if (filePath.endsWith('.html')) {
+ // Remove HTML comments
+ return text.replace(/<!--[\s\S]*?-->/g, '')
+ }
+ return text
+}
+
+/**
+ * Build a regex that enforces "full phrase" matching for an i18n key:
+ * - Allowed key characters: [A-Za-z0-9_.-]
+ * - Require that before the key there is no allowed character (or BOS)
+ * - Require that after the key there is no allowed character (or EOS)
+ *
+ * NOTE: we avoid lookbehind for compatibility by using a non-capturing prefix group.
+ * Matching is case-sensitive.
+ */
+function buildKeyRegex(key) {
+ const allowed = 'A-Za-z0-9_.-'
+ const escapedKey = escapeRegExp(key)
+ // (^|[^allowed])key(?![allowed]) with multiline flag only (case-sensitive)
+ return new RegExp(`(^|[^${allowed}])${escapedKey}(?![${allowed}])`, 'm')
+}
+
+function findUsageMap(keys, files) {
+ const used = new Set()
+ const where = new Map() // key -> file path (first occurrence)
+
+ // Performance: read each file once
+ const contents = new Map()
+ for (const file of files) {
+ try {
+ const raw = fs.readFileSync(file, 'utf8')
+ const text = stripComments(file, raw)
+ contents.set(file, text)
+ } catch {
+ // Ignore read errors
+ }
+ }
+
+ const remaining = new Set(keys)
+
+ for (const [file, text] of contents.entries()) {
+ if (remaining.size === 0) break
+ // Simple approach: test remaining keys one by one
+ for (const key of Array.from(remaining)) {
+ const re = buildKeyRegex(key)
+ if (re.test(text)) {
+ used.add(key)
+ where.set(key, file)
+ remaining.delete(key)
+ }
+ }
+ }
+
+ const unused = keys.filter((k) => !used.has(k) && !IGNORE_UNUSED_KEYS.includes(k))
+ return { used: Array.from(used), unused, where }
+}
+
+function main() {
+ const startTs = Date.now()
+
+ if (!fs.existsSync(TRANSLATION_FILE)) {
+ console.error(`Error: translation file not found: ${TRANSLATION_FILE}`)
+ process.exit(1)
+ }
+
+ const dict = readJson(TRANSLATION_FILE)
+ const keys = flattenKeys(dict).sort()
+
+ const searchRoot = fs.existsSync(SEARCH_ROOT) ? SEARCH_ROOT : PROJECT_ROOT
+ const files = walkFiles(searchRoot)
+
+ const { used, unused, where } = findUsageMap(keys, files)
+
+ if (!QUIET) {
+ console.log('Translations analysis (fr.json)')
+ console.log(`- Project root: ${PROJECT_ROOT}`)
+ console.log(`- Translations file: ${TRANSLATION_FILE}`)
+ console.log(`- Scanned directory: ${searchRoot}`)
+ console.log(`- .ts/.html files scanned: ${files.length}`)
+ console.log(`- Total keys: ${keys.length}`)
+ console.log(`- Keys found: ${used.length}`)
+ console.log(`- Keys ignored: ${IGNORE_UNUSED_KEYS.length}`)
+ console.log(`- Unused keys: ${unused.length}`)
+ if (PRINT_USED) {
+ console.log('\nUsed keys (first occurrence):')
+ for (const k of used) {
+ console.log(` - ${k} @ ${where.get(k)}`)
+ }
+ }
+ }
+
+ if (unused.length) {
+ console.log('\nUnused keys:')
+ for (const k of unused) {
+ console.log(` - ${k}`)
+ }
+ } else {
+ console.log('\nNo unused keys detected.')
+ }
+
+ if (!QUIET) {
+ const ms = Date.now() - startTs
+ console.log(`\nDone in ${ms} ms`)
+ }
+
+ // Exit 0 even if there are unused keys (audit script).
+ // To fail CI when unused keys exist:
+ // process.exit(unused.length ? 1 : 0);
+}
+
+if (require.main === module) {
+ main()
+}