@@ -1,20 +0,0 @@ | |||
name: Commit lint | |||
on: | |||
push: | |||
branches: [master, features] | |||
pull_request: | |||
branches: [master, features] | |||
jobs: | |||
commitlint: | |||
runs-on: ubuntu-latest | |||
steps: | |||
- uses: actions/checkout@v2 | |||
with: | |||
fetch-depth: 0 | |||
- uses: wagoid/commitlint-github-action@v2 | |||
with: | |||
helpURL: 'https://github.com/Kosmorro/kosmorro/blob/master/CONTRIBUTING.md#commiting' | |||
@@ -149,7 +149,11 @@ class TextDumper(Dumper): | |||
data = [] | |||
for ephemeris in self.ephemerides: | |||
name = self.style(strings.from_object(ephemeris.object.identifier), "th") | |||
object_name = strings.from_object(ephemeris.object.identifier) | |||
if object_name is None: | |||
continue | |||
name = self.style(object_name, "th") | |||
if ephemeris.rise_time is not None: | |||
time_fmt = ( | |||
@@ -197,16 +201,10 @@ class TextDumper(Dumper): | |||
) | |||
def get_events(self, events: [Event]) -> str: | |||
def get_event_description(ev: Event): | |||
description = strings.from_event(ev) | |||
if ev.details is not None: | |||
description += " ({:s})".format(ev.details) | |||
return description | |||
data = [] | |||
for event in events: | |||
description = strings.from_event(event) | |||
time_fmt = ( | |||
TIME_FORMAT | |||
if event.start_time.day == self.date.day | |||
@@ -215,7 +213,7 @@ class TextDumper(Dumper): | |||
data.append( | |||
[ | |||
self.style(event.start_time.strftime(time_fmt), "th"), | |||
get_event_description(event), | |||
description, | |||
] | |||
) | |||
@@ -340,9 +338,13 @@ class _LatexDumper(Dumper): | |||
document = document.replace("+++EVENTS+++", self._make_events()) | |||
for aster in ASTERS: | |||
object_name = strings.from_object(aster.identifier) | |||
if object_name is None: | |||
continue | |||
document = document.replace( | |||
"+++ASTER_%s+++" % aster.skyfield_name.upper().split(" ")[0], | |||
strings.from_object(aster.identifier), | |||
object_name, | |||
) | |||
return document | |||
@@ -384,15 +386,17 @@ class _LatexDumper(Dumper): | |||
aster_set = "-" | |||
if not self.show_graph: | |||
latex.append( | |||
r"\object{%s}{%s}{%s}{%s}" | |||
% ( | |||
strings.from_object(ephemeris.object.identifier), | |||
aster_rise, | |||
aster_culmination, | |||
aster_set, | |||
object_name = strings.from_object(ephemeris.object.identifier) | |||
if object_name is not None: | |||
latex.append( | |||
r"\object{%s}{%s}{%s}{%s}" | |||
% ( | |||
object_name, | |||
aster_rise, | |||
aster_culmination, | |||
aster_set, | |||
) | |||
) | |||
) | |||
else: | |||
if ephemeris.rise_time is not None: | |||
raise_hour = ephemeris.rise_time.hour | |||
@@ -438,9 +442,13 @@ class _LatexDumper(Dumper): | |||
latex = [] | |||
for event in self.events: | |||
event_name = strings.from_event(event) | |||
if event_name is None: | |||
continue | |||
latex.append( | |||
r"\event{%s}{%s}" | |||
% (event.start_time.strftime(TIME_FORMAT), strings.from_event(event)) | |||
% (event.start_time.strftime(TIME_FORMAT), event_name) | |||
) | |||
return "".join(latex) | |||
@@ -5,19 +5,29 @@ from .utils import _ | |||
from kosmorrolib import EventType, MoonPhaseType, ObjectIdentifier, Event | |||
def from_event(event: Event) -> str: | |||
return { | |||
EventType.OPPOSITION: _("%s is in opposition"), | |||
EventType.CONJUNCTION: _("%s and %s are in conjunction"), | |||
EventType.OCCULTATION: _("%s occults %s"), | |||
EventType.MAXIMAL_ELONGATION: _("Elongation of %s is maximal"), | |||
EventType.MOON_PERIGEE: _("%s is at its perigee"), | |||
EventType.MOON_APOGEE: _("%s is at its apogee"), | |||
}.get(event.event_type) % tuple([from_object(o.identifier) for o in event.objects]) | |||
def from_event(event: Event, with_description: bool = True) -> str: | |||
string, details = { | |||
EventType.OPPOSITION: (_("%s is in opposition"), None), | |||
EventType.CONJUNCTION: (_("%s and %s are in conjunction"), None), | |||
EventType.OCCULTATION: (_("%s occults %s"), None), | |||
EventType.MAXIMAL_ELONGATION: (_("Elongation of %s is maximal"), ('{:.3n}°'.format(event.details['deg']) if type(event.details) is dict else event.details)), | |||
EventType.MOON_PERIGEE: (_("%s is at its perigee"), None), | |||
EventType.MOON_APOGEE: (_("%s is at its apogee"), None), | |||
}.get(event.event_type) | |||
if string is None: | |||
return None | |||
string = string % tuple([from_object(o.identifier) for o in event.objects]) | |||
if details is not None and with_description: | |||
return '%s (%s)' % (string, details) | |||
return string | |||
def from_moon_phase(moon_phase: MoonPhaseType) -> str: | |||
return { | |||
string = { | |||
MoonPhaseType.NEW_MOON: _("New Moon"), | |||
MoonPhaseType.WAXING_CRESCENT: _("Waxing Crescent"), | |||
MoonPhaseType.FIRST_QUARTER: _("First Quarter"), | |||
@@ -26,7 +36,12 @@ def from_moon_phase(moon_phase: MoonPhaseType) -> str: | |||
MoonPhaseType.WANING_GIBBOUS: _("Waning Gibbous"), | |||
MoonPhaseType.LAST_QUARTER: _("Last Quarter"), | |||
MoonPhaseType.WANING_CRESCENT: _("Waning Crescent"), | |||
}.get(moon_phase, _("Unknown phase")) | |||
}.get(moon_phase) | |||
if string is None: | |||
raise RuntimeError("Unknown moon phase: %s." % moon_phase) | |||
return string | |||
def from_object(identifier: ObjectIdentifier) -> str: | |||
@@ -41,4 +56,4 @@ def from_object(identifier: ObjectIdentifier) -> str: | |||
ObjectIdentifier.URANUS: _("Uranus"), | |||
ObjectIdentifier.NEPTUNE: _("Neptune"), | |||
ObjectIdentifier.PLUTO: _("Pluto"), | |||
}.get(identifier, _("Unknown object")) | |||
}.get(identifier) |
@@ -8,7 +8,7 @@ msgid "" | |||
msgstr "" | |||
"Project-Id-Version: kosmorro 0.10.0\n" | |||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | |||
"POT-Creation-Date: 2021-06-06 11:58+0200\n" | |||
"POT-Creation-Date: 2021-06-20 15:59+0200\n" | |||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |||
"Language-Team: LANGUAGE <LL@li.org>\n" | |||
@@ -39,64 +39,64 @@ msgstr "" | |||
msgid "Note: All the hours are given in the UTC{offset} timezone." | |||
msgstr "" | |||
#: _kosmorro/dumper.py:189 _kosmorro/dumper.py:325 | |||
#: _kosmorro/dumper.py:193 _kosmorro/dumper.py:323 | |||
msgid "Object" | |||
msgstr "" | |||
#: _kosmorro/dumper.py:190 _kosmorro/dumper.py:326 | |||
#: _kosmorro/dumper.py:194 _kosmorro/dumper.py:324 | |||
msgid "Rise time" | |||
msgstr "" | |||
#: _kosmorro/dumper.py:191 _kosmorro/dumper.py:328 | |||
#: _kosmorro/dumper.py:195 _kosmorro/dumper.py:326 | |||
msgid "Culmination time" | |||
msgstr "" | |||
#: _kosmorro/dumper.py:192 _kosmorro/dumper.py:330 | |||
#: _kosmorro/dumper.py:196 _kosmorro/dumper.py:328 | |||
msgid "Set time" | |||
msgstr "" | |||
#: _kosmorro/dumper.py:226 | |||
#: _kosmorro/dumper.py:224 | |||
msgid "Moon phase is unavailable for this date." | |||
msgstr "" | |||
#: _kosmorro/dumper.py:230 _kosmorro/dumper.py:334 | |||
#: _kosmorro/dumper.py:228 _kosmorro/dumper.py:332 | |||
msgid "Moon phase:" | |||
msgstr "" | |||
#: _kosmorro/dumper.py:234 | |||
#: _kosmorro/dumper.py:232 | |||
msgid "{next_moon_phase} on {next_moon_phase_date} at {next_moon_phase_time}" | |||
msgstr "" | |||
#: _kosmorro/dumper.py:298 | |||
#: _kosmorro/dumper.py:296 | |||
msgid "Overview of your sky" | |||
msgstr "" | |||
#: _kosmorro/dumper.py:306 | |||
#: _kosmorro/dumper.py:304 | |||
msgid "" | |||
"This document summarizes the ephemerides and the events of {date}. It " | |||
"aims to help you to prepare your observation session. All the hours are " | |||
"given in {timezone}." | |||
msgstr "" | |||
#: _kosmorro/dumper.py:316 | |||
#: _kosmorro/dumper.py:314 | |||
msgid "" | |||
"Don't forget to check the weather forecast before you go out with your " | |||
"equipment." | |||
msgstr "" | |||
#: _kosmorro/dumper.py:323 | |||
#: _kosmorro/dumper.py:321 | |||
msgid "Ephemerides of the day" | |||
msgstr "" | |||
#: _kosmorro/dumper.py:332 | |||
#: _kosmorro/dumper.py:330 | |||
msgid "hours" | |||
msgstr "" | |||
#: _kosmorro/dumper.py:339 | |||
#: _kosmorro/dumper.py:337 | |||
msgid "Expected events" | |||
msgstr "" | |||
#: _kosmorro/dumper.py:484 | |||
#: _kosmorro/dumper.py:492 | |||
msgid "" | |||
"Building PDF was not possible, because some dependencies are not " | |||
"installed.\n" | |||
@@ -104,7 +104,7 @@ msgid "" | |||
"pdf/ for more information." | |||
msgstr "" | |||
#: _kosmorro/dumper.py:537 | |||
#: _kosmorro/dumper.py:545 | |||
#, python-format | |||
msgid "" | |||
"An error occurred during the compilation of the PDF.\n" | |||
@@ -253,86 +253,78 @@ msgstr "" | |||
msgid "%s is at its apogee" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:21 | |||
#: _kosmorro/i18n/strings.py:31 | |||
msgid "New Moon" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:22 | |||
#: _kosmorro/i18n/strings.py:32 | |||
msgid "Waxing Crescent" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:23 | |||
#: _kosmorro/i18n/strings.py:33 | |||
msgid "First Quarter" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:24 | |||
#: _kosmorro/i18n/strings.py:34 | |||
msgid "Waxing Gibbous" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:25 | |||
#: _kosmorro/i18n/strings.py:35 | |||
msgid "Full Moon" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:26 | |||
#: _kosmorro/i18n/strings.py:36 | |||
msgid "Waning Gibbous" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:27 | |||
#: _kosmorro/i18n/strings.py:37 | |||
msgid "Last Quarter" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:28 | |||
#: _kosmorro/i18n/strings.py:38 | |||
msgid "Waning Crescent" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:29 | |||
msgid "Unknown phase" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:34 | |||
#: _kosmorro/i18n/strings.py:49 | |||
msgid "Sun" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:35 | |||
#: _kosmorro/i18n/strings.py:50 | |||
msgid "Moon" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:36 | |||
#: _kosmorro/i18n/strings.py:51 | |||
msgid "Mercury" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:37 | |||
#: _kosmorro/i18n/strings.py:52 | |||
msgid "Venus" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:38 | |||
#: _kosmorro/i18n/strings.py:53 | |||
msgid "Mars" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:39 | |||
#: _kosmorro/i18n/strings.py:54 | |||
msgid "Jupiter" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:40 | |||
#: _kosmorro/i18n/strings.py:55 | |||
msgid "Saturn" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:41 | |||
#: _kosmorro/i18n/strings.py:56 | |||
msgid "Uranus" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:42 | |||
#: _kosmorro/i18n/strings.py:57 | |||
msgid "Neptune" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:43 | |||
#: _kosmorro/i18n/strings.py:58 | |||
msgid "Pluto" | |||
msgstr "" | |||
#: _kosmorro/i18n/strings.py:44 | |||
msgid "Unknown object" | |||
msgstr "" | |||
#: _kosmorro/i18n/utils.py:27 | |||
msgid "{day_of_week} {month} {day_number}, {year}" | |||
msgstr "" | |||