source: Klonkt/src/views/partials/view-switcher.ejs@ f6c414e

main
Last change on this file since f6c414e was 03fa548, checked in by roboburr <roboburr@…>, 3 months ago

feat(i18n): interface language NL/EN/DE with visitor switcher (phase 1: chrome)

  • i18n.js (t helper + nl/en/de dictionary + resolveLang: session → browser → nl).
  • render.js passes t/lang/langs to all views; /lang/:code sets the language in the session.
  • Language switcher (select) in the footer; chrome translated: topnav (Archive/Login/Account/Admin/Logout/…), pill (Agenda/Solo/Circle/Timeline/Grid), post nav (Newer/Older), footer.
  • Content (posts/site name/bio) stays in the author's language. Admin + deeper page strings follow in a next phase.

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 4.1 KB
RevLine 
[7bc636b]1<%# View switcher partial — Tijdlijn / Grid + grid-cols picker.
2 Mounted in shell.ejs once, visible on every non-admin page. Click
3 handlers are wired in shell.ejs via event-delegation on document so
4 HTMX-swapped content keeps working without rebinding. %>
[4dcefa1]5<%
6 var _bc = (typeof bodyClass === 'string') ? bodyClass : '';
7 var _onShows = _bc.indexOf('on-shows') >= 0;
8 // Pagina's zonder actieve feed-weergave → niets in de pill is 'actief' (Solo/Cirkel
9 // + Tijdlijn/Grid grijs). Alleen Agenda krijgt z'n eigen is-active op de agenda.
10 var _neutral = ['on-shows','on-downloads','on-post','on-epk','on-linkbio','on-newsletter','on-archive']
11 .some(function(c){ return _bc.indexOf(c) >= 0; });
12%>
[7bc636b]13<div class="view-switcher-wrap">
14 <div class="container">
[1eff06a]15 <% if (typeof premiumUnlocked !== 'undefined' && premiumUnlocked && typeof agendaEnabled !== 'undefined' && agendaEnabled) {
16 var _sbA = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
17 %>
18 <div class="agenda-pill">
[4dcefa1]19 <a class="vs-agenda<%= _onShows ? ' is-active' : '' %>" href="<%= _sbA %>/shows" aria-label="Agenda — evenementen">
[1eff06a]20 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>
[03fa548]21 <span><%= t('switch.agenda') %></span>
[1eff06a]22 </a>
23 </div>
24 <% } %>
[9f81a09]25 <% if (typeof tenancy !== 'undefined' && tenancy === 'circle') {
26 var _onCirkel = (typeof bodyClass === 'string' && bodyClass.indexOf('on-cirkel') >= 0);
27 var _sb = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
28 %>
29 <div class="feed-scope" role="tablist" aria-label="Solo of cirkel">
[4dcefa1]30 <a class="feed-scope-btn<%= (!_neutral && !_onCirkel) ? ' is-active' : '' %>" href="<%= _sb %>/"
[03fa548]31 role="tab" aria-selected="<%= (!_neutral && !_onCirkel) ? 'true' : 'false' %>"><%= t('switch.solo') %></a>
[4dcefa1]32 <a class="feed-scope-btn<%= (!_neutral && _onCirkel) ? ' is-active' : '' %>" href="<%= _sb %>/cirkel"
[03fa548]33 role="tab" aria-selected="<%= (!_neutral && _onCirkel) ? 'true' : 'false' %>"><%= t('switch.circle') %></a>
[9f81a09]34 </div>
35 <% } %>
[7bc636b]36 <div class="view-switcher" role="tablist" aria-label="Weergave">
37 <button type="button" class="view-switch-btn" data-view="timeline" role="tab"
[1c6d61c]38 aria-selected="<%= (!_neutral && !(typeof site !== 'undefined' && site && site.feed_view_default === 'grid')) ? 'true' : 'false' %>">
[7bc636b]39 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
[03fa548]40 <span><%= t('switch.timeline') %></span>
[7bc636b]41 </button>
42 <button type="button" class="view-switch-btn" data-view="grid" role="tab"
[1c6d61c]43 aria-selected="<%= (!_neutral && (typeof site !== 'undefined' && site && site.feed_view_default === 'grid')) ? 'true' : 'false' %>">
[7bc636b]44 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>
[03fa548]45 <span><%= t('switch.grid') %></span>
[7bc636b]46 </button>
47 </div>
[4dcefa1]48 <% if (!_neutral) { %>
[7bc636b]49 <div class="grid-cols-picker" aria-label="Aantal kolommen">
50 <button type="button" class="grid-cols-btn" data-cols="2" title="2 kolommen">2</button>
51 <button type="button" class="grid-cols-btn" data-cols="3" title="3 kolommen">3</button>
52 <button type="button" class="grid-cols-btn" data-cols="4" title="4 kolommen">4</button>
53 </div>
[4dcefa1]54 <% } %>
[7bc636b]55 </div>
56</div>
Note: See TracBrowser for help on using the repository browser.