Skip to content

AyresWiFiManager 2.4.0

Choose a tag to compare

@IdefixRC IdefixRC released this 01 Oct 12:29
· 12 commits to main since this release

Overview

AyresWiFiManager 2.4.0 is a feature release of the IdefixRC fork. The captive portal now comes in English, Spanish and German. By default it opens in the language of the visitor's browser, falling back to English, and every page has a language menu so the user can switch. Two new settings let you fix the language or hide the menu.

This fork tracks ayresnet/AyresWiFiManager. We have offered this work to the original author.

Highlights

  • Multilingual portal: the setup, success and error pages are fully translated into English, Spanish and German.
  • Automatic language: the default AUTO reads the browser's preferred languages and picks the first one the portal supports.
  • Language menu: a globe menu in the header lists English · Español · Deutsch, each language in its own name. The chosen language carries over to the success or error page after saving.
  • Two new settings: setLanguage() and setLanguageSwitcher().
  • /info reports the configured lang and lang_switch.
  • Safer by design: scanned SSIDs stay plain text, translated text escapes any values it inserts, and the confirmation phrase for "erase all" is per language.

User guide: portal language

Call both settings in setup(), before begin():

#include <AyresWiFiManager.h>

AyresWiFiManager wifi;

void setup() {
  wifi.setLanguage(AyresWiFiManager::Language::AUTO); // default; AUTO, EN, ES or DE
  wifi.setLanguageSwitcher(true);                     // default; false hides the language menu
  wifi.begin();
  wifi.run();
}

void loop() {
  wifi.update();
}

setLanguage(): the language the portal opens in

Value Portal opens in
AUTO (default) The browser's language, if the portal supports it; otherwise English
EN English
ES Spanish
DE German

How AUTO decides. The page goes through the browser's preferred languages in order and uses the first one the portal supports. On a phone, those are the phone's language settings. It matches on the language and ignores the region:

Browser languages Portal shows
es-AR Spanish
de-CH, en German
pt-BR, es Spanish (the second preference is supported)
fr-FR, it English (neither is supported yet)

setLanguageSwitcher(): show or hide the language menu

With true (the default), every page shows the language menu and the user can switch at any time. A fixed setLanguage() value then only sets the starting language. With false, the menu is hidden and the portal stays in the configured language. A ?lang= parameter in the address is ignored too.

Common combinations

You want setLanguage setLanguageSwitcher
Visitor's language, with a choice (default) AUTO true
Visitor's language, no choice AUTO false
Start in German, allow switching DE true
Always Spanish, as before 2.4.0 ES false

The setup page reads both settings each time it loads, so a change takes effect on the next page load.

Custom pages. Pages you upload to LittleFS replace the built-in ones completely, including their language handling.

Testing

  • Tests and checks: the portal asset and translation checks pass, along with 10 Node and 17 pytest tests. CI builds both examples on Arduino-ESP32 core 2.x and 3.x.
  • Browser review: checked in all three languages, at PC and phone size.
  • On hardware: a Waveshare ESP32-C6 on core 3.3.11, using a dedicated device test, with an iPhone and an Android phone. All of these passed:
    • AUTO per phone language, with French falling back to English;
    • fixed and locked languages;
    • translated success and error pages;
    • built-in and custom pages;
    • the recovery section with the per-language erase phrases.

Compatibility

  • Framework: Arduino
  • Platform: ESP32
  • Arduino-ESP32 core: 2.x and 3.x
  • Dependency: ArduinoJson ^6.21.2

Upgrade Notes

lib_deps =
  https://github.com/IdefixRC/AyresWiFiManager.git#2.4.0
  • The default portal language changes. Up to 2.3.x the built-in portal was Spanish only. With the new default AUTO, browsers in other languages now see English (or German). To keep the old behaviour, add:

    wifi.setLanguage(AyresWiFiManager::Language::ES);
    wifi.setLanguageSwitcher(false);
  • The 405 reply text is now "Method not allowed".

  • The _en sample pages (data/index_en.html, success_en.html, error_en.html) are removed. The built-in pages now cover English. If you uploaded your own pages to LittleFS, they keep working unchanged.

  • There are no other API changes, and 2.4.0 includes all 2.3.3 fixes.

Thank you to Daniel Salgado and AyresNet for AyresWiFiManager, and to everyone using and testing it.