Feat: intégration multilingue FR/EN (i18n)
All checks were successful
Deploy / Deploy to Production (push) Successful in 18s
All checks were successful
Deploy / Deploy to Production (push) Successful in 18s
- Ajout de src/i18n/index.js : dictionnaire centralisé + fonction t(key, vars) - Ajout de LanguageSwitcher.svelte : toggle FR/EN avec persistance localStorage - Router : normalizePath strip /en/, apiPrefix() pour les fetches, détection langue (URL > localStorage > navigator) - Tous les composants (Header, Menu, Footer, Article, Blog, Play) migrent vers t() depuis @i18n - Blog : navigation interne (fetch, history, getSlugFromUrl) locale-aware Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3bd410cc02
commit
517143fe60
11 changed files with 162 additions and 59 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* Reçoit les données article via props, pas via le slide system.
|
||||
*/
|
||||
import Footer from '@components/layout/Footer.svelte'
|
||||
import { t } from '@i18n'
|
||||
|
||||
let { data, onBack } = $props()
|
||||
|
||||
|
|
@ -25,27 +26,27 @@
|
|||
|
||||
<!-- Date + share buttons -->
|
||||
<div class="article-topbar">
|
||||
<time class="article-date">Publié le {data.published}</time>
|
||||
<time class="article-date">{t('published_on')} {data.published}</time>
|
||||
<div class="article-share">
|
||||
{#if copySuccess}
|
||||
<span class="copy-toast">Lien copié !</span>
|
||||
<span class="copy-toast">{t('link_copied')}</span>
|
||||
{/if}
|
||||
<div class="share-buttons">
|
||||
<!-- svelte-ignore a11y_invalid_attribute -->
|
||||
<a href="#" class="share-button" title="Copier le lien" onclick={(e) => { e.preventDefault(); copyLink() }}>
|
||||
<img src="/assets/icons/link-icon.svg" alt="Copier le lien" width="20" height="20" />
|
||||
<a href="#" class="share-button" title={t('copy_link')} onclick={(e) => { e.preventDefault(); copyLink() }}>
|
||||
<img src="/assets/icons/link-icon.svg" alt={t('copy_link')} width="20" height="20" />
|
||||
</a>
|
||||
<a href="https://api.whatsapp.com/send?text={shareUrl}" target="_blank" rel="noopener noreferrer" class="share-button">
|
||||
<img src="/assets/icons/whatsapp-icon.svg" alt="Partager sur WhatsApp" width="20" height="20" />
|
||||
<img src="/assets/icons/whatsapp-icon.svg" alt={t('share_whatsapp')} width="20" height="20" />
|
||||
</a>
|
||||
<a href="https://twitter.com/intent/tweet?url={shareUrl}" target="_blank" rel="noopener noreferrer" class="share-button">
|
||||
<img src="/assets/icons/twitter-icon.svg" alt="Partager sur X" width="20" height="20" />
|
||||
<img src="/assets/icons/twitter-icon.svg" alt={t('share_x')} width="20" height="20" />
|
||||
</a>
|
||||
<a href="https://www.facebook.com/sharer/sharer.php?u={shareUrl}" target="_blank" rel="noopener noreferrer" class="share-button">
|
||||
<img src="/assets/icons/facebook-icon.svg" alt="Partager sur Facebook" width="20" height="20" />
|
||||
<img src="/assets/icons/facebook-icon.svg" alt={t('share_facebook')} width="20" height="20" />
|
||||
</a>
|
||||
<a href="https://www.linkedin.com/sharing/share-offsite/?url={shareUrl}" target="_blank" rel="noopener noreferrer" class="share-button">
|
||||
<img src="/assets/icons/linkedin-icon.svg" alt="Partager sur LinkedIn" width="20" height="20" />
|
||||
<img src="/assets/icons/linkedin-icon.svg" alt={t('share_linkedin')} width="20" height="20" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -74,23 +75,23 @@
|
|||
<!-- Share section (bas d'article) -->
|
||||
<div class="article-share-section">
|
||||
<hr class="share-divider" />
|
||||
<p class="share-label">Partager cet article</p>
|
||||
<p class="share-label">{t('share_article')}</p>
|
||||
<div class="share-buttons">
|
||||
<!-- svelte-ignore a11y_invalid_attribute -->
|
||||
<a href="#" class="share-button" title="Copier le lien" onclick={(e) => { e.preventDefault(); copyLink() }}>
|
||||
<img src="/assets/icons/link-icon.svg" alt="Copier le lien" width="20" height="20" />
|
||||
<a href="#" class="share-button" title={t('copy_link')} onclick={(e) => { e.preventDefault(); copyLink() }}>
|
||||
<img src="/assets/icons/link-icon.svg" alt={t('copy_link')} width="20" height="20" />
|
||||
</a>
|
||||
<a href="https://api.whatsapp.com/send?text={shareUrl}" target="_blank" rel="noopener noreferrer" class="share-button">
|
||||
<img src="/assets/icons/whatsapp-icon.svg" alt="Partager sur WhatsApp" width="20" height="20" />
|
||||
<img src="/assets/icons/whatsapp-icon.svg" alt={t('share_whatsapp')} width="20" height="20" />
|
||||
</a>
|
||||
<a href="https://twitter.com/intent/tweet?url={shareUrl}" target="_blank" rel="noopener noreferrer" class="share-button">
|
||||
<img src="/assets/icons/twitter-icon.svg" alt="Partager sur X" width="20" height="20" />
|
||||
<img src="/assets/icons/twitter-icon.svg" alt={t('share_x')} width="20" height="20" />
|
||||
</a>
|
||||
<a href="https://www.facebook.com/sharer/sharer.php?u={shareUrl}" target="_blank" rel="noopener noreferrer" class="share-button">
|
||||
<img src="/assets/icons/facebook-icon.svg" alt="Partager sur Facebook" width="20" height="20" />
|
||||
<img src="/assets/icons/facebook-icon.svg" alt={t('share_facebook')} width="20" height="20" />
|
||||
</a>
|
||||
<a href="https://www.linkedin.com/sharing/share-offsite/?url={shareUrl}" target="_blank" rel="noopener noreferrer" class="share-button">
|
||||
<img src="/assets/icons/linkedin-icon.svg" alt="Partager sur LinkedIn" width="20" height="20" />
|
||||
<img src="/assets/icons/linkedin-icon.svg" alt={t('share_linkedin')} width="20" height="20" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -98,7 +99,7 @@
|
|||
<!-- Articles recommandés -->
|
||||
{#if data.related?.length}
|
||||
<section class="article-related">
|
||||
<h2>Nos recommandations</h2>
|
||||
<h2>{t('related')}</h2>
|
||||
<div class="article-related-grid">
|
||||
{#each data.related as rec}
|
||||
<a href="/blog/{rec.slug}" class="article-related-card">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue