nicfb 3 лет назад
Родитель
Сommit
4a4d43888e
3 измененных файлов: 71 добавлений и 46 удалений
  1. +6
    -3
      kosmorro/__main__.py
  2. +4
    -4
      kosmorro/exceptions.py
  3. +61
    -39
      kosmorro/locales/messages.pot

+ 6
- 3
kosmorro/__main__.py Просмотреть файл

@@ -263,12 +263,12 @@ def get_search_information(
try: try:
if search_until is None: if search_until is None:
raise SearchDatesNotGivenError raise SearchDatesNotGivenError
try: try:
event_types = [EventType[event.upper()] for event in requested_events] event_types = [EventType[event.upper()] for event in requested_events]
except KeyError as error: except KeyError as error:
raise InvalidEventTypeError(error.args[0]) raise InvalidEventTypeError(error.args[0])
from_ = parse_date(search_from) from_ = parse_date(search_from)
until = parse_date(search_until) until = parse_date(search_until)
events_list = search_events(event_types, until, from_, timezone) events_list = search_events(event_types, until, from_, timezone)
@@ -402,7 +402,10 @@ def get_args(output_formats: [str]):
help=_("The date to begin searching for events. Default is today."), help=_("The date to begin searching for events. Default is today."),
) )
parser.add_argument( parser.add_argument(
"--until", type=str, default=None, help=_("The date to end searching for events.")
"--until",
type=str,
default=None,
help=_("The date to end searching for events."),
) )
parser.add_argument( parser.add_argument(
"--no-colors", "--no-colors",


+ 4
- 4
kosmorro/exceptions.py Просмотреть файл

@@ -57,15 +57,14 @@ class InvalidOutputFormatError(RuntimeError):
class SearchDatesNotGivenError(RuntimeError): class SearchDatesNotGivenError(RuntimeError):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.msg = _(
"Search end date (--until) is required when searching events."
)
self.msg = _("Search end date (--until) is required when searching events.")



class InvalidEventTypeError(RuntimeError): class InvalidEventTypeError(RuntimeError):
def __init__(self, invalid_event: EventType): def __init__(self, invalid_event: EventType):
super().__init__() super().__init__()
self.invalid_event = invalid_event self.invalid_event = invalid_event
supported_events = ', '.join([event.name for _, event in enumerate(EventType)])
supported_events = ", ".join([event.name for _, event in enumerate(EventType)])
self.msg = _( self.msg = _(
"Invalid event type {event}.\nSupported events are {events}." "Invalid event type {event}.\nSupported events are {events}."
).format( ).format(
@@ -73,6 +72,7 @@ class InvalidEventTypeError(RuntimeError):
events=supported_events, events=supported_events,
) )



class CompileError(RuntimeError): class CompileError(RuntimeError):
def __init__(self, msg): def __init__(self, msg):
super().__init__() super().__init__()


+ 61
- 39
kosmorro/locales/messages.pot Просмотреть файл

@@ -8,103 +8,115 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2022-04-29 12:01+0000\n"
"POT-Creation-Date: 2022-11-21 16:17-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.1\n"
"Generated-By: Babel 2.10.3\n"


#: kosmorro/__main__.py:82
#: kosmorro/__main__.py:93
msgid "" msgid ""
"Save the planet and paper!\n" "Save the planet and paper!\n"
"Consider printing your PDF document only if really necessary, and use the" "Consider printing your PDF document only if really necessary, and use the"
" other side of the sheet." " other side of the sheet."
msgstr "" msgstr ""


#: kosmorro/__main__.py:90
#: kosmorro/__main__.py:101
msgid "" msgid ""
"PDF output will not contain the ephemerides, because you didn't provide " "PDF output will not contain the ephemerides, because you didn't provide "
"the observation coordinates." "the observation coordinates."
msgstr "" msgstr ""


#: kosmorro/__main__.py:142
#: kosmorro/__main__.py:181
msgid "The file could not be saved in \"{path}\": {error}" msgid "The file could not be saved in \"{path}\": {error}"
msgstr "" msgstr ""


#: kosmorro/__main__.py:156
#: kosmorro/__main__.py:195
msgid "Please provide a file path to export in this format (--output)." msgid "Please provide a file path to export in this format (--output)."
msgstr "" msgstr ""


#: kosmorro/__main__.py:187
#: kosmorro/__main__.py:226
msgid "Moon phase can only be computed between {min_date} and {max_date}" msgid "Moon phase can only be computed between {min_date} and {max_date}"
msgstr "" msgstr ""


#: kosmorro/__main__.py:238
#: kosmorro/__main__.py:316
msgid "Running on Python {python_version} with Kosmorrolib v{kosmorrolib_version}" msgid "Running on Python {python_version} with Kosmorrolib v{kosmorrolib_version}"
msgstr "" msgstr ""


#: kosmorro/__main__.py:251
#: kosmorro/__main__.py:329
msgid "" msgid ""
"Compute the ephemerides and the events for a given date and a given " "Compute the ephemerides and the events for a given date and a given "
"position on Earth." "position on Earth."
msgstr "" msgstr ""


#: kosmorro/__main__.py:254
#: kosmorro/__main__.py:332
msgid "" msgid ""
"By default, only the events will be computed for today.\n" "By default, only the events will be computed for today.\n"
"To compute also the ephemerides, latitude and longitude arguments are " "To compute also the ephemerides, latitude and longitude arguments are "
"needed." "needed."
msgstr "" msgstr ""


#: kosmorro/__main__.py:267
#: kosmorro/__main__.py:345
msgid "Show the program version" msgid "Show the program version"
msgstr "" msgstr ""


#: kosmorro/__main__.py:275
#: kosmorro/__main__.py:353
msgid "" msgid ""
"The format to output the information to. If not provided, the output " "The format to output the information to. If not provided, the output "
"format will be inferred from the file extension of the output file." "format will be inferred from the file extension of the output file."
msgstr "" msgstr ""


#: kosmorro/__main__.py:285
#: kosmorro/__main__.py:363
msgid "" msgid ""
"The observer's position on Earth, in the \"{latitude},{longitude}\" " "The observer's position on Earth, in the \"{latitude},{longitude}\" "
"format. Can also be set in the KOSMORRO_POSITION environment variable." "format. Can also be set in the KOSMORRO_POSITION environment variable."
msgstr "" msgstr ""


#: kosmorro/__main__.py:295
#: kosmorro/__main__.py:373
msgid "" msgid ""
"The date for which the ephemerides must be calculated. Can be in the " "The date for which the ephemerides must be calculated. Can be in the "
"YYYY-MM-DD format or an interval in the \"[+-]YyMmDd\" format (with Y, M," "YYYY-MM-DD format or an interval in the \"[+-]YyMmDd\" format (with Y, M,"
" and D numbers). Defaults to current date." " and D numbers). Defaults to current date."
msgstr "" msgstr ""


#: kosmorro/__main__.py:306
#: kosmorro/__main__.py:384
msgid "" msgid ""
"The timezone to display the hours in (e.g. 2 for UTC+2 or -3 for UTC-3). " "The timezone to display the hours in (e.g. 2 for UTC+2 or -3 for UTC-3). "
"Can also be set in the KOSMORRO_TIMEZONE environment variable." "Can also be set in the KOSMORRO_TIMEZONE environment variable."
msgstr "" msgstr ""


#: kosmorro/__main__.py:315
#: kosmorro/__main__.py:395
msgid "Search for specific event types by date."
msgstr ""

#: kosmorro/__main__.py:402
msgid "The date to begin searching for events. Default is today."
msgstr ""

#: kosmorro/__main__.py:408
msgid "The date to end searching for events."
msgstr ""

#: kosmorro/__main__.py:414
msgid "Disable the colors in the console." msgid "Disable the colors in the console."
msgstr "" msgstr ""


#: kosmorro/__main__.py:322
#: kosmorro/__main__.py:421
msgid "" msgid ""
"A file to export the output to. If not given, the standard output is " "A file to export the output to. If not given, the standard output is "
"used. This argument is needed for PDF format." "used. This argument is needed for PDF format."
msgstr "" msgstr ""


#: kosmorro/__main__.py:331
#: kosmorro/__main__.py:430
msgid "" msgid ""
"Do not generate a graph to represent the rise and set times in the PDF " "Do not generate a graph to represent the rise and set times in the PDF "
"format." "format."
msgstr "" msgstr ""


#: kosmorro/__main__.py:339
#: kosmorro/__main__.py:438
msgid "Show debugging messages" msgid "Show debugging messages"
msgstr "" msgstr ""


@@ -118,76 +130,76 @@ msgid ""
"offset format." "offset format."
msgstr "" msgstr ""


#: kosmorro/dumper.py:137
#: kosmorro/dumper.py:139
msgid "Expected events:" msgid "Expected events:"
msgstr "" msgstr ""


#: kosmorro/dumper.py:144
#: kosmorro/dumper.py:146
msgid "Note: All the hours are given in UTC." msgid "Note: All the hours are given in UTC."
msgstr "" msgstr ""


#: kosmorro/dumper.py:151
#: kosmorro/dumper.py:153
msgid "Note: All the hours are given in the UTC{offset} timezone." msgid "Note: All the hours are given in the UTC{offset} timezone."
msgstr "" msgstr ""


#: kosmorro/dumper.py:205 kosmorro/dumper.py:339
#: kosmorro/dumper.py:207 kosmorro/dumper.py:342
msgid "Object" msgid "Object"
msgstr "" msgstr ""


#: kosmorro/dumper.py:206 kosmorro/dumper.py:340
#: kosmorro/dumper.py:208 kosmorro/dumper.py:343
msgid "Rise time" msgid "Rise time"
msgstr "" msgstr ""


#: kosmorro/dumper.py:207 kosmorro/dumper.py:342
#: kosmorro/dumper.py:209 kosmorro/dumper.py:345
msgid "Culmination time" msgid "Culmination time"
msgstr "" msgstr ""


#: kosmorro/dumper.py:208 kosmorro/dumper.py:344
#: kosmorro/dumper.py:210 kosmorro/dumper.py:347
msgid "Set time" msgid "Set time"
msgstr "" msgstr ""


#: kosmorro/dumper.py:234
#: kosmorro/dumper.py:237
msgid "Moon phase is unavailable for this date." msgid "Moon phase is unavailable for this date."
msgstr "" msgstr ""


#: kosmorro/dumper.py:238 kosmorro/dumper.py:348
#: kosmorro/dumper.py:241 kosmorro/dumper.py:351
msgid "Moon phase:" msgid "Moon phase:"
msgstr "" msgstr ""


#: kosmorro/dumper.py:242
#: kosmorro/dumper.py:245
msgid "{next_moon_phase} on {next_moon_phase_date} at {next_moon_phase_time}" msgid "{next_moon_phase} on {next_moon_phase_date} at {next_moon_phase_time}"
msgstr "" msgstr ""


#: kosmorro/dumper.py:312
#: kosmorro/dumper.py:315
msgid "Overview of your sky" msgid "Overview of your sky"
msgstr "" msgstr ""


#: kosmorro/dumper.py:320
#: kosmorro/dumper.py:323
msgid "" msgid ""
"This document summarizes the ephemerides and the events of {date}. It " "This document summarizes the ephemerides and the events of {date}. It "
"aims to help you to prepare your observation session. All the hours are " "aims to help you to prepare your observation session. All the hours are "
"given in {timezone}." "given in {timezone}."
msgstr "" msgstr ""


#: kosmorro/dumper.py:330
#: kosmorro/dumper.py:333
msgid "" msgid ""
"Don't forget to check the weather forecast before you go out with your " "Don't forget to check the weather forecast before you go out with your "
"equipment." "equipment."
msgstr "" msgstr ""


#: kosmorro/dumper.py:337
#: kosmorro/dumper.py:340
msgid "Ephemerides of the day" msgid "Ephemerides of the day"
msgstr "" msgstr ""


#: kosmorro/dumper.py:346
#: kosmorro/dumper.py:349
msgid "hours" msgid "hours"
msgstr "" msgstr ""


#: kosmorro/dumper.py:353
#: kosmorro/dumper.py:356
msgid "Expected events" msgid "Expected events"
msgstr "" msgstr ""


#: kosmorro/dumper.py:493
#: kosmorro/dumper.py:496
msgid "" msgid ""
"Building PDF was not possible, because some dependencies are not " "Building PDF was not possible, because some dependencies are not "
"installed.\n" "installed.\n"
@@ -195,7 +207,7 @@ msgid ""
"pdf/ for more information." "pdf/ for more information."
msgstr "" msgstr ""


#: kosmorro/dumper.py:542
#: kosmorro/dumper.py:545
#, python-format #, python-format
msgid "" msgid ""
"An error occurred during the compilation of the PDF.\n" "An error occurred during the compilation of the PDF.\n"
@@ -203,16 +215,26 @@ msgid ""
"share the content of the log file at /tmp/kosmorro-%s.log" "share the content of the log file at /tmp/kosmorro-%s.log"
msgstr "" msgstr ""


#: kosmorro/exceptions.py:35
#: kosmorro/exceptions.py:36
msgid "The date must be between {minimum_date} and {maximum_date}" msgid "The date must be between {minimum_date} and {maximum_date}"
msgstr "" msgstr ""


#: kosmorro/exceptions.py:48
#: kosmorro/exceptions.py:49
msgid "" msgid ""
"Invalid output format: {output_format}. Output file must end with: " "Invalid output format: {output_format}. Output file must end with: "
"{accepted_extensions}" "{accepted_extensions}"
msgstr "" msgstr ""


#: kosmorro/exceptions.py:60
msgid "Search end date (--until) is required when searching events."
msgstr ""

#: kosmorro/exceptions.py:68
msgid ""
"Invalid event type {event}.\n"
"Supported events are {events}."
msgstr ""

#: kosmorro/geolocation.py:14 #: kosmorro/geolocation.py:14
#, python-format #, python-format
msgid "The given position (%s) is not valid." msgid "The given position (%s) is not valid."


Загрузка…
Отмена
Сохранить