Translating the Celestial page

weewx-celestial manual · weewx-celestial on GitHub · Report an issue


As of 7.2 the page is translatable, entirely through WeeWX’s own mechanisms — lang files, [Texts]/$gettext, and the [Almanac] section — the same machinery as weewx-skyfield’s Sky page. There are no invented conventions to learn: if you have translated a WeeWX skin before, this works the same way.

How it works

Every string the page renders is a gettext-style [Texts] key: the English string is the key. A report falls back to English one string at a time, so a partial translation is fine — a missing key never breaks the page, it just renders in English.

The words come from four core-standard sources:

What Where it is translated
Page title, captions, badge states, roster value strings, the pass strings, the footer [Texts]
Body, satellite and comet names (dial labels, dome marks and roster rows), and the meteor shower names the peak chip renders [Almanac], keyed by tag name (moon = Mond, iss = ISS, halley = Halley), beside moon_phases — the showers in its [[MeteorShowers]] block
Compass cardinals on the dial rim (and the pass rosters’ ordinals) [Units] [[Ordinates]] directions
Hemisphere letters in the header’s coordinates [Labels] hemispheres

[Almanac] display names need WeeWX 5.3 or later — that is the whole second row of the table above: the comet and satellite names and the shower names, not just the bodies. WeeWX only began handing the report’s whole [Almanac] section to the almanac in 5.3; 5.2 passed it nothing but moon_phases. On 5.2 — still this extension’s stated minimum — everything else on the page translates normally, and the bodies fall back to capitalized English tag names (Moon, Jupiter, Proxima). Nothing breaks; the roster and the dial simply keep those names. The other three rows of the table are unaffected, so a 5.2 page still comes out in its language throughout apart from those names.

A body the [Almanac] section does not name is not left blank: it reads as its own tag with the underscores as spaces, title-cased — Moon, Proxima Centauri, Hale Bopp. That is weewx-skyfield’s own fallback, used here so the dial, the roster and its panels all call a body the same thing, and so WeeWX 5.2 (which hands the almanac no [Almanac] texts at all) still renders readable names. To print a body in lower case, or under any other name, give it an [Almanac] entry of its own: moon = moon.

A satellite you add beyond the shipped names (iss, tiangong, hst) gets its display name the same [Almanac] way — set it under [StdReport] [[Defaults]] so every report, weewx-skyfield’s Sky page included, calls it the same thing; the loop feed follows this report’s own [Almanac] either way.

The live-page twist: this page is not static — javascript rewrites the badge, the roster and the dial labels from loop data on every packet. Everything the javascript composes is translated once, at report-generation time, and fed to the script as data (body names, cardinals, and the [Texts] strings it needs), so the page stays in one language end to end with no translation machinery in the browser. A consequence worth knowing: changing the report’s lang takes effect on the next report cycle, when the page is regenerated — not on the next loop packet.

Clock times and dates are in the dictionary as strftime formats. %-I:%M %p is every clock time and %-I:%M:%S %p the header’s “updated” stamp: English reads 12-hour, and the other bundled languages translate them to %H:%M and %H:%M:%S. AM and PM come from the report’s locale, not the lang file, so a British-English station shows “pm”; a locale with no AM/PM at all reads 24-hour. %b %-d and %a, %b %-d are the date patterns, and {date}, {time} joins a date to its time. The page’s live layer fills the same formats with the same AM/PM, month and weekday names, which the report hands it, so a loop packet never reformats what the report painted. A format you write in any of these keys may use %H %I %M %S %d %m (each of which takes a - to drop the leading zero: %-H %-I %-M %-S %-d %-m), %p, %b %B, %a %A, %Y %y and %%. Anything else is left as written rather than filled, so you see it on the page instead of getting a wrong date quietly – and a test refuses a bundled lang file that uses one.

Translating

Eight translations ship with the skin, beside lang/en.conf — which is the reference dictionary rather than a translation. Each one is complete, and a test keeps it that way, so new strings cannot ship untranslated:

Language File Status
German lang/de.conf Partly reviewed as of 7.2 — the vocabulary shared with weewx-skyfield, by native speaker Christian (peters77); this skin’s own strings not yet
French lang/fr.conf Reviewed as of 8.3.1 — in full by native speaker Jacques Terrettaz, this skin’s own strings included
Danish lang/da.conf Reviewed as of 7.8 — contributed in full by native speaker Gert Andersen
Dutch lang/nl.conf Beta — out for a native-speaker review with Maarten van der Hoeven
Spanish lang/es.conf Beta — awaiting a native-speaker review
Italian lang/it.conf Beta — awaiting a native-speaker review
Norwegian (Bokmål) lang/no.conf Beta — awaiting a native-speaker review
Swedish lang/sv.conf Beta — awaiting a native-speaker review

Both halves of those statuses are deliberate.

The shared vocabulary is the part of each file that is identical to weewx-skyfield’s own lang file — body names, moon phases, hemisphere letters, compass ordinates, satellite names, all 88 constellation names, and the pass strings shared with its Sky page — and a test keeps the two extensions in step. Christian read those words in weewx-skyfield rather than here, which is why the German is partly reviewed: the strings that are this skin’s own — the page title, the badge states, the roster wording, the dome panel’s eyebrow and install hint and the any-pass roster’s wording (8.0), the countdown row’s and comet layer’s additions (8.1) — have never been read by a native speaker of that language. The Danish and the French carry no such qualification: Gert Andersen wrote the Danish file entire, and Jacques Terrettaz read the French one through, this skin’s own strings included, correcting the roster’s motion line and the pass sub-line as he went.

