Translations
weewx-skyfield manual · weewx-skyfield on GitHub · Report an issue
Two different things here can speak your language, and it is worth knowing which is which:
- The bundled Sky page — its captions, panel labels, tooltips, chips and table headers. Translatable since 1.12: eight translations ship with the skin, beside the English reference.
- The almanac’s own names —
$almanac.moon.label,$almanac.saturn.constellation.label,$almanac.next_meteor_shower.label. These are tags, so they translate in your skin too, not just on the bundled page, and they reach live pages as weewx-loopdata fields.
Both work entirely through WeeWX’s own mechanisms — lang files, [Texts]/$gettext, and the [Almanac] section. 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 blanks a panel, it just renders in English.
The words come from four core-standard sources:
| What | Where it is translated |
|---|---|
| Captions, panel labels, tooltips, chips, table headers, the footer | [Texts] |
Body names, satellites included (panel labels, chips, table rows, tooltips — and the $almanac.<body>.label tag) | [Almanac], keyed by tag name (moon = Mond, iss = ISS), beside moon_phases |
Constellation names (the planet chips, the dome’s constellation figure labels — and the $almanac.<body>.constellation.label tag) | [Almanac] [[Constellations]], keyed by IAU abbreviation (Psc = Fische) |
Meteor shower names (the countdown chip, the dome’s radiant marks — and the $almanac.next_meteor_shower.label tag) | [Almanac] [[MeteorShowers]], keyed by shower key (perseids = Perseiden) |
| Compass cardinals (sky dome, sun path) | [Units] [[Ordinates]] directions |
| Hemisphere letters in the header’s coordinates | [Labels] hemispheres |
The three [Almanac] rows need WeeWX 5.3 or later. WeeWX 5.3 is what began handing an almanac the report’s whole [Almanac] section; 5.2 passes only moon_phases, so on 5.2 the moon phase names still translate but body, constellation and meteor shower names stay in English and Latin. Every computed value is unaffected, and the [Texts], [Units] and [Labels] rows work on 5.2 as they do everywhere else.
Dates split two ways. Their order and punctuation are in the dictionary — the strftime formats the page uses are [Texts] keys, so a language reorders them ("%b %-d" = "%-d. %b" turns “Aug 2” into “2. aug”). The clock format is one of them: English reads 12-hour ("%-I:%M %p", “8:45 PM”), so a 24-hour language translates it to "%H:%M", and does the same with the %-I:%M %p in the header’s format. A date with its time joins through "{date}, {time}"; a language that writes no comma there translates it to "{date} {time}". Durations write a unit one way throughout a language — if minutes are min in "{h} h {m} m", they are min in "{m} m" and "in {m} m" too. The month and weekday names (%b, %B, %A) come from strftime, so they follow the report’s locale: WeeWX sets the locale to the report’s lang when that locale is installed on the station, and falls back to the station’s default locale otherwise. A bare code like da is usually not a locale name at all (Debian’s alias table has no entry for it, even with da_DK.UTF-8 generated) — setting lang = da_DK.UTF-8 gives the full effect, since WeeWX strips the country and encoding when it looks up the lang file (da.conf) but hands the whole string to the locale.
The data-carrying values never translate: $almanac.saturn.constellation reports the Latin name (“Pisces”) in every language, so anything reading it as data — weewx-loopdata fields, your own templates comparing it — never sees values shift with a report’s language. The display forms are attributes: $almanac.saturn.label for the body, $almanac.saturn.constellation.label for the constellation (beside .abbr and .name), each falling back to the untranslated name. As loopdata fields, the same chains render in the language of loopdata’s target report (almanac.saturn.constellation.label).
Translating
Eight complete translations ship with the skin, in skins/Skyfield/lang/. Every one covers the whole page and every body and constellation name; a test keeps each file complete, so new strings cannot ship untranslated. Beta means the file has not yet been read by a native speaker, not that it is partial — corrections are welcome either way, as issues or pull requests.
| Language | File | Status |
|---|---|---|
| German | lang/de.conf | Reviewed as of 1.14 — by native speaker Christian (peters77), the page’s strings and all 88 constellations |
| French | lang/fr.conf | Reviewed as of 1.15 — by native speaker Jacques Terrettaz, who re-read the satellite-pass phrases at 2.3.1 |
| Danish | lang/da.conf | Reviewed as of 1.17 — 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 |
“Reviewed as of x.y” is dated deliberately: a native speaker read the whole file at that release, and later releases added strings none of them has seen — the satellite panel’s wording (2.0), the comet, meteor-shower, supermoon and equation-of-time strings (2.1), the data-source credits (2.1.1), and the countdown chips’ “today at” phrase (2.1.3). Those are translated, complete and tested; they are simply not yet reviewed. French is one step ahead: Jacques Terrettaz re-read the satellite-pass phrases at 2.3.1 and his corrections are in. Corrections to any of them are welcome.
A ninth file, lang/en.conf, is the English reference dictionary rather than a translation — it is what you copy to start a new language. The vocabulary these files share with weewx-celestial and weewx-loopdata is kept in step across the three extensions.
Point a report at one with lang:
[StdReport]
[[SkyfieldReport]]
lang = de # or fr, da, nl, es, it, no, or sv
For any other language, the skin ships its reference dictionary at skins/Skyfield/lang/en.conf — every string the page renders, and nothing else (a test keeps it exact in both directions). To add a language:
- Copy
en.confto<code>.confin the samelangdirectory (e.g.de.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. - Point the report at it in
weewx.conf:
[StdReport]
[[SkyfieldReport]]
lang = de
Composed strings keep their {named} placeholders — reorder them freely, but do not rename them (a broken placeholder makes that one string fall back to English). For example:
[Texts]
"up now — alt {alt}° · az {az}°" = "jetzt sichtbar — Höhe {alt}° · Azimut {az}°"
Further languages are welcome as contributions — a lang file is a self-contained, no-code contribution.
The dictionary
Every translatable string — the [Texts] keys, the body names, all 88 constellations and the meteor showers — is listed on its own page: The dictionary.
Your own reports and skins
The panels — and the $almanac.<body>.label tag — read [Texts], [Almanac], [[Ordinates]] and hemispheres from the report being generated, not from weewx-skyfield’s bundled skin. WeeWX resolves a report’s lang file inside that report’s own skin directory, so the shipped de.conf translates only the bundled Sky page — another report never sees it, even for a body it translates. Each report gets its own language, and translations for your own report belong in your report’s configuration: copy the entries you need from en.conf — or from de.conf, where the German already exists — into your skin’s lang file, parallel to copying the CSS rules you need.
To provide names once, for every report on the station, use [StdReport] [[Defaults]] — see One place for the whole station below.
The same goes for names the dictionary does not carry. The shipped lang files name the sun, the moon, the planets and the default satellites (plus hst); every other body — named stars, hip_<number> stars, satellites you add yourself — simply falls back to its English name (for a satellite, its tag name title-cased) until your report provides one, keyed by tag name in its [Almanac] section. In your skin’s lang file (or skin.conf):
[Almanac]
polaris = Polarstern
sirius = Sirius
or, without touching any skin file, per report in weewx.conf:
[StdReport]
[[MyReport]]
[[[Almanac]]]
polaris = Polarstern
The weewx.conf form works for the bundled Sky page too (under [[SkyfieldReport]]), and it is the durable place for local additions: weectl extension install overwrites skins/Skyfield/ — including its lang files — on every upgrade, while weewx.conf report options survive and are merged over them. And for a name every page should agree on — a satellite you added, say — [[Defaults]] is usually better still than any one report’s section: one entry serves every report at once, a loopdata target report included, so the live .label fields and every page render the same name. See One place for the whole station.
A weewx-loopdata almanac field such as almanac.moon.label renders in the language of loopdata’s target report — one language per loopdata instance.
One place for the whole station: Defaults
Anything under [StdReport] [[Defaults]] in weewx.conf is merged by WeeWX into every report. Three uses matter here:
[StdReport]
[[Defaults]]
lang = de # every skin that ships German goes German
[[[Almanac]]]
moon = Mond # body names, station-wide
polaris = Polarstern
[[[Texts]]]
"below the horizon" = "unter dem Horizont" # panel strings, station-wide
lang = deselects each skin’s ownlang/de.conf— Seasons, the bundled Sky page and any other skin that ships German switch together. A skin with no German simply stays English: a missing lang file, or a skin with nolangdirectory at all, is a logged no-op, never an error.[[[Almanac]]]body and star names apply to every report, the bundled Sky page included — one consistent set of names station-wide, and the place for local additions that must survive extension upgrades.[[[Texts]]]entries reach every report too — handy when several of your skins embed the panels and you would otherwise copy the same translations into each.
Precedence, later wins: the skin’s own files (skin.conf and its lang file) → [[Defaults]] → the report’s own section in weewx.conf. So [[Defaults]] overrides a shipped translation where they overlap, and a report-specific setting overrides [[Defaults]].
Copying the dictionary into an embedding skin
For a skin that embeds the panels and is not in English, step by step (German as the example; for other languages translate from en.conf instead):
-
You need half the dictionary. The lang files are split into two commented blocks: page prose (the bundled page’s title, section headings and captions — your skin has its own) and panel strings (everything the panels themselves render). You need the panel-strings block, plus the
[Almanac],[Labels]and[Units]sections. Copying the whole file is also fine — entries your skin never renders are harmless. -
If your skin has no lang files: copy the shipped file into your skin and select it for your report:
cp skins/Skyfield/lang/de.conf skins/YourSkin/lang/de.conf[StdReport] [[YourReport]] lang = de -
If your skin already has a
lang/de.conf: paste the entries into your existing[Texts]and[Almanac]sections — a second[Texts]section header in the same file is a ConfigObj syntax error that fails the whole file. Your skin almost certainly setshemispheresand[[Ordinates]]directionsalready; keep yours. -
On upgrades: a release that adds marks to a panel can add strings (changes.md calls them out; the shipped
de.confalways carries them). A stale copy degrades gracefully — the new strings render in English until you copy them over — unlike stale CSS, nothing breaks.