This is the official website for AstroIndexer with automatic language detection and support for English and German.
The website automatically detects the user's preferred language based on:
- Saved preference (localStorage)
- URL parameter (?lang=de or ?lang=en)
- Browser language settings
- Timezone/location (fallback detection for German-speaking countries)
- Clean dropdown UI in the navigation bar
- Instant language switching without page reload
- Saves user preference for future visits
- Visual indicators for current language
- Mobile-friendly layout
- Adaptive navigation menu
- Optimized for all screen sizes
- English (en) - Default
- German (de)
website/
├── index.html # Main HTML file with data-i18n attributes
├── css/
│ ├── style.css # Main styles
│ └── language-switcher.css # Language switcher styles
├── js/
│ └── languages.js # Translation system and language detection
└── images/ # Website images and assets
- Check localStorage for saved preference
- Check URL parameter (?lang=)
- Detect from browser language (navigator.language)
- Check browser languages array
- Detect from timezone (for German-speaking regions)
All translations are stored in js/languages.js. To add new text:
translations.en.newSection = {
title: "English Title",
description: "English description"
};
translations.de.newSection = {
title: "Deutscher Titel",
description: "Deutsche Beschreibung"
};Add the data-i18n attribute to any element:
<h1 data-i18n="hero.title">Default Text</h1>
<p data-i18n="hero.description">Default description</p>- Create/Update the repository
astroindexerweb - Copy all files from the website folder
- Enable GitHub Pages in repository settings
- Custom domain (if using astroindexer.com):
- Add CNAME file with
astroindexer.com - Configure DNS settings
- Add CNAME file with
The contact modal in index.html posts to:
https://api.astroindexer.com/api/contact
If api.astroindexer.com is not yet available, the modal falls back to:
https://astro-indexer-web.vercel.app/api/contact
The endpoint is implemented as a Node serverless function in api/contact.mjs and
sends mail through the existing Private Email SMTP account. The website can stay
on GitHub Pages; deploy only the API function to a Node serverless host such as
Vercel, then point api.astroindexer.com at that deployment.
Vercel DNS record:
A api.astroindexer.com 76.76.21.21
Required production environment variables:
SMTP_HOST=mail.privateemail.com
SMTP_PORT=465
SMTP_USER=support@astroindexer.com
SMTP_PASS=<set as a secret, never commit this>
CONTACT_TO=support@astroindexer.com
CONTACT_FROM=AstroIndexer Website <support@astroindexer.com>
ALLOWED_ORIGINS=https://astroindexer.com,https://www.astroindexer.com,https://screetch82.github.io
Local syntax check:
npm install
npm run check:contact-apiThe form includes server-side validation, CORS allowlisting, and a hidden honeypot field. For heavier spam protection, add Cloudflare Turnstile or another captcha before calling the API.
Both download buttons in the HTML need to be updated with the actual Google Drive link:
- Replace
https://drive.google.com/your-download-linkwith your actual download URL - The "Download AstroIndexer v19.6" button now points to the same Google Drive location
The system maintains clean URLs and adds language parameter only when needed:
- Default:
astroindexer.com - German:
astroindexer.com?lang=de - English (explicit):
astroindexer.com?lang=en
- HTML
langattribute updates automatically - Meta descriptions change based on language
- Open Graph tags update for social sharing
- Open
index.htmlin a web browser - Test language switching:
- Click the language switcher
- Add
?lang=deto the URL - Change browser language settings
- Check localStorage persistence
- Test responsive design
- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)
- Mobile browsers (iOS/Android)
- Add more languages (French, Spanish, Italian)
- Implement IP-based geolocation as additional detection method
- Add language-specific URLs (/en/, /de/)
- Implement hreflang tags for better SEO
- Add RTL language support
© 2024 AstroIndexer. All rights reserved.