瀏覽代碼

Merge pull request #435 from Kosmorro/fix/exception-management

pull/437/head
Deuchnord 3 週之前
committed by GitHub
父節點
當前提交
b1dad381b5
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: B5690EEEBB952194
共有 2 個檔案被更改,包括 29 行新增26 行删除
  1. +7
    -4
      kosmorro/__main__.py
  2. +22
    -22
      kosmorro/locales/messages.pot

+ 7
- 4
kosmorro/__main__.py 查看文件

@@ -68,10 +68,13 @@ def run():
return -1 return -1


position = None position = None
if args.position not in [None, ""]:
position = get_position(args.position)
elif env_vars.position not in [None, ""]:
position = get_position(env_vars.position)
try:
if args.position not in [None, ""]:
position = get_position(args.position)
elif env_vars.position not in [None, ""]:
position = get_position(env_vars.position)
except ValueError as e:
print_stderr(colored(e.args[0], color="red", attrs=["bold"]))


# if output format is not specified, try to use output file extension as output format # if output format is not specified, try to use output file extension as output format
if args.output is not None and output_format is None: if args.output is not None and output_format is None:


+ 22
- 22
kosmorro/locales/messages.pot 查看文件

@@ -8,7 +8,7 @@ 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: 2025-11-09 11:42+0100\n"
"POT-Creation-Date: 2025-11-11 11:06+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"
@@ -17,86 +17,86 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.17.0\n" "Generated-By: Babel 2.17.0\n"


#: kosmorro/__main__.py:89
#: kosmorro/__main__.py:92
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:97
#: kosmorro/__main__.py:100
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:115
#: kosmorro/__main__.py:118
msgid "" msgid ""
"Environment variable KOSMORRO_TIMEZONE is deprecated. Use TZ instead, " "Environment variable KOSMORRO_TIMEZONE is deprecated. Use TZ instead, "
"which is more standard." "which is more standard."
msgstr "" msgstr ""


#: kosmorro/__main__.py:124
#: kosmorro/__main__.py:127
#, python-brace-format #, python-brace-format
msgid "Unknown timezone: {timezone}" msgid "Unknown timezone: {timezone}"
msgstr "" msgstr ""


#: kosmorro/__main__.py:167
#: kosmorro/__main__.py:170
#, python-brace-format #, python-brace-format
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:181
#: kosmorro/__main__.py:184
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:213
#: kosmorro/__main__.py:216
#, python-brace-format #, python-brace-format
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:264
#: kosmorro/__main__.py:267
#, python-brace-format #, python-brace-format
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:277
#: kosmorro/__main__.py:280
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:280
#: kosmorro/__main__.py:283
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:292
#: kosmorro/__main__.py:295
msgid "Show the program version" msgid "Show the program version"
msgstr "" msgstr ""


#: kosmorro/__main__.py:301
#: kosmorro/__main__.py:304
msgid "" msgid ""
"The output format. If not provided, it will be inferred from the file " "The output format. If not provided, it will be inferred from the file "
"extension of the output file." "extension of the output file."
msgstr "" msgstr ""


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


#: kosmorro/__main__.py:320
#: kosmorro/__main__.py:323
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:331
#: kosmorro/__main__.py:334
msgid "" msgid ""
"The timezone to use to display the hours. It can be either a number (e.g." "The timezone to use to display the hours. It can be either a number (e.g."
" 1 for UTC+1) or a timezone name (e.g. Europe/Paris). See " " 1 for UTC+1) or a timezone name (e.g. Europe/Paris). See "
@@ -104,29 +104,29 @@ msgid ""
" timezone. Can also be set in the TZ environment variable." " timezone. Can also be set in the TZ environment variable."
msgstr "" msgstr ""


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


#: kosmorro/__main__.py:347
#: kosmorro/__main__.py:350
msgid "Use this option to save the result in a file." msgid "Use this option to save the result in a file."
msgstr "" msgstr ""


#: kosmorro/__main__.py:354
#: kosmorro/__main__.py:357
msgid "" msgid ""
"Do not generate a graph to represent the rise and set times in the LaTeX " "Do not generate a graph to represent the rise and set times in the LaTeX "
"or PDF file." "or PDF file."
msgstr "" msgstr ""


#: kosmorro/__main__.py:361
#: kosmorro/__main__.py:364
msgid "Show debugging messages" msgid "Show debugging messages"
msgstr "" msgstr ""


#: kosmorro/__main__.py:369
#: kosmorro/__main__.py:372
msgid "Print a script allowing completion for your shell" msgid "Print a script allowing completion for your shell"
msgstr "" msgstr ""


#: kosmorro/__main__.py:379
#: kosmorro/__main__.py:382
msgid "No completion script available for this shell." msgid "No completion script available for this shell."
msgstr "" msgstr ""




Loading…
取消
儲存