chore(workspace): move the app to apps/app under a pnpm workspace (step 2)

144 files moved with git mv (pure renames). Root package.json delegates
dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and
pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager,
root devDependency, engine-strict). Dockerfile builds @faunosteo/app on
node:24-alpine and copies apps/app/dist; nginx and runtime config
unchanged. CI workflow for Gitea Actions. packages/ reserved (README only).
Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan.
271/271 tests, typecheck, lint, build green from the root.
This commit is contained in:
bchanot committed 2026-10-08 21:51:13 +02:00
1 parent c8d48ab4cc
commit 8673475293
164 files changed
+348 -128

No files matched your search

+239
View File
@@ -0,0 +1,239 @@
import type { Dict } from './types'
export const en: Dict = {
'common.cancel': 'Cancel',
'common.close': 'Close',
'common.save': 'Save',
'common.confirm': 'Confirm',
'common.delete': 'Delete',
'common.add': 'Add',
'common.home': 'Home',
'common.understood': 'Got it',
'common.collapse': 'Collapse',
'common.expand': 'Expand',
'common.move_up': 'Move up',
'common.move_down': 'Move down',
'common.back_to_home': 'Back to home',
'home.new_report.title': 'New report',
'home.new_report.description': 'Start a new osteopathic report for an animal.',
'home.new_report.cta': 'Start',
'home.import.title': 'Import a PDF',
'home.import.description': 'Reopen a previous report generated by this app to follow up.',
'home.import.cta': 'Choose a PDF',
'home.import.loading': 'Reading…',
'home.import.error_generic': 'Failed to read the PDF.',
'home.import.error_invalid_pdf': 'This file is not a readable PDF.',
'home.import.error_no_attachment':
'This PDF was not generated by Faunosteo (no data detected).',
'home.import.error_incompatible_version':
'This PDF uses format v{version}, incompatible with the current version (v2). Re-export the report from a recent version of the app.',
// footer
'footer.all_rights_reserved': 'All rights reserved.',
'footer.powered_by': 'Powered by',
'footer.editors': 'Editors',
'footer.in_partnership': 'In partnership with',
// editors page
'editors.svg.title': 'SVG Editor',
'editors.svg.description':
'Annotate an anatomical SVG file: add clickable zones, categories, and FR/EN labels.',
'editors.svg.cta': 'Open',
'editors.pathology.title': 'Pathology Editor',
'editors.pathology.description':
'Create and edit the pathology catalog (JSON tree) for a species.',
'editors.pathology.cta': 'Open',
'not_found.title': 'Page not found',
'not_found.description': 'The requested path does not exist.',
'new_report.title': 'New report',
'new_report.date_label': 'Report date',
'new_report.submit': 'Start the report',
'editor.export': 'Export as PDF',
'editor.exporting': 'Generating…',
'editor.export_failed': 'PDF generation failed. Retry or contact support.',
'editor.edit_infos': 'Edit info',
'editor.edit_dialog_title': 'Edit information',
'editor.disclaimer_title': 'Legal scope of animal osteopathy',
'editor.detail_title_prefix': 'Detail — ',
'detail.click_to_add': 'Click the zones to add them to the current observation.',
'observation.section_title': 'Observations',
'observation.add': '+ New observation',
'observation.empty': 'No observation. Click "+ New observation" then on the zones in the diagram.',
'observation.badge_n': 'Observation #',
'observation.zone_label_singular': 'zone',
'observation.zone_label_plural': 'zones',
'observation.finding_label_singular': 'finding',
'observation.finding_label_plural': 'findings',
'observation.zones_label': 'Selected zones',
'observation.zones_empty': 'Click on the zones in the diagram to add them to this observation.',
'observation.findings_catalog_label': 'Findings (catalog)',
'observation.findings_pick_zone_first': 'Pick a zone to access the catalog.',
'observation.findings_no_catalog':
'No catalog available for these zones. Use the free text below.',
'observation.findings_free_label': 'Findings (free text)',
'observation.free_placeholder': 'Additional observation (free text)',
'observation.free_aria': 'Free observation',
'observation.severity_label': 'Severity',
'observation.comment_label': 'Comment',
'observation.comment_placeholder': 'Detailed clinical notes…',
'observation.vertebrae_button': 'Vertebrae…',
'observation.vertebrae_button_title': 'Specify vertebrae for this zone',
'observation.remove_zone': 'Remove',
'observation.expand_aria': 'Expand observation',
'observation.collapse_aria': 'Collapse observation',
'findings.back_to_parent': 'Back to previous level',
'findings.back': '← Back',
'findings.no_options': 'No option available at this level.',
'findings.open': 'Open',
'findings.vet_referral': 'Refer to a veterinarian',
'findings.selected_singular': 'finding selected',
'findings.selected_plural': 'findings selected',
'form.practitioner.legend': 'Practitioner',
'form.practitioner.name': 'Full name *',
'form.practitioner.cabinet': 'Practice / clinic',
'form.practitioner.contact': 'Contact (phone, email…)',
'form.practitioner.siret': 'SIRET',
'form.animal.legend': 'Animal & owner',
'form.animal.species': 'Species *',
'form.animal.name': 'Animal name *',
'form.animal.breed': 'Breed',
'form.animal.age': 'Age',
'form.owner.name': 'Owner name *',
'conclusion.section_title': 'Conclusion & recommendations',
'conclusion.conclusion': 'Conclusion',
'conclusion.recommendations': 'Recommendations',
'conclusion.next_appointment': 'Next appointment',
'conclusion.next_kind_date': 'Date',
'conclusion.next_kind_period': 'Free period',
'conclusion.next_kind_none': 'None',
'conclusion.next_period_placeholder': 'e.g. in 3 weeks',
'vertebra.title_prefix': 'Specify vertebrae — ',
'vertebra.region.C': 'Cervical',
'vertebra.region.T': 'Thoracic',
'vertebra.region.L': 'Lumbar',
'vertebra.region.S': 'Sacral',
'vertebra.region.Cd': 'Caudal',
'vertebra.check_all': 'Select all',
'vertebra.uncheck_all': 'Clear all',
// laterality
'lateral.which_side': 'Which side?',
'lateral.left': 'Left',
'lateral.right': 'Right',
'lateral.both': 'Both',
'lateral.left_short': 'L',
'lateral.right_short': 'R',
'severity.aria': 'Severity',
'severity.légère': 'mild',
'severity.modérée': 'moderate',
'severity.sévère': 'severe',
'pdf.eyebrow.observation': 'OBSERVATION',
'pdf.eyebrow.synthesis': 'SYNTHESIS',
'pdf.title.conclusion': 'Conclusion',
'pdf.section.zones': 'ZONES',
'pdf.section.findings_prefix': 'FINDINGS — ',
'pdf.section.free_findings': 'FREE FINDINGS',
'pdf.section.severity': 'SEVERITY',
'pdf.section.comment': 'COMMENT',
'pdf.section.conclusion': 'CONCLUSION',
'pdf.section.recommendations': 'RECOMMENDATIONS',
'pdf.section.next_appointment': 'NEXT APPOINTMENT',
'pdf.view.general': 'GENERAL VIEW',
'pdf.view.detail_prefix': 'DETAIL VIEW — ',
'pdf.empty': '—',
'pdf.owner_prefix': 'Owner: ',
'pdf.siret_prefix': 'SIRET ',
'pdf.title.suffix.bilan': 'Osteo report — ',
'pdf.subject': 'Animal osteopathic report',
'lang.group_label': 'Language',
'lang.switch_to_fr': 'Passer en français',
'lang.switch_to_en': 'Switch to English',
'lang.fr': 'FR',
'lang.en': 'EN',
// svg editor
'svg_editor.title': 'SVG Anatomy Editor',
'svg_editor.subtitle': 'Points, zones & clickable categories',
'svg_editor.file': 'File',
'svg_editor.choose_file': 'Choose an SVG file',
'svg_editor.change_file': 'Change SVG file',
'svg_editor.export': 'Export SVG',
'svg_editor.mode': 'Mode',
'svg_editor.mode_select': 'Select / move',
'svg_editor.mode_point': 'Add point',
'svg_editor.mode_polygon': 'Add polygon',
'svg_editor.validate_polygon': 'Validate polygon (Enter)',
'svg_editor.cancel_polygon': 'Cancel (Esc)',
'svg_editor.category_for_new': 'Category for new elements',
'svg_editor.categories': 'Categories',
'svg_editor.shared_color': '(shared color)',
'svg_editor.category_placeholder': 'Category name',
'svg_editor.selected_element': 'Selected element',
'svg_editor.opens_detail': 'This zone opens a detail view',
'svg_editor.detail_id_label': 'Detail view ID (e.g. head, front-leg)',
'svg_editor.detail_id_placeholder': 'head',
'svg_editor.name_fr': 'French name',
'svg_editor.name_fr_placeholder': 'e.g. Hanche',
'svg_editor.name_en': 'English name',
'svg_editor.name_en_placeholder': 'e.g. Hip joint',
'svg_editor.category': 'Category',
'svg_editor.radius': 'Radius (circle)',
'svg_editor.fill_opacity': 'Fill opacity',
'svg_editor.polygon_editing': 'Polygon editing:',
'svg_editor.polygon_drag': 'Drag a yellow handle to move it',
'svg_editor.polygon_insert': 'Click a white mid-handle to insert a vertex',
'svg_editor.polygon_delete': 'Alt+click or right-click a yellow handle to delete it',
'svg_editor.redraw_polygon': 'Redraw this polygon',
'svg_editor.delete': 'Delete',
'svg_editor.elements': 'Elements',
'svg_editor.filter_placeholder': 'Filter...',
'svg_editor.welcome_title': 'SVG Anatomy Editor',
'svg_editor.welcome_text': 'Upload an SVG file to begin. If your file already has points/zones with ',
'svg_editor.welcome_text_suffix': ', they will be detected and configured automatically.',
'svg_editor.welcome_drag_hint': 'or drag & drop an SVG file anywhere',
'svg_editor.no_categories': 'No categories yet. Use the form below to add one.',
'svg_editor.new_point_fr': 'Nouveau point',
'svg_editor.new_point_en': 'New point',
'svg_editor.new_zone_fr': 'Nouvelle zone',
'svg_editor.new_zone_en': 'New zone',
'svg_editor.alert_drop_svg': 'Drop an SVG file.',
'svg_editor.alert_invalid_svg': 'Invalid file: no SVG element found.',
'svg_editor.alert_min_3': 'Need at least 3 points.',
'svg_editor.alert_min_3_vertices': 'A polygon must have at least 3 vertices.',
'svg_editor.alert_upload_first': 'Upload an SVG first.',
'svg_editor.alert_no_svg_loaded': 'No SVG loaded. Upload a file first.',
'svg_editor.alert_cat_name_required': 'Give the category a name.',
'svg_editor.alert_cat_invalid_name': 'Invalid name.',
'svg_editor.alert_cat_exists': 'This category already exists.',
'svg_editor.confirm_delete_element': 'Delete this element?',
'svg_editor.confirm_delete_cat': 'Delete category "{name}"?',
'svg_editor.confirm_delete_cat_count': '\n\nIt contains {count} element(s) that will also be deleted.',
'svg_editor.confirm_redraw': 'Erase this polygon and redraw it?',
'svg_editor.handle_drag': 'Drag to move | Alt+click or right-click to delete',
'svg_editor.handle_insert': 'Click to insert a vertex here',
'svg_editor.polygon_vertices': 'polygon ({count} vertices)',
'svg_editor.drop_svg_here': 'Drop SVG here',
'svg_editor.lateral': 'Laterality',
'svg_editor.lateral_unpaired': 'Unilateral (no side)',
'svg_editor.lateral_bilateral': 'Bilateral (left / right)',
'svg_editor.source_project': 'Project SVGs',
'svg_editor.source_upload': 'Upload a file',
'svg_editor.species': 'Species',
'svg_editor.view': 'View',
'svg_editor.view_main': 'Full body',
'svg_editor.view_detail': 'Detail: {name}',
'svg_editor.load': 'Load',
}
+256
View File
@@ -0,0 +1,256 @@
import type { Dict } from './types'
export const fr: Dict = {
// common
'common.cancel': 'Annuler',
'common.close': 'Fermer',
'common.save': 'Enregistrer',
'common.confirm': 'Valider',
'common.delete': 'Supprimer',
'common.add': 'Ajouter',
'common.home': 'Accueil',
'common.understood': 'Compris',
'common.collapse': 'Réduire',
'common.expand': 'Développer',
'common.move_up': 'Monter',
'common.move_down': 'Descendre',
'common.back_to_home': "Retour à l'accueil",
// home
'home.new_report.title': 'Nouveau bilan',
'home.new_report.description': "Démarrer un nouveau bilan d'ostéopathie sur un animal.",
'home.new_report.cta': 'Commencer',
'home.import.title': 'Importer un PDF',
'home.import.description':
"Reprendre un bilan précédent généré par cette application pour effectuer un suivi.",
'home.import.cta': 'Choisir un PDF',
'home.import.loading': 'Lecture…',
'home.import.error_generic': 'Erreur de lecture du PDF.',
'home.import.error_invalid_pdf':
"Ce fichier n'est pas un PDF lisible.",
'home.import.error_no_attachment':
"Ce PDF n'a pas été généré par Faunosteo (pas de données détectées).",
'home.import.error_incompatible_version':
"Ce PDF est au format v{version}, incompatible avec la version actuelle (v2). Réexportez le bilan depuis une version récente de l'application.",
// footer
'footer.all_rights_reserved': 'Tous droits réservés.',
'footer.powered_by': 'Propulsé par',
'footer.editors': 'Éditeurs',
'footer.in_partnership': 'En partenariat avec',
// editors page
'editors.svg.title': 'Éditeur SVG',
'editors.svg.description':
'Annoter un fichier SVG anatomique : ajouter des zones cliquables, catégories et labels FR/EN.',
'editors.svg.cta': 'Ouvrir',
'editors.pathology.title': 'Éditeur de pathologies',
'editors.pathology.description':
'Créer et modifier le référentiel de pathologies (arbre JSON) pour une espèce.',
'editors.pathology.cta': 'Ouvrir',
// not found
'not_found.title': 'Page introuvable',
'not_found.description': "Le chemin demandé n'existe pas.",
// new report
'new_report.title': 'Nouveau bilan',
'new_report.date_label': 'Date du bilan',
'new_report.submit': 'Démarrer le bilan',
// editor
'editor.export': 'Exporter en PDF',
'editor.exporting': 'Génération…',
'editor.export_failed': 'Échec de la génération du PDF. Réessayez ou contactez le support.',
'editor.edit_infos': 'Modifier les infos',
'editor.edit_dialog_title': 'Modifier les informations',
'editor.disclaimer_title': "Périmètre légal de l'ostéopathie animale",
'editor.detail_title_prefix': 'Détail — ',
// detail modal
'detail.click_to_add': "Cliquez sur les zones pour les ajouter à l'observation en cours.",
// observation list / card
'observation.section_title': 'Observations',
'observation.add': '+ Nouvelle observation',
'observation.empty':
'Aucune observation. Cliquez sur "+ Nouvelle observation" puis sur les zones du schéma.',
'observation.badge_n': 'Observation #',
'observation.zone_label_singular': 'zone',
'observation.zone_label_plural': 'zones',
'observation.finding_label_singular': 'constat',
'observation.finding_label_plural': 'constats',
'observation.zones_label': 'Zones sélectionnées',
'observation.zones_empty': 'Cliquez sur les zones du schéma pour les ajouter à cette observation.',
'observation.findings_catalog_label': 'Constats (référentiel)',
'observation.findings_pick_zone_first': 'Sélectionnez une zone pour accéder au référentiel.',
'observation.findings_no_catalog':
'Aucun référentiel disponible pour ces zones. Utilisez le texte libre ci-dessous.',
'observation.findings_free_label': 'Constats (texte libre)',
'observation.free_placeholder': 'Observation additionnelle (texte libre)',
'observation.free_aria': 'Observation libre',
'observation.severity_label': 'Sévérité',
'observation.comment_label': 'Commentaire',
'observation.comment_placeholder': 'Notes cliniques détaillées…',
'observation.vertebrae_button': 'Vertèbres…',
'observation.vertebrae_button_title': 'Préciser les vertèbres pour cette zone',
'observation.remove_zone': 'Retirer',
'observation.expand_aria': "Développer l'observation",
'observation.collapse_aria': "Réduire l'observation",
// findings tree picker
'findings.back_to_parent': 'Retour au niveau précédent',
'findings.back': '← Retour',
'findings.no_options': 'Aucune option disponible à ce niveau.',
'findings.open': 'Ouvrir',
'findings.vet_referral': 'Référer au vétérinaire',
'findings.selected_singular': 'constat sélectionné',
'findings.selected_plural': 'constats sélectionnés',
// forms
'form.practitioner.legend': 'Praticien',
'form.practitioner.name': 'Nom complet *',
'form.practitioner.cabinet': 'Cabinet / clinique',
'form.practitioner.contact': 'Contact (téléphone, email…)',
'form.practitioner.siret': 'SIRET',
'form.animal.legend': 'Animal & propriétaire',
'form.animal.species': 'Espèce *',
'form.animal.name': "Nom de l'animal *",
'form.animal.breed': 'Race',
'form.animal.age': 'Âge',
'form.owner.name': 'Nom du propriétaire *',
// conclusion panel
'conclusion.section_title': 'Conclusion & recommandations',
'conclusion.conclusion': 'Conclusion',
'conclusion.recommendations': 'Recommandations',
'conclusion.next_appointment': 'Prochain rendez-vous',
'conclusion.next_kind_date': 'Date',
'conclusion.next_kind_period': 'Période libre',
'conclusion.next_kind_none': 'Aucun',
'conclusion.next_period_placeholder': 'ex. dans 3 semaines',
// vertebra picker
'vertebra.title_prefix': 'Préciser les vertèbres — ',
'vertebra.region.C': 'Cervicales',
'vertebra.region.T': 'Thoraciques',
'vertebra.region.L': 'Lombaires',
'vertebra.region.S': 'Sacrales',
'vertebra.region.Cd': 'Caudales',
'vertebra.check_all': 'Tout cocher',
'vertebra.uncheck_all': 'Tout décocher',
// laterality
'lateral.which_side': 'Quel côté ?',
'lateral.left': 'Gauche',
'lateral.right': 'Droite',
'lateral.both': 'Les deux',
'lateral.left_short': 'G',
'lateral.right_short': 'D',
// severity
'severity.aria': 'Sévérité',
'severity.légère': 'légère',
'severity.modérée': 'modérée',
'severity.sévère': 'sévère',
// pdf
'pdf.eyebrow.observation': 'OBSERVATION',
'pdf.eyebrow.synthesis': 'SYNTHÈSE',
'pdf.title.conclusion': 'Conclusion',
'pdf.section.zones': 'ZONES',
'pdf.section.findings_prefix': 'CONSTATS — ',
'pdf.section.free_findings': 'CONSTATS LIBRES',
'pdf.section.severity': 'SÉVÉRITÉ',
'pdf.section.comment': 'COMMENTAIRE',
'pdf.section.conclusion': 'CONCLUSION',
'pdf.section.recommendations': 'RECOMMANDATIONS',
'pdf.section.next_appointment': 'PROCHAIN RENDEZ-VOUS',
'pdf.view.general': 'VUE GÉNÉRALE',
'pdf.view.detail_prefix': 'VUE DÉTAIL — ',
'pdf.empty': '—',
'pdf.owner_prefix': 'Propriétaire : ',
'pdf.siret_prefix': 'SIRET ',
'pdf.title.suffix.bilan': 'Bilan ostéo — ',
'pdf.subject': "Bilan d'ostéopathie animalière",
// language switcher
'lang.group_label': 'Langue',
'lang.switch_to_fr': 'Passer en français',
'lang.switch_to_en': 'Switch to English',
'lang.fr': 'FR',
'lang.en': 'EN',
// svg editor
'svg_editor.title': 'Editeur SVG anatomique',
'svg_editor.subtitle': 'Points, zones & catégories cliquables',
'svg_editor.file': 'Fichier',
'svg_editor.choose_file': 'Choisir un fichier SVG',
'svg_editor.change_file': 'Changer de fichier SVG',
'svg_editor.export': 'Exporter le SVG',
'svg_editor.mode': 'Mode',
'svg_editor.mode_select': 'Sélectionner / déplacer',
'svg_editor.mode_point': 'Ajouter un point',
'svg_editor.mode_polygon': 'Ajouter un polygone',
'svg_editor.validate_polygon': 'Valider le polygone (Entrée)',
'svg_editor.cancel_polygon': 'Annuler (Echap)',
'svg_editor.category_for_new': 'Catégorie des nouveaux éléments',
'svg_editor.categories': 'Catégories',
'svg_editor.shared_color': '(couleur partagée)',
'svg_editor.category_placeholder': 'Nom de catégorie',
'svg_editor.selected_element': 'Elément sélectionné',
'svg_editor.opens_detail': 'Cette zone ouvre une vue détaillée',
'svg_editor.detail_id_label': 'ID vue détaillée (ex. head, front-leg)',
'svg_editor.detail_id_placeholder': 'head',
'svg_editor.name_fr': 'Nom français',
'svg_editor.name_fr_placeholder': 'ex: Hanche',
'svg_editor.name_en': 'Nom anglais',
'svg_editor.name_en_placeholder': 'ex: Hip joint',
'svg_editor.category': 'Catégorie',
'svg_editor.radius': 'Rayon (cercle)',
'svg_editor.fill_opacity': 'Opacité du remplissage',
'svg_editor.polygon_editing': 'Edition du polygone :',
'svg_editor.polygon_drag': 'Glissez une poignée jaune pour la déplacer',
'svg_editor.polygon_insert': 'Cliquez une poignée blanche pour insérer un sommet',
'svg_editor.polygon_delete': 'Alt+clic ou clic droit sur une poignée jaune pour la supprimer',
'svg_editor.redraw_polygon': 'Redessiner ce polygone',
'svg_editor.delete': 'Supprimer',
'svg_editor.elements': 'Eléments',
'svg_editor.filter_placeholder': 'Filtrer...',
'svg_editor.welcome_title': 'Editeur SVG anatomique',
'svg_editor.welcome_text': 'Importez un fichier SVG pour commencer. Si votre fichier contient déjà des points/zones avec ',
'svg_editor.welcome_text_suffix': ', ils seront détectés et configurés automatiquement.',
'svg_editor.welcome_drag_hint': 'ou glissez-déposez un fichier SVG n\'importe où',
'svg_editor.no_categories': 'Aucune catégorie. Utilisez le formulaire ci-dessous pour en ajouter une.',
'svg_editor.new_point_fr': 'Nouveau point',
'svg_editor.new_point_en': 'New point',
'svg_editor.new_zone_fr': 'Nouvelle zone',
'svg_editor.new_zone_en': 'New zone',
'svg_editor.alert_drop_svg': 'Déposez un fichier SVG.',
'svg_editor.alert_invalid_svg': 'Fichier invalide : aucun élément SVG trouvé.',
'svg_editor.alert_min_3': 'Il faut au moins 3 points.',
'svg_editor.alert_min_3_vertices': 'Un polygone doit avoir au moins 3 sommets.',
'svg_editor.alert_upload_first': 'Importez d\'abord un SVG.',
'svg_editor.alert_no_svg_loaded': 'Aucun SVG chargé. Importez d\'abord un fichier.',
'svg_editor.alert_cat_name_required': 'Donnez un nom à la catégorie.',
'svg_editor.alert_cat_invalid_name': 'Nom invalide.',
'svg_editor.alert_cat_exists': 'Cette catégorie existe déjà.',
'svg_editor.confirm_delete_element': 'Supprimer cet élément ?',
'svg_editor.confirm_delete_cat': 'Supprimer la catégorie "{name}" ?',
'svg_editor.confirm_delete_cat_count': '\n\nElle contient {count} élément(s) qui seront aussi supprimés.',
'svg_editor.confirm_redraw': 'Effacer ce polygone et le redessiner ?',
'svg_editor.handle_drag': 'Glisser pour déplacer | Alt+clic ou clic droit pour supprimer',
'svg_editor.handle_insert': 'Cliquez pour insérer un sommet ici',
'svg_editor.polygon_vertices': 'polygone ({count} sommets)',
'svg_editor.drop_svg_here': 'Déposez le SVG ici',
'svg_editor.lateral': 'Latéralité',
'svg_editor.lateral_unpaired': 'Unilatéral (pas de côté)',
'svg_editor.lateral_bilateral': 'Bilatéral (gauche / droite)',
'svg_editor.source_project': 'SVG du projet',
'svg_editor.source_upload': 'Importer un fichier',
'svg_editor.species': 'Espèce',
'svg_editor.view': 'Vue',
'svg_editor.view_main': 'Corps entier',
'svg_editor.view_detail': 'Détail : {name}',
'svg_editor.load': 'Charger',
}
+9
View File
@@ -0,0 +1,9 @@
import { fr } from './fr'
import { en } from './en'
import type { Dict, Locale } from './types'
export const dicts: Record<Locale, Dict> = { fr, en }
export function getDict(locale: Locale): Dict {
return dicts[locale]
}
+16
View File
@@ -0,0 +1,16 @@
import type { Locale } from './types'
/**
* Resolves a bilingual label for the active locale. Falls back to the
* opposite language when the preferred one is missing/empty, then to the
* provided fallback, so callers never render an empty string.
*/
export function pickLocaleLabel(
fr: string | undefined,
en: string | undefined,
locale: Locale,
fallback = '',
): string {
if (locale === 'en') return en || fr || fallback
return fr || en || fallback
}
+2
View File
@@ -0,0 +1,2 @@
export type Locale = 'fr' | 'en'
export type Dict = Record<string, string>
+17
View File
@@ -0,0 +1,17 @@
import { useLocaleStore } from '@/state/localeStore'
import { getDict } from './index'
export function useT(): (key: string) => string {
const locale = useLocaleStore((s) => s.locale)
const dict = getDict(locale)
return (key: string) => {
const v = dict[key]
if (v === undefined) {
if (import.meta.env?.DEV) {
console.warn(`i18n: missing key "${key}" for locale "${locale}"`)
}
return key
}
return v
}
}