Implement Astro features: React Islands, Server Endpoints, i18n, Partytown
Features added: - React integration with @astrojs/react - React components: DMRDashboard, MemberSearch - API endpoints: /api/repeaters.json, /api/dmr-contacts.json, /api/feed/[category].xml - i18n support for TR/EN locales with LanguageSwitcher component - Partytown enabled for third-party script optimization - Admin panel logo fixed (moved to public/images/) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
---
|
||||
const { currentLocale } = Astro.params;
|
||||
const locales = ['tr', 'en'];
|
||||
const path = Astro.url.pathname;
|
||||
|
||||
function getLocalePath(locale: string) {
|
||||
// Remove locale prefix from current path
|
||||
const cleanPath = path.replace(/^\/(tr|en)\//, '/');
|
||||
return locale === 'tr' ? cleanPath : `/en${cleanPath}`;
|
||||
}
|
||||
---
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
{locales.map(locale => (
|
||||
<a
|
||||
href={getLocalePath(locale)}
|
||||
class={`px-3 py-1 rounded-lg text-sm font-medium transition-colors ${
|
||||
currentLocale === locale
|
||||
? 'bg-blue-600 text-white'
|
||||
: 'bg-gray-200 text-gray-700 hover:bg-gray-300'
|
||||
}`}
|
||||
aria-label={`Switch to ${locale === 'tr' ? 'Turkish' : 'English'}`}
|
||||
>
|
||||
{locale === 'tr' ? 'TR' : 'EN'}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
Reference in New Issue
Block a user