Build each screen in one language: the screen texts from the translations, European letters in the fonts, and Language & region in the app
The firmware takes its texts from screen_manager/translations/<code>.json at build time (components/smart_display: one table in main.cpp, keys in screen_text_keys.h), and the fonts carry every letter European languages write with. The app keeps Settings -> Language & region (language, clock, numbers) for every screen, writes LANGUAGE into the screens' YAML and sends the clock and the number format in the layout message; the per-screen 24-hour clock goes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include "screen_text.h"
|
||||
|
||||
namespace media_card {
|
||||
struct Rect {
|
||||
@@ -145,11 +146,11 @@ inline std::string subtitle(const std::string &artist, const std::string &album)
|
||||
}
|
||||
// What the card says instead of a title when nothing plays.
|
||||
inline const char *idle_text(const std::string &state) {
|
||||
if (state == "off") return "Off";
|
||||
if (state == "standby") return "Standby";
|
||||
if (state == "buffering") return "Loading";
|
||||
if (state == "unavailable") return "Unavailable";
|
||||
return "Not playing";
|
||||
if (state == "off") return screen_text::tr(screen_text::txt::ha_off);
|
||||
if (state == "standby") return screen_text::tr(screen_text::txt::ha_media_standby);
|
||||
if (state == "buffering") return screen_text::tr(screen_text::txt::media_loading);
|
||||
if (state == "unavailable") return screen_text::tr(screen_text::txt::tile_unavailable);
|
||||
return screen_text::tr(screen_text::txt::media_not_playing);
|
||||
}
|
||||
inline bool playing(const std::string &state) { return state == "playing" || state == "buffering"; }
|
||||
inline bool has_track(const std::string &state) { return state == "playing" || state == "paused" || state == "buffering"; }
|
||||
|
||||
Reference in New Issue
Block a user