A modern, feature-rich cross-platform PowerShell script that displays a 7-day weather forecast with automatic location detection and multi-language support.
- โ Cross-Platform - Works on Windows, Linux, and macOS
- โ
Smart Location Detection - Automatically detects OS and uses the appropriate location service
- Windows: Windows Location Service
- Linux: GeoClue2
- macOS: CoreLocation (via whereami)
- All: IP-based geolocation fallback
- โ Multi-Language Support - Extensible locale system with 7 languages included
- โ Comprehensive Weather Data - Temperature, precipitation, wind speed, and weather conditions
- โ Multiple Temperature Units - Celsius or Fahrenheit
- โ Beautiful Console UI - Clean, formatted output with weather emojis
- โ Free APIs - Uses Open-Meteo (no API key required) and OpenStreetMap Nominatim
- โ Rate Limiting - Respects API usage policies automatically
- โ Fallback Support - Built-in English descriptions if locale files are missing
- PowerShell 7+ (recommended) or PowerShell 5.1+ (Windows only)
- Internet connection
Windows:
- Windows 10/11 with Location Services enabled
Linux:
- GeoClue2 installed and running
- Install:
sudo apt install geoclue-2.0(Debian/Ubuntu) orsudo dnf install geoclue2(Fedora)
macOS:
- whereami utility (optional but recommended)
- Install:
brew install whereami
-
Install PowerShell (if not already installed):
- Windows 10/11 comes with PowerShell 5.1
- For PowerShell 7+: Download from GitHub
-
Clone or download the repository:
git clone https://github.com/yourusername/powershell-weather-forecast.git
cd powershell-weather-forecast-
Enable Location Services (optional):
- Go to Settings โ Privacy โ Location
- Turn on "Location for this device"
-
Run the script:
.\WeatherForecast.ps1-
Install PowerShell:
Debian/Ubuntu:
# Install prerequisites sudo apt-get update sudo apt-get install -y wget apt-transport-https software-properties-common # Download and install PowerShell wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb sudo apt-get update sudo apt-get install -y powershell
Fedora:
# Add Microsoft repository sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo curl -o /etc/yum.repos.d/microsoft.repo https://packages.microsoft.com/config/fedora/$(rpm -E %fedora)/prod.repo # Install PowerShell sudo dnf install -y powershell
Arch Linux:
yay -S powershell-bin # or paru -S powershell-bin -
Install GeoClue2 (optional, for location detection):
Debian/Ubuntu:
sudo apt install geoclue-2.0
Fedora:
sudo dnf install geoclue2
Arch Linux:
sudo pacman -S geoclue
-
Clone or download the repository:
git clone https://github.com/yourusername/powershell-weather-forecast.git
cd powershell-weather-forecast- Make the script executable (optional):
chmod +x WeatherForecast.ps1- Run the script:
pwsh ./WeatherForecast.ps1- Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"- Install PowerShell:
brew install powershell/tap/powershell- Install whereami (optional, for location detection):
brew install whereami- Clone or download the repository:
git clone https://github.com/yourusername/powershell-weather-forecast.git
cd powershell-weather-forecast- Run the script:
pwsh ./WeatherForecast.ps1If you just want to try it without location services:
# Skip system location and use IP-based detection
pwsh ./WeatherForecast.ps1 -SkipSystemLocation
# Or specify a city directly
pwsh ./WeatherForecast.ps1 -City "London"# Auto-detect location and show forecast
.\WeatherForecast.ps1# Specific city
.\WeatherForecast.ps1 -City "Tokyo"
# Use Fahrenheit
.\WeatherForecast.ps1 -Units Fahrenheit
# Force specific language
.\WeatherForecast.ps1 -LocaleOverride "pt"
# Skip system location (go directly to IP lookup)
.\WeatherForecast.ps1 -SkipSystemLocation
# Combine parameters
.\WeatherForecast.ps1 -City "New York" -Units Fahrenheit -LocaleOverride "es"| Parameter | Type | Description | Default |
|---|---|---|---|
-City |
String | Specify city name directly | None (auto-detect) |
-Units |
String | Temperature units: Celsius or Fahrenheit |
Celsius |
-SkipSystemLocation |
Switch | Skip Windows Location Service, use IP instead | False |
-LocaleOverride |
String | Force specific language (e.g., en, pt, fr) |
System language |
- ๐ฌ๐ง English (
en) - ๐ต๐น Portuguese (
pt) - ๐ซ๐ท French (
fr) - ๐ช๐ธ Spanish (
es) - ๐ฉ๐ช German (
de) - ๐ฎ๐น Italian (
it) - ๐ฏ๐ต Japanese (
ja) - ๐บ๐ฆ Ukrainian (
uk)
Want to add more? See locales/README.md
The script automatically detects your OS and uses a tiered approach to find your location:
- Windows Location Service - Most accurate, requires permission
- IP Geolocation - Fallback using ip-api.com (city-level accuracy)
- Manual Entry - Prompts for city name if automatic methods fail
- GeoClue2 - Uses the Linux standard geolocation service
- IP Geolocation - Fallback using ip-api.com (city-level accuracy)
- Manual Entry - Prompts for city name if automatic methods fail
- CoreLocation via whereami - Uses macOS location services
- IP Geolocation - Fallback using ip-api.com (city-level accuracy)
- Manual Entry - Prompts for city name if automatic methods fail
- Open-Meteo - Free weather forecast API (no key required)
- OpenStreetMap Nominatim - Reverse geocoding for coordinates to city names
- Open-Meteo Geocoding - City name to coordinates
- IP-API - IP-based geolocation
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Weather Forecast - 7 Day Outlook โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Location: Porto, Portugal
Fetching 7-day weather forecast for Porto...
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 7-Day Weather Forecast for Porto, Portugal โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Date Icon Weather High Low Rain Wind
---- ---- ------- ---- --- ---- ----
Mon 27/10 โ๏ธ Clear 22ยฐC 15ยฐC - 12 km/h
Tue 28/10 ๐ค๏ธ M.Clear 21ยฐC 14ยฐC - 15 km/h
Wed 29/10 โ
P.Cloudy 19ยฐC 13ยฐC 2.5mm (60%) 18 km/h
Thu 30/10 โ Rain 17ยฐC 12ยฐC 8.2mm (85%) 22 km/h
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Weather data: Open-Meteo API | Location: OpenStreetMap Nominatim
Language: English (en)
Last updated: 2025-10-27 14:23:45
Contributions are welcome! This project uses automatic semantic versioning based on Conventional Commits.
- Fork the repository
- Create a feature branch (
git checkout -b feat/amazing-feature) - Make your changes
- Commit using conventional commit format (see below)
- Push to your fork and create a Pull Request
Use conventional commits for automatic versioning:
feat:- New feature (bumps minor version: 1.0.0 โ 1.1.0)fix:- Bug fix (bumps patch version: 1.0.0 โ 1.0.1)docs:- Documentation changesperf:- Performance improvementsrefactor:- Code refactoringBREAKING CHANGE:- Breaking changes (bumps major version: 1.0.0 โ 2.0.0)
Examples:
feat: add support for hourly forecasts
fix: resolve location detection on WSL
docs: update installation instructions
feat!: redesign command line parameters
BREAKING CHANGE: Parameter names have changedSee CONTRIBUTING.md for detailed guidelines.
- ๐ Adding new language translations (see locales/README.md)
- ๐ Reporting bugs or suggesting features
- ๐ Improving the code or documentation
- โ Adding tests and improving cross-platform support
This project is open source and available under the MIT License.
- Weather data provided by Open-Meteo
- Geocoding by OpenStreetMap Nominatim
- Weather icons using Unicode emoji characters
Windows:
- Ensure Windows Location Services are enabled: Settings โ Privacy โ Location
- Try using
-SkipSystemLocationto use IP-based location instead
Linux:
- Ensure GeoClue2 is installed:
sudo apt install geoclue-2.0orsudo dnf install geoclue2 - Check if GeoClue2 service is running:
systemctl status geoclue - Try using
-SkipSystemLocationto use IP-based location instead
macOS:
- Install whereami:
brew install whereami - Grant location permissions when prompted
- Try using
-SkipSystemLocationto use IP-based location instead
- Check that locale files exist in the
locales/subdirectory - Verify JSON files are valid and UTF-8 encoded
- Script falls back to built-in English if locale files are missing
- The script automatically rate-limits Nominatim requests (1/second)
- If you encounter issues, wait a few minutes before trying again
- For best cross-platform compatibility, use PowerShell 7+
- Install from: https://github.com/PowerShell/PowerShell#get-powershell
See CHANGELOG.md for detailed version history.
This project follows Semantic Versioning:
- Major version (X.0.0): Breaking changes
- Minor version (0.X.0): New features, backwards compatible
- Patch version (0.0.X): Bug fixes and improvements