瀏覽代碼

Merge branch 'master' into features

tags/v1.0.0rc1
Jérôme Deuchnord 4 年之前
父節點
當前提交
a29ac0b8d5
共有 5 個檔案被更改,包括 95 行新增106 行删除
  1. +10
    -0
      CHANGELOG.md
  2. +1
    -1
      _kosmorro/__version__.py
  3. +12
    -7
      _kosmorro/dumper.py
  4. +5
    -8
      _kosmorro/i18n/strings.py
  5. +67
    -90
      _kosmorro/locales/messages.pot

+ 10
- 0
CHANGELOG.md 查看文件

@@ -1,3 +1,13 @@
# [v0.10.5](https://github.com/Kosmorro/kosmorro/compare/v0.10.4...v0.10.5) (2021-11-09)


### Bug Fixes

* fix a display issue on the events list when Kosmorrolib returns events not supported by the CLI ([e82af8f](https://github.com/Kosmorro/kosmorro/commit/e82af8f4b9d3a1511876718ff99d5bcc6dce9067))
* fix KeyError on events processing ([be6bf53](https://github.com/Kosmorro/kosmorro/commit/be6bf530b7c57e9a54da09c86bcca7bfcbadf595))



# [v0.10.4](https://github.com/Kosmorro/kosmorro/compare/v0.10.3...v0.10.4) (2021-11-01) # [v0.10.4](https://github.com/Kosmorro/kosmorro/compare/v0.10.3...v0.10.4) (2021-11-01)


This version is empty and contains exactly the same things as v0.10.3. This version is empty and contains exactly the same things as v0.10.3.


+ 1
- 1
_kosmorro/__version__.py 查看文件

@@ -19,7 +19,7 @@
__title__ = "kosmorro" __title__ = "kosmorro"
__description__ = "A program that computes your ephemerides" __description__ = "A program that computes your ephemerides"
__url__ = "https://kosmorro.space" __url__ = "https://kosmorro.space"
__version__ = "0.10.4"
__version__ = "0.10.5"
__author__ = "Jérôme Deuchnord" __author__ = "Jérôme Deuchnord"
__author_email__ = "jerome@deuchnord.fr" __author_email__ = "jerome@deuchnord.fr"
__license__ = "AGPL" __license__ = "AGPL"


+ 12
- 7
_kosmorro/dumper.py 查看文件

@@ -112,14 +112,16 @@ class TextDumper(Dumper):
text.append(self.get_moon(self.moon_phase)) text.append(self.get_moon(self.moon_phase))


if len(self.events) > 0: if len(self.events) > 0:
text.append(
"\n".join(
[
self.style(_("Expected events:"), "h2"),
self.get_events(self.events),
]
events = self.get_events(self.events)
if events.strip("\n") != "":
text.append(
"\n".join(
[
self.style(_("Expected events:"), "h2"),
events,
]
)
) )
)


if self.timezone == 0: if self.timezone == 0:
text.append(self.style(_("Note: All the hours are given in UTC."), "em")) text.append(self.style(_("Note: All the hours are given in UTC."), "em"))
@@ -212,6 +214,9 @@ class TextDumper(Dumper):


for event in events: for event in events:
description = strings.from_event(event) description = strings.from_event(event)
if description is None:
continue

time_fmt = ( time_fmt = (
TIME_FORMAT TIME_FORMAT
if event.start_time.day == self.date.day if event.start_time.day == self.date.day


+ 5
- 8
_kosmorro/i18n/strings.py 查看文件

@@ -1,26 +1,23 @@
#!/usr/bin/env python3 #!/usr/bin/env python3


from typing import Union
from .utils import _ from .utils import _


from kosmorrolib import EventType, MoonPhaseType, ObjectIdentifier, Event from kosmorrolib import EventType, MoonPhaseType, ObjectIdentifier, Event




def from_event(event: Event, with_description: bool = True) -> str:
def from_event(event: Event, with_description: bool = True) -> Union[None, str]:
string, details = { string, details = {
EventType.OPPOSITION: (_("%s is in opposition"), None), EventType.OPPOSITION: (_("%s is in opposition"), None),
EventType.CONJUNCTION: (_("%s and %s are in conjunction"), None), EventType.CONJUNCTION: (_("%s and %s are in conjunction"), None),
EventType.OCCULTATION: (_("%s occults %s"), None), EventType.OCCULTATION: (_("%s occults %s"), None),
EventType.MAXIMAL_ELONGATION: ( EventType.MAXIMAL_ELONGATION: (
_("Elongation of %s is maximal"), _("Elongation of %s is maximal"),
(
"{:.3n}°".format(event.details["deg"])
if type(event.details) is dict
else event.details
),
lambda e: "{:.3n}°".format(e.details["deg"]),
), ),
EventType.PERIGEE: (_("%s is at its perigee"), None), EventType.PERIGEE: (_("%s is at its perigee"), None),
EventType.APOGEE: (_("%s is at its apogee"), None), EventType.APOGEE: (_("%s is at its apogee"), None),
}.get(event.event_type)
}.get(event.event_type, (None, None))


if string is None: if string is None:
return None return None
@@ -28,7 +25,7 @@ def from_event(event: Event, with_description: bool = True) -> str:
string = string % tuple([from_object(o.identifier) for o in event.objects]) string = string % tuple([from_object(o.identifier) for o in event.objects])


if details is not None and with_description: if details is not None and with_description:
return "%s (%s)" % (string, details)
return "%s (%s)" % (string, details())


return string return string




+ 67
- 90
_kosmorro/locales/messages.pot 查看文件

@@ -6,9 +6,9 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: kosmorro 0.10.2\n"
"Project-Id-Version: kosmorro 0.10.5\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-08-26 22:07+0200\n"
"POT-Creation-Date: 2021-11-09 19:08+0100\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"
@@ -27,76 +27,76 @@ msgid ""
"offset format." "offset format."
msgstr "" msgstr ""


#: _kosmorro/dumper.py:119
#: _kosmorro/dumper.py:120
msgid "Expected events:" msgid "Expected events:"
msgstr "" msgstr ""


#: _kosmorro/dumper.py:126
#: _kosmorro/dumper.py:127
msgid "Note: All the hours are given in UTC." msgid "Note: All the hours are given in UTC."
msgstr "" msgstr ""


#: _kosmorro/dumper.py:133
#: _kosmorro/dumper.py:134
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:201 _kosmorro/dumper.py:331
#: _kosmorro/dumper.py:202 _kosmorro/dumper.py:335
msgid "Object" msgid "Object"
msgstr "" msgstr ""


#: _kosmorro/dumper.py:202 _kosmorro/dumper.py:332
#: _kosmorro/dumper.py:203 _kosmorro/dumper.py:336
msgid "Rise time" msgid "Rise time"
msgstr "" msgstr ""


#: _kosmorro/dumper.py:203 _kosmorro/dumper.py:334
#: _kosmorro/dumper.py:204 _kosmorro/dumper.py:338
msgid "Culmination time" msgid "Culmination time"
msgstr "" msgstr ""


#: _kosmorro/dumper.py:204 _kosmorro/dumper.py:336
#: _kosmorro/dumper.py:205 _kosmorro/dumper.py:340
msgid "Set time" msgid "Set time"
msgstr "" msgstr ""


#: _kosmorro/dumper.py:232
#: _kosmorro/dumper.py:236
msgid "Moon phase is unavailable for this date." msgid "Moon phase is unavailable for this date."
msgstr "" msgstr ""


#: _kosmorro/dumper.py:236 _kosmorro/dumper.py:340
#: _kosmorro/dumper.py:240 _kosmorro/dumper.py:344
msgid "Moon phase:" msgid "Moon phase:"
msgstr "" msgstr ""


#: _kosmorro/dumper.py:240
#: _kosmorro/dumper.py:244
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:304
#: _kosmorro/dumper.py:308
msgid "Overview of your sky" msgid "Overview of your sky"
msgstr "" msgstr ""


#: _kosmorro/dumper.py:312
#: _kosmorro/dumper.py:316
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:322
#: _kosmorro/dumper.py:326
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:329
#: _kosmorro/dumper.py:333
msgid "Ephemerides of the day" msgid "Ephemerides of the day"
msgstr "" msgstr ""


#: _kosmorro/dumper.py:338
#: _kosmorro/dumper.py:342
msgid "hours" msgid "hours"
msgstr "" msgstr ""


#: _kosmorro/dumper.py:345
#: _kosmorro/dumper.py:349
msgid "Expected events" msgid "Expected events"
msgstr "" msgstr ""


#: _kosmorro/dumper.py:499
#: _kosmorro/dumper.py:503
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"
@@ -104,7 +104,7 @@ msgid ""
"pdf/ for more information." "pdf/ for more information."
msgstr "" msgstr ""


#: _kosmorro/dumper.py:552
#: _kosmorro/dumper.py:556
#, 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"
@@ -116,223 +116,200 @@ msgstr ""
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:47
msgid ""
"Invalid output format: {output_format}. Output file must end with: "
"{accepted_extensions}"
msgstr ""

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

#: _kosmorro/geolocation.py:29
msgid "The given Plus Code seems to be a short code, please provide a full code."
msgstr ""

#: _kosmorro/main.py:73
#: _kosmorro/main.py:62
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:82
#: _kosmorro/main.py:71
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:132
#: _kosmorro/main.py:116
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:146
#: _kosmorro/main.py:130
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:179
#: _kosmorro/main.py:163
msgid "Moon phase can only be displayed between {min_date} and {max_date}" msgid "Moon phase can only be displayed between {min_date} and {max_date}"
msgstr "" msgstr ""


#: _kosmorro/main.py:228
#: _kosmorro/main.py:202
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:238
msgid "Do you really want to clear Kosmorro's cache? [yN] "
msgstr ""

#: _kosmorro/main.py:246
msgid "Incorrect answer, cache not cleared."
msgstr ""

#: _kosmorro/main.py:256
#: _kosmorro/main.py:215
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:259
#: _kosmorro/main.py:218
msgid "" msgid ""
"By default, only the events will be computed for today ({date}).\n" "By default, only the events will be computed for today ({date}).\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:273
#: _kosmorro/main.py:232
msgid "Show the program version" msgid "Show the program version"
msgstr "" msgstr ""


#: _kosmorro/main.py:281
msgid "Delete all the files from Kosmorro's cache."
#: _kosmorro/main.py:240
msgid "The format to output the information to"
msgstr "" msgstr ""


#: _kosmorro/main.py:289
#: _kosmorro/main.py:247
msgid "" msgid ""
"The format to output the information to. If not provided, the output "
"format will be inferred from the file extension of the output file."
"The observer's latitude on Earth. Can also be set in the "
"KOSMORRO_LATITUDE environment variable."
msgstr "" msgstr ""


#: _kosmorro/main.py:299
#: _kosmorro/main.py:257
msgid "" msgid ""
"The observer's position on Earth, in the \"{latitude},{longitude}\" "
"format.Can also be set in the KOSMORRO_POSITION environment variable."
"The observer's longitude on Earth. Can also be set in the "
"KOSMORRO_LONGITUDE environment variable."
msgstr "" msgstr ""


#: _kosmorro/main.py:309
#: _kosmorro/main.py:267
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 today ({default_date})." " and D numbers). Defaults to today ({default_date})."
msgstr "" msgstr ""


#: _kosmorro/main.py:320
#: _kosmorro/main.py:278
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:329
#: _kosmorro/main.py:287
msgid "Disable the colors in the console." msgid "Disable the colors in the console."
msgstr "" msgstr ""


#: _kosmorro/main.py:336
#: _kosmorro/main.py:294
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:345
#: _kosmorro/main.py:303
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:353
#: _kosmorro/main.py:311
msgid "Show debugging messages" msgid "Show debugging messages"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:10
#: _kosmorro/i18n/strings.py:11
#, python-format #, python-format
msgid "%s is in opposition" msgid "%s is in opposition"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:11
#: _kosmorro/i18n/strings.py:12
#, python-format #, python-format
msgid "%s and %s are in conjunction" msgid "%s and %s are in conjunction"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:12
#: _kosmorro/i18n/strings.py:13
#, python-format #, python-format
msgid "%s occults %s" msgid "%s occults %s"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:14
#: _kosmorro/i18n/strings.py:15
#, python-format #, python-format
msgid "Elongation of %s is maximal" msgid "Elongation of %s is maximal"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:21
#: _kosmorro/i18n/strings.py:18
#, python-format #, python-format
msgid "%s is at its perigee" msgid "%s is at its perigee"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:22
#: _kosmorro/i18n/strings.py:19
#, python-format #, python-format
msgid "%s is at its apogee" msgid "%s is at its apogee"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:38
#: _kosmorro/i18n/strings.py:35
msgid "New Moon" msgid "New Moon"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:39
#: _kosmorro/i18n/strings.py:36
msgid "Waxing Crescent" msgid "Waxing Crescent"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:40
#: _kosmorro/i18n/strings.py:37
msgid "First Quarter" msgid "First Quarter"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:41
#: _kosmorro/i18n/strings.py:38
msgid "Waxing Gibbous" msgid "Waxing Gibbous"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:42
#: _kosmorro/i18n/strings.py:39
msgid "Full Moon" msgid "Full Moon"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:43
#: _kosmorro/i18n/strings.py:40
msgid "Waning Gibbous" msgid "Waning Gibbous"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:44
#: _kosmorro/i18n/strings.py:41
msgid "Last Quarter" msgid "Last Quarter"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:45
#: _kosmorro/i18n/strings.py:42
msgid "Waning Crescent" msgid "Waning Crescent"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:56
#: _kosmorro/i18n/strings.py:53
msgid "Sun" msgid "Sun"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:57
#: _kosmorro/i18n/strings.py:54
msgid "Moon" msgid "Moon"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:58
#: _kosmorro/i18n/strings.py:55
msgid "Mercury" msgid "Mercury"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:59
#: _kosmorro/i18n/strings.py:56
msgid "Venus" msgid "Venus"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:60
#: _kosmorro/i18n/strings.py:57
msgid "Mars" msgid "Mars"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:61
#: _kosmorro/i18n/strings.py:58
msgid "Jupiter" msgid "Jupiter"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:62
#: _kosmorro/i18n/strings.py:59
msgid "Saturn" msgid "Saturn"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:63
#: _kosmorro/i18n/strings.py:60
msgid "Uranus" msgid "Uranus"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:64
#: _kosmorro/i18n/strings.py:61
msgid "Neptune" msgid "Neptune"
msgstr "" msgstr ""


#: _kosmorro/i18n/strings.py:65
#: _kosmorro/i18n/strings.py:62
msgid "Pluto" msgid "Pluto"
msgstr "" msgstr ""




Loading…
取消
儲存