Skip to content

Commit c3298bb

Browse files
DavidKRKCopilotCopilot
authored
feat: localize YouTube "view all videos" button (#173)
* feat: localize YouTube "view all videos" button Agent-Logs-Url: https://github.com/DavidKRK/DavidKRK.github.io/sessions/dcf70b48-1135-44bd-ac4e-03d97467e100 Co-authored-by: DavidKRK <136035295+DavidKRK@users.noreply.github.com> * Update .github/workflows/youtube-section-update.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update music.html Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: call switchLanguage on init and clean up unused langContent keys Agent-Logs-Url: https://github.com/DavidKRK/DavidKRK.github.io/sessions/b51d1e6d-60fe-4182-8214-12306892cf61 Co-authored-by: DavidKRK <136035295+DavidKRK@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent e7e2a39 commit c3298bb

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/youtube-section-update.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ jobs:
5454
5555
channel_link = ('<a href="https://www.youtube.com/@DavidKRKofficial"'
5656
' target="_blank" rel="noopener noreferrer"'
57-
' class="yt-channel-link">&#127909; Voir toutes les videos sur YouTube</a>')
57+
' class="yt-channel-link">&#127909; <span id="youtube-btn-text">Voir toutes les vidéos</span></a>')
5858
5959
youtube_block = (
6060
'<!-- YOUTUBE-AUTO-START -->\n'
61+
' <h2 id="youtube-section-title">YouTube</h2>\n'
6162
' <div class="yt-grid">\n'
6263
' ' + channel_link + '\n'
6364
' <div class="yt-cards">' + cards + '</div>\n'

music.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ <h3><i class="fab fa-youtube" style="color:#ff0000;"></i> Dernières vidéos You
141141
<div style="margin-top:1.2rem;">
142142
<a href="https://www.youtube.com/@DavidKRKofficial" target="_blank" rel="noopener noreferrer"
143143
style="display:inline-flex;align-items:center;gap:0.5rem;background:#ff0000;color:#fff;padding:0.6rem 1.4rem;border-radius:6px;font-family:'Russo One',sans-serif;font-size:0.9rem;text-decoration:none;transition:background 0.2s;">
144-
<i class="fab fa-youtube"></i> Voir toutes les vidéos
144+
<i class="fab fa-youtube"></i> <span id="youtube-btn-text">Voir toutes les vidéos</span>
145145
</a>
146146
</div>
147147
</section>
@@ -205,6 +205,15 @@ <h3><i class="fab fa-youtube" style="color:#ff0000;"></i> Dernières vidéos You
205205
const langBtns = document.querySelectorAll('.language-btn');
206206
const langContents = document.querySelectorAll('.lang-content');
207207

208+
const langContent = {
209+
fr: { youtube_button: 'Voir toutes les vidéos' },
210+
en: { youtube_button: 'View all videos' },
211+
es: { youtube_button: 'Ver todos los vídeos' },
212+
eu: { youtube_button: 'Ikusi bideo guztiak' },
213+
ar: { youtube_button: 'عرض جميع مقاطع الفيديو' },
214+
uk: { youtube_button: 'Переглянути всі відео' }
215+
};
216+
208217
function switchLanguage(lang) {
209218
langContents.forEach(content => content.classList.remove('active'));
210219
langBtns.forEach(b => b.classList.remove('active'));
@@ -216,13 +225,19 @@ <h3><i class="fab fa-youtube" style="color:#ff0000;"></i> Dernières vidéos You
216225
if (activeBtn) {
217226
activeBtn.classList.add('active');
218227
}
228+
229+
const t = langContent[lang] || langContent['fr'];
230+
const btnEl = document.getElementById('youtube-btn-text');
231+
if (btnEl) btnEl.textContent = t.youtube_button;
219232
}
220233

221234
langBtns.forEach(btn => {
222235
btn.addEventListener('click', () => {
223236
switchLanguage(btn.dataset.lang);
224237
});
225238
});
239+
240+
switchLanguage('fr');
226241
});
227242
</script>
228243
</body>

0 commit comments

Comments
 (0)