weewx-skyfield

Translating the Sky page

Home · Installation · Almanac tags · The Sky page · Sky panels in your skin · GitHub project

As of 1.12 the Sky page is translatable, 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 (panel labels, chips, table rows, tooltips — and the $almanac.<body>.label tag) [Almanac], keyed by tag name (moon = Mond), beside moon_phases
Constellation names (the planet chips — and the $almanac.<body>.constellation.label tag) [Almanac] [[Constellations]], keyed by IAU abbreviation (Psc = Fische)
Compass cardinals (sky dome, sun path) [Units] [[Ordinates]] directions
Hemisphere letters in the header’s coordinates [Labels] hemispheres

Month and date names are not in the dictionary at all: they 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).

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

German, French, Dutch and Spanish ship with the skinlang/de.conf and lang/fr.conf are complete, native-speaker-reviewed translations, lang/nl.conf and lang/es.conf complete Betas awaiting their native-speaker reviews, each kept complete by a test, so new strings cannot ship untranslated. Corrections are welcome as issues or pull requests:

[StdReport]
    [[SkyfieldReport]]
        lang = de                # or fr, nl, or es

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:

  1. Copy en.conf to <code>.conf in the same lang directory (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.
  2. 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

The complete reference dictionary, as shipped in 1.13 (skins/Skyfield/lang/en.conf in the installed extension is always the authoritative copy for your version):

[Labels]

    # Hemisphere abbreviations, for the latitude/longitude in the header
    hemispheres = N, S, E, W

[Units]

    [[Ordinates]]

        # Compass ordinal directions; the panels use N, E, S and W
        directions = N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW, N/A

[Almanac]

    # Moon phase names, for $almanac.moon_phase in the header
    moon_phases = New, Waxing crescent, First quarter, Waxing gibbous, Full, Waning gibbous, Last quarter, Waning crescent

    # Body display names, keyed by tag name: $almanac.<body>.label and
    # every panel label, chip, table row and tooltip.  Named stars may be
    # added the same way (e.g. polaris = ...).
    sun = Sun
    moon = Moon
    mercury = Mercury
    venus = Venus
    earth = Earth
    mars = Mars
    jupiter = Jupiter
    saturn = Saturn
    uranus = Uranus
    neptune = Neptune

    # Constellation display names, keyed by IAU abbreviation:
    # $almanac.<body>.constellation.label and the planet chips.  English
    # uses the Latin names, so this section doubles as the key reference;
    # $almanac.<body>.constellation always reports the Latin name.
    [[Constellations]]
        And = Andromeda
        Ant = Antlia
        Aps = Apus
        Aqr = Aquarius
        Aql = Aquila
        Ara = Ara
        Ari = Aries
        Aur = Auriga
        Boo = Boötes
        Cae = Caelum
        Cam = Camelopardalis
        Cnc = Cancer
        CVn = Canes Venatici
        CMa = Canis Major
        CMi = Canis Minor
        Cap = Capricornus
        Car = Carina
        Cas = Cassiopeia
        Cen = Centaurus
        Cep = Cepheus
        Cet = Cetus
        Cha = Chamaeleon
        Cir = Circinus
        Col = Columba
        Com = Coma Berenices
        CrA = Corona Australis
        CrB = Corona Borealis
        Crv = Corvus
        Crt = Crater
        Cru = Crux
        Cyg = Cygnus
        Del = Delphinus
        Dor = Dorado
        Dra = Draco
        Equ = Equuleus
        Eri = Eridanus
        For = Fornax
        Gem = Gemini
        Gru = Grus
        Her = Hercules
        Hor = Horologium
        Hya = Hydra
        Hyi = Hydrus
        Ind = Indus
        Lac = Lacerta
        Leo = Leo
        LMi = Leo Minor
        Lep = Lepus
        Lib = Libra
        Lup = Lupus
        Lyn = Lynx
        Lyr = Lyra
        Men = Mensa
        Mic = Microscopium
        Mon = Monoceros
        Mus = Musca
        Nor = Norma
        Oct = Octans
        Oph = Ophiuchus
        Ori = Orion
        Pav = Pavo
        Peg = Pegasus
        Per = Perseus
        Phe = Phoenix
        Pic = Pictor
        Psc = Pisces
        PsA = Piscis Austrinus
        Pup = Puppis
        Pyx = Pyxis
        Ret = Reticulum
        Sge = Sagitta
        Sgr = Sagittarius
        Sco = Scorpius
        Scl = Sculptor
        Sct = Scutum
        Ser = Serpens
        Sex = Sextans
        Tau = Taurus
        Tel = Telescopium
        Tri = Triangulum
        TrA = Triangulum Australe
        Tuc = Tucana
        UMa = Ursa Major
        UMi = Ursa Minor
        Vel = Vela
        Vir = Virgo
        Vol = Volans
        Vul = Vulpecula

[Texts]

    # ── page prose (index.html.tmpl) ─────────────────────────────────────
    "The Sky over {location}" = "The Sky over {location}"
    'The Sky <span class="over">over</span> {location}' = 'The Sky <span class="over">over</span> {location}'
    "{pct}% illuminated" = "{pct}% illuminated"
    "moonset {time}" = "moonset {time}"
    "The Sky Now · looking up" = "The Sky Now · looking up"
    "North at the top, east at the left  the sky-chart orientation, as if lying on your back looking up.  Altitude rings at 30° and 60°; the rim is the horizon." = "North at the top, east at the left — the sky-chart orientation, as if lying on your back looking up.  Altitude rings at 30° and 60°; the rim is the horizon."
    "The sun is up, so the plate shows the stars where they stand behind the daylight  Skyfield knows, even when you cannot see them." = "The sun is up, so the plate shows the stars where they stand behind the daylight  Skyfield knows, even when you cannot see them."
    "Dot size follows magnitude; the brighter the star, the larger the mark." = "Dot size follows magnitude; the brighter the star, the larger the mark."
    "Hover any mark for its coordinates." = "Hover any mark for its coordinates."
    "Rise & Set · today" = "Rise & Set · today"
    "Bars span each body's time above the horizon; the ivory tick is the transit.  Background bands are tonight's darkness: civil, nautical and astronomical twilight — the USNO geometric definitions." = "Bars span each body's time above the horizon; the ivory tick is the transit.  Background bands are tonight's darkness: civil, nautical and astronomical twilight — the USNO geometric definitions."
    "The Solar Year · daylight week by week" = "The Solar Year · daylight week by week"
    "Sunrise, sunset and solar noon (dashed) for every week of the year, over the same twilight bands as the timeline above  in local clock time, so the daylight-saving steps in spring and fall are real.  The brass line is today." = "Sunrise, sunset and solar noon (dashed) for every week of the year, over the same twilight bands as the timeline above  in local clock time, so the daylight-saving steps in spring and fall are real.  The brass line is today."
    "The Lunar Month · this lunation" = "The Lunar Month · this lunation"
    "New moon to new moon in thirty steps, the principal phases dated; the brass ring is today.  Hover any disc for its date and illumination." = "New moon to new moon in thirty steps, the principal phases dated; the brass ring is today.  Hover any disc for its date and illumination."
    "The Almanac Table" = "The Almanac Table"
    "Every value on this page is a WeeWX report tag served by weewx-skyfield  no PyEphem, no downloads at run time." = "Every value on this page is a WeeWX report tag served by weewx-skyfield  no PyEphem, no downloads at run time."
    "Sun & Planets · today" = "Sun & Planets · today"
    "The Sun’s Path · today" = "The Sun’s Path · today"
    "Altitude against azimuth from midnight to midnight, a dot every hour.  The dashed curve is the moon’s path, its rise, set and highest point marked with times; the 00 and 24 dots are the moon’s positions at the day’s two midnights — the curve is open between them because a lunar day runs about 50 minutes longer than a calendar day, and near full moon that break sits right at the top of the arc.  The bands below the horizon line are civil, nautical and astronomical twilight depth." = "Altitude against azimuth from midnight to midnight, a dot every hour.  The dashed curve is the moon’s path, its rise, set and highest point marked with times; the 00 and 24 dots are the moon’s positions at the day’s two midnights — the curve is open between them because a lunar day runs about 50 minutes longer than a calendar day, and near full moon that break sits right at the top of the arc.  The bands below the horizon line are civil, nautical and astronomical twilight depth."
    "The Solar System · today's positions" = "The Solar System · today's positions"
    "Heliocentric longitudes, viewed from above the north ecliptic pole; orbit spacing is logarithmic.  The dashed ray marks 0° (the direction of the vernal equinox)." = "Heliocentric longitudes, viewed from above the north ecliptic pole; orbit spacing is logarithmic.  The dashed ray marks 0° (the direction of the vernal equinox)."
    "Analemma · the sun at noon" = "Analemma · the sun at noon"
    "The sun's altitude and azimuth at local standard noon for every week of the year.  The figure-eight is the sum of Earth's tilt and its elliptical orbit; the brass point is this week." = "The sun's altitude and azimuth at local standard noon for every week of the year.  The figure-eight is the sum of Earth's tilt and its elliptical orbit; the brass point is this week."

    # ── panel strings (wxskyfield_sky.py) ────────────────────────────────
    "{h}h {m}m" = "{h}h {m}m"
    "Computed with the station’s built-in almanac" = "Computed with the station’s built-in almanac"
    "weewx-skyfield is not active  see the weewxd log" = "weewx-skyfield is not active  see the weewxd log"
    "Regenerated every report cycle" = "Regenerated every report cycle"
    "Computed with weewx-skyfield" = "Computed with weewx-skyfield"
    "Skyfield and the JPL DE421 ephemeris" = "Skyfield and the JPL DE421 ephemeris"
    "IAU-CSN star names" = "IAU-CSN star names"
    "Hipparcos star data Credit: ESA" = "Hipparcos star data Credit: ESA"
    "star catalog unavailable  see the weewxd log" = "star catalog unavailable  see the weewxd log"
    "star catalog disabled" = "star catalog disabled"
    "today" = "today"
    "in {n} day" = "in {n} day"
    "in {n} days" = "in {n} days"
    "new moon" = "new moon"
    "full moon" = "full moon"
    "equinox" = "equinox"
    "solstice" = "solstice"
    "lunar eclipse" = "lunar eclipse"
    "solar eclipse" = "solar eclipse"
    "penumbral" = "penumbral"
    "partial" = "partial"
    "total" = "total"
    "annular" = "annular"
    "Moon phase" = "Moon phase"
    "Sky dome chart" = "Sky dome chart"
    "{name}  alt {alt}°, az {az}°, mag {mag}" = "{name}  alt {alt}°, az {az}°, mag {mag}"
    "{name}  alt {alt}°, az {az}°" = "{name}  alt {alt}°, az {az}°"
    "{name}  alt {alt}°, az {az}°, {pct}% illuminated" = "{name}  alt {alt}°, az {az}°, {pct}% illuminated"
    "Rise and set timeline" = "Rise and set timeline"
    "always up" = "always up"
    "never up" = "never up"
    "{name} above the horizon ({duration})" = "{name} above the horizon ({duration})"
    "{name} transit {time}" = "{name} transit {time}"
    "now {time}" = "now {time}"
    "Solar system plan view" = "Solar system plan view"
    "{name}  heliocentric longitude {deg}°" = "{name}  heliocentric longitude {deg}°"
    "Analemma" = "Analemma"
    "azimuth" = "azimuth"
    "{date}  alt {alt}°, az {az}°" = "{date}  alt {alt}°, az {az}°"
    "This week  alt {alt}°, az {az}°" = "This week  alt {alt}°, az {az}°"
    "Sun path today" = "Sun path today"
    "Moon at {time}  the day’s track is open here: a lunar day runs about 50 minutes longer than a calendar day" = "Moon at {time}  the day’s track is open here: a lunar day runs about 50 minutes longer than a calendar day"
    "Moon transit {time}  altitude {alt}°" = "Moon transit {time}  altitude {alt}°"
    "Moonrise {time}" = "Moonrise {time}"
    "Moonset {time}" = "Moonset {time}"
    "Moon now  alt {alt}°, az {az}°" = "Moon now  alt {alt}°, az {az}°"
    "Sun now  alt {alt}°, az {az}°" = "Sun now  alt {alt}°, az {az}°"
    "Day length through the year" = "Day length through the year"
    "{date}  daylight {duration}" = "{date}  daylight {duration}"
    "The lunar month" = "The lunar month"
    "{date}  {pct}% illuminated" = "{date}  {pct}% illuminated"
    "new" = "new"
    "first quarter" = "first quarter"
    "full" = "full"
    "last quarter" = "last quarter"
    "Daylight" = "Daylight"
    "{duration} · sun {rise}  {set}" = "{duration} · sun {rise}  {set}"
    "civil dusk {dusk} · astro dark {dark}" = "civil dusk {dusk} · astro dark {dark}"
    "up now  alt {alt}° · az {az}°" = "up now  alt {alt}° · az {az}°"
    "rises {time}" = "rises {time}"
    "below the horizon" = "below the horizon"
    "mag {mag} · {dist} au · elong {elong}°" = "mag {mag} · {dist} au · elong {elong}°"
    "in {constellation}" = "in {constellation}"
    "CML I {one}° · II {two}°" = "CML I {one}° · II {two}°"
    "ring tilt {tilt}°" = "ring tilt {tilt}°"
    "{dist} km" = "{dist} km"
    "{dist} au" = "{dist} au"
    "Body" = "Body"
    "Rise" = "Rise"
    "Transit" = "Transit"
    "Set" = "Set"
    "Up for" = "Up for"
    "Altitude" = "Altitude"
    "Azimuth" = "Azimuth"
    "Mag" = "Mag"
    "Distance" = "Distance"

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 and the planets; every other body — named stars, hip_<number> stars — simply falls back to its English name 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.

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

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):

  1. 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.

  2. 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
    
  3. 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 sets hemispheres and [[Ordinates]] directions already; keep yours.

  4. On upgrades: a release that adds marks to a panel can add strings (changes.txt calls them out; the shipped de.conf always carries them). A stale copy degrades gracefully — the new strings render in English until you copy them over — unlike stale CSS, nothing breaks.