From 988e1711dcd3bf115201ba8c1e22a8a61395a1d1 Mon Sep 17 00:00:00 2001 From: rockleona Date: Wed, 21 Feb 2024 15:34:00 +0800 Subject: [PATCH] chore: add file check rules --- Makefile | 26 ++++++-- library/tkinter.messagebox.po | 108 +++++++++++++++++++++++++--------- 2 files changed, 101 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index 643e323cbd..d7286e45d9 100644 --- a/Makefile +++ b/Makefile @@ -89,18 +89,34 @@ summarize_progress: $(VENV_FOR_SCRIPT)/bin/activate .PHONY: google_translate google_translate: $(VENV_FOR_SCRIPT)/bin/activate - if [ -z $(filter-out $@,$(MAKECMDGOALS)) ]; then \ + + @$(eval _target=$(filter-out $@, $(MAKECMDGOALS))) + @if [ -z $(_target) ]; then \ echo "Please provide a file argument."; \ exit 1; \ fi - @$(eval __target=$(filter-out $@,$(MAKECMDGOALS))) - @$(eval __filepath=$(addprefix ../,$(__target))) - @$(eval __temp_po_file=tmp.po) + + @if [ "$(suffix $(_target))" != ".po" ]; then \ + echo "Incorrect file extension. Only '.po' files are allowed."; \ + exit 1; \ + else \ + _target=$(addsuffix ,po,$(_target)); \ + fi + + @if [ ! -f "$(_target)" ]; then \ + echo "File '$(filter-out $@, $(_target))' does not exist."; \ + exit 1; \ + fi + + @$(eval _tmp_po_file=tmp.po) + @$(eval _file_path=$(addprefix ../, $(_target))) cd .scripts && \ . $(VENV_FOR_SCRIPT)/bin/activate; \ - python3 google_translate/main.py $(__filepath) > $(__temp_po_file) ; pomerge -t $(__filepath) -i $(__temp_po_file) -o $(__filepath); rm "$(__temp_po_file)" + python3 google_translate/main.py $(_file_path) > $(_tmp_po_file) ; \ + pomerge -t $(_file_path) -i $(_tmp_po_file) -o $(_file_path) ; \ + # rm $(_tmp_po_file) exit 0 diff --git a/library/tkinter.messagebox.po b/library/tkinter.messagebox.po index 8cc691f0de..a13f7b5e50 100644 --- a/library/tkinter.messagebox.po +++ b/library/tkinter.messagebox.po @@ -19,14 +19,16 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../library/tkinter.messagebox.rst:2 +#, fuzzy msgid ":mod:`tkinter.messagebox` --- Tkinter message prompts" -msgstr "" +msgstr ":mod:`tkinter.messagebox` --- Tkinter 訊息提示" #: ../../library/tkinter.messagebox.rst:8 msgid "**Source code:** :source:`Lib/tkinter/messagebox.py`" msgstr "**原始碼:**\\ :source:`Lib/tkinter/messagebox.py`" #: ../../library/tkinter.messagebox.rst:12 +#, fuzzy msgid "" "The :mod:`tkinter.messagebox` module provides a template base class as well " "as a variety of convenience methods for commonly used configurations. The " @@ -35,211 +37,261 @@ msgid "" "user's selection. Common message box styles and layouts include but are not " "limited to:" msgstr "" +"tkinter.messagebox 模組提供了模板基底類別以及各種常用配置的便捷方法。訊息框是" +"模態的,會回傳(``True``, ``False``, ``None``, :data:`OK`, :data:`CANCEL`, " +":data:`YES` 的子集, :data:`NO`) " +"基於使用者的選擇。常見的訊息框樣式和版面配置包括但不限於:" #: ../../library/tkinter.messagebox.rst:23 +#, fuzzy msgid "" "Create a message window with an application-specified message, an icon and a " "set of buttons. Each of the buttons in the message window is identified by a " "unique symbolic name (see the *type* options)." msgstr "" +"建立一個訊息\\u200b\\u200b窗口,其中包含應用程式指定的訊息、一個圖示和一組按" +"鈕。訊息視窗中的每個按鈕都由唯一的符號名稱標識(請參閱*type*選項)。" #: ../../library/tkinter.messagebox.rst:27 +#, fuzzy msgid "The following options are supported:" -msgstr "" +msgstr "支援以下選項:" #: ../../library/tkinter.messagebox.rst:33 msgid "*command*" msgstr "*command*" #: ../../library/tkinter.messagebox.rst:30 +#, fuzzy msgid "" "Specifies the function to invoke when the user closes the dialog. The name " "of the button clicked by the user to close the dialog is passed as argument. " "This is only available on macOS." -msgstr "" +msgstr "指定當使用者關閉對話方塊時要呼叫的函式。使用者按一下以關閉對話框的按鈕的名稱" +"作為參數傳遞。此功能僅適用於 macOS。" #: ../../library/tkinter.messagebox.rst:39 msgid "*default*" msgstr "*default*" #: ../../library/tkinter.messagebox.rst:36 +#, fuzzy msgid "" "Gives the :ref:`symbolic name ` of the default button " "for this message window (:data:`OK`, :data:`CANCEL`, and so on). If this " "option is not specified, the first button in the dialog will be made the " "default." msgstr "" +"給出此訊息視窗的預設按鈕的符號名稱 ((:data:`OK`、:data:`CANCEL` " +"等)。如果未指定此選項,則對話方塊中的第一個按鈕將成為預設按鈕。" #: ../../library/tkinter.messagebox.rst:46 msgid "*detail*" msgstr "*detail*" #: ../../library/tkinter.messagebox.rst:42 +#, fuzzy msgid "" "Specifies an auxiliary message to the main message given by the *message* " "option. The message detail will be presented beneath the main message and, " "where supported by the OS, in a less emphasized font than the main message." msgstr "" +"指定由 *message* 選項給出的主訊息的輔助訊息。訊息詳細資訊將顯示在主要訊息下方" +",並且在作業系統支援的情況下,將以比主要訊息更不強調的字體顯示。" #: ../../library/tkinter.messagebox.rst:51 msgid "*icon*" msgstr "*icon*" #: ../../library/tkinter.messagebox.rst:49 +#, fuzzy msgid "" "Specifies an :ref:`icon ` to display. If this option is " "not specified, then the :data:`INFO` icon will be displayed." -msgstr "" +msgstr "指定要顯示的圖示 `。如果未指定此選項,則會顯示 INFO 圖示。" #: ../../library/tkinter.messagebox.rst:55 msgid "*message*" msgstr "*message*" #: ../../library/tkinter.messagebox.rst:54 +#, fuzzy msgid "" "Specifies the message to display in this message box. The default value is " "an empty string." -msgstr "" +msgstr "指定要在此訊息框中顯示的訊息。預設值為空字串。" #: ../../library/tkinter.messagebox.rst:59 msgid "*parent*" msgstr "*parent*" #: ../../library/tkinter.messagebox.rst:58 +#, fuzzy msgid "" "Makes the specified window the logical parent of the message box. The " "message box is displayed on top of its parent window." -msgstr "" +msgstr "使指定視窗成為訊息框的邏輯父視窗。訊息框顯示在其父視窗的頂部。" #: ../../library/tkinter.messagebox.rst:64 msgid "*title*" msgstr "*title*" #: ../../library/tkinter.messagebox.rst:62 +#, fuzzy msgid "" "Specifies a string to display as the title of the message box. This option " "is ignored on macOS, where platform guidelines forbid the use of a title on " "this kind of dialog." -msgstr "" +msgstr "指定顯示為訊息框標題的字串。此選項在 macOS " +"上被忽略,其中平台指南禁止在此類對話方塊上使用標題。" #: ../../library/tkinter.messagebox.rst:68 msgid "*type*" msgstr "*type*" #: ../../library/tkinter.messagebox.rst:67 +#, fuzzy msgid "" "Arranges for a :ref:`predefined set of buttons ` to be " "displayed." -msgstr "" +msgstr "安排顯示一組預先定義的按鈕。" #: ../../library/tkinter.messagebox.rst:72 +#, fuzzy msgid "" "Display a message window and wait for the user to select one of the buttons. " "Then return the symbolic name of the selected button. Keyword arguments can " "override options specified in the constructor." -msgstr "" +msgstr "顯示訊息視窗並等待使用者選擇其中一個按鈕。然後回傳所選按鈕的符號名稱。關鍵字" +"參數可以覆寫建構函式中指定的選項。" #: ../../library/tkinter.messagebox.rst:76 +#, fuzzy msgid "**Information message box**" -msgstr "" +msgstr "**訊息訊息框**" #: ../../library/tkinter.messagebox.rst:80 +#, fuzzy msgid "" "Creates and displays an information message box with the specified title and " "message." -msgstr "" +msgstr "建立並顯示具有指定標題和訊息的資訊訊息框。" #: ../../library/tkinter.messagebox.rst:83 +#, fuzzy msgid "**Warning message boxes**" -msgstr "" +msgstr "**警告訊息框**" #: ../../library/tkinter.messagebox.rst:87 +#, fuzzy msgid "" "Creates and displays a warning message box with the specified title and " "message." -msgstr "" +msgstr "建立並顯示具有指定標題和訊息的警告訊息框。" #: ../../library/tkinter.messagebox.rst:92 +#, fuzzy msgid "" "Creates and displays an error message box with the specified title and " "message." -msgstr "" +msgstr "建立並顯示具有指定標題和訊息的錯誤訊息框。" #: ../../library/tkinter.messagebox.rst:95 +#, fuzzy msgid "**Question message boxes**" -msgstr "" +msgstr "**問題留言框**" #: ../../library/tkinter.messagebox.rst:99 +#, fuzzy msgid "" "Ask a question. By default shows buttons :data:`YES` and :data:`NO`. Returns " "the symbolic name of the selected button." -msgstr "" +msgstr "問一個問題。預設顯示按鈕:data:`YES` 和:data:`NO`。傳回所選按鈕的符號名稱。" #: ../../library/tkinter.messagebox.rst:104 +#, fuzzy msgid "" "Ask if operation should proceed. Shows buttons :data:`OK` and :data:" "`CANCEL`. Returns ``True`` if the answer is ok and ``False`` otherwise." -msgstr "" +msgstr "詢問操作是否應該繼續。顯示按鈕:data:`OK` " +"和:data:`CANCEL`。如果答案正確則傳回“True”,否則傳回“False”。" #: ../../library/tkinter.messagebox.rst:109 +#, fuzzy msgid "" "Ask if operation should be retried. Shows buttons :data:`RETRY` and :data:" "`CANCEL`. Return ``True`` if the answer is yes and ``False`` otherwise." -msgstr "" +msgstr "詢問是否應重試操作。顯示按鈕 RETRY 和 " +"CANCEL。如果答案是肯定,則傳回“True”,否則傳回“False”。" #: ../../library/tkinter.messagebox.rst:114 +#, fuzzy msgid "" "Ask a question. Shows buttons :data:`YES` and :data:`NO`. Returns ``True`` " "if the answer is yes and ``False`` otherwise." -msgstr "" +msgstr "問一個問題。顯示按鈕:data:`YES` " +"和:data:`NO`。如果答案為是,則傳回“True”,否則傳回“False”。" #: ../../library/tkinter.messagebox.rst:119 +#, fuzzy msgid "" "Ask a question. Shows buttons :data:`YES`, :data:`NO` and :data:`CANCEL`. " "Return ``True`` if the answer is yes, ``None`` if cancelled, and ``False`` " "otherwise." msgstr "" +"問一個問題。顯示按鈕:data:`YES`、:data:`NO` 和:data:`CANCEL`。如果答案是肯定" +"則回傳“True”,如果取消則回傳“None”,否則回傳“False”。" #: ../../library/tkinter.messagebox.rst:126 +#, fuzzy msgid "Symbolic names of buttons:" -msgstr "" +msgstr "按鈕的符號名稱:" #: ../../library/tkinter.messagebox.rst:145 +#, fuzzy msgid "Predefined sets of buttons:" -msgstr "" +msgstr "預定義的按鈕組:" #: ../../library/tkinter.messagebox.rst:150 +#, fuzzy msgid "" "Displays three buttons whose symbolic names are :data:`ABORT`, :data:`RETRY` " "and :data:`IGNORE`." -msgstr "" +msgstr "顯示三個按鈕,其符號名稱為:data:`ABORT`、:data:`RETRY` 和:data:`IGNORE`。" #: ../../library/tkinter.messagebox.rst:157 +#, fuzzy msgid "Displays one button whose symbolic name is :data:`OK`." -msgstr "" +msgstr "顯示一個按鈕,其符號名稱為:data:`OK`。" #: ../../library/tkinter.messagebox.rst:162 +#, fuzzy msgid "" "Displays two buttons whose symbolic names are :data:`OK` and :data:`CANCEL`." -msgstr "" +msgstr "顯示兩個按鈕,其符號名稱為:data:`OK` 和:data:`CANCEL`。" #: ../../library/tkinter.messagebox.rst:168 +#, fuzzy msgid "" "Displays two buttons whose symbolic names are :data:`RETRY` and :data:" "`CANCEL`." -msgstr "" +msgstr "顯示兩個按鈕,其符號名稱為 RETRY 和 CANCEL。" #: ../../library/tkinter.messagebox.rst:174 +#, fuzzy msgid "" "Displays two buttons whose symbolic names are :data:`YES` and :data:`NO`." -msgstr "" +msgstr "顯示兩個按鈕,其符號名稱為:data:`YES` 和:data:`NO`。" #: ../../library/tkinter.messagebox.rst:180 +#, fuzzy msgid "" "Displays three buttons whose symbolic names are :data:`YES`, :data:`NO` and :" "data:`CANCEL`." -msgstr "" +msgstr "顯示三個按鈕,其符號名稱為:data:`YES`、:data:`NO` 和:data:`CANCEL`。" #: ../../library/tkinter.messagebox.rst:185 +#, fuzzy msgid "Icon images:" -msgstr "" +msgstr "圖標圖像:"