And each status is dated, because every reviewed file has grown since it was read. 8.0 added the dome, satellite and pass strings; 8.1 added the countdown row, the comets and the meteor showers — in every language. Those additions are complete and pinned by tests, so nothing renders in English by accident, but no native speaker has read them yet, and a bare “reviewed” would claim otherwise. A review’s date moves when someone re-reads the file, not when the file changes. 8.2 and 8.3 added nothing — both are palette work, and the light plate renders exactly the same words — and 8.3.1 added six strings — the dome’s health line, its four reasons, and the link beside them. 8.3.2 reworded four of those (three to name the fragment that failed rather than a fixed filename) and added a seventh, {file} is empty. 8.4 added an eighth, {file} is stamped ahead of the station's clock, and 8.5 added none. 9.0 added five more — the lines a panel carries when its fields are not declared, when its report’s celestial_panels is invalid, when the declaration is out of date, when a fragment set is missing, and when a registered almanac’s sky comes back empty. All of those are translated in every language and pinned by tests, and none of them has been read by a native speaker. To use one:

[StdReport]
    [[CelestialReport]]
        lang = de                # or fr, da, nl, es, it, no, or sv

The page in Danish, contributed by native speaker Gert Andersen — labels, captions, body names and live values alike:

The Celestial page in Danish

And in Italian, one of the Betas still awaiting a native-speaker review:

The Celestial page in Italian

Live captures of the others: Dutch · Spanish · Norwegian · Swedish. If you read one of these languages natively, a review is the most useful contribution there is: every one of them is complete, so what they want is not more translating but a native eye on the wording — and for all but the Danish and the French, that includes the strings this skin does not share with weewx-skyfield.

For any other language, the skin ships its reference dictionary at skins/Celestial/lang/en.conf — every string the page renders, and nothing else (a test keeps it exact in both directions). To add a language:

  1. Copy en.conf to <code>.conf in the same lang directory (e.g. fr.conf) and translate the values — the keys stay English. Translate as much or as little as you like; anything you drop falls back to English per string.
  2. Point the report at it in weewx.conf:
[StdReport]
    [[CelestialReport]]
        lang = fr

Composed strings keep their {named} placeholders — reorder them freely, but do not rename them (a misspelled placeholder is shown literally on the page, which is how you will notice). For example:

[Texts]
    "alt {alt}°" = "Höhe {alt}°"

Further languages are welcome as contributions — a lang file is a self-contained, no-code contribution.

One place for the whole station: Defaults

Anything under [StdReport] [[Defaults]] in weewx.conf is merged by WeeWX into every report:

[StdReport]
    [[Defaults]]
        lang = de                      # every skin that ships German goes German

lang = de selects each skin’s own lang/de.conf — Seasons, weewx-skyfield’s Sky page, this page and any other skin that ships German switch together. A skin with no German simply stays English: a missing lang file is a logged no-op, never an error.

[[Defaults]] (or the report’s own section) is also the durable home for local overrides: weectl extension install overwrites skins/Celestial/ — including its lang files — on every upgrade, while [[[Almanac]]]/[[[Texts]]] entries in weewx.conf survive and are merged over them.

Constellations, and loop-data values

The lang files also ship [Almanac] [[Constellations]] — all 88 constellation display names, keyed by IAU abbreviation (Psc = Fische), identical to weewx-skyfield’s — plus (8.1) the comet display names (halley, hale_bopp) and the [[MeteorShowers]] block, the twelve IMO majors’ names that almanac.next_meteor_shower.label and the shower chip render, all verbatim from weewx-skyfield’s files. The page itself renders no constellations; the section is there because loop-data values follow the language of the report that declares them: weewx-loopdata 7.0 evaluates each report’s declared fields with that report’s own [Almanac] texts, so fields like almanac.moon.label, almanac.moon_phase or almanac.mars.constellation.label arrive already translated in this report’s language — and a second Celestial report in another language gets its own entry in the file, in its own, with nothing to declare by hand: the installer writes the satellite and comet groups under every report running this skin — and under every report of another skin that names the panels it embeds (Panels in your own skin). (The data-carrying forms never translate: almanac.mars.constellation reports the Latin name in every language.) See weewx-skyfield’s translation manual for the tag-side details.

Panels in another skin

The panels translate through the report’s own [Texts], which for a page in a skin of your own means that skin’s lang files, not this one’s. Copy the [Texts] section of skins/Celestial/lang/<code>.conf into your skin’s own lang file for each language you ship — it is reproduced in the translation dictionary — or set the entries in weewx.conf, under the report or [[Defaults]], where they survive upgrades. Anything left out falls back to its English key, one string at a time. Body, satellite and comet names need nothing copied: they come from the report’s [Almanac] section, as above. See Panels in your own skin.

The dictionary

Every [Texts] string the page renders, as shipped, is reproduced on its own page: The translation dictionary. A test keys it to skins/Celestial/lang/en.conf, so it cannot drift from what the skin actually renders.


weewx-celestial is Copyright © 2022–2026 John A Kline and is licensed under the GNU Public License v3.