Plugin Directory

Changeset 3379285


Ignore:
Timestamp:
10/16/2025 07:45:25 AM (4 months ago)
Author:
kasuga16
Message:

Added the auto translatable tool using Google API or DeepL API.
Made minor fixes.

Location:
quick-translate-pot-po-mo
Files:
20 added
7 edited

Legend:

Unmodified
Added
Removed
  • quick-translate-pot-po-mo/trunk/assets/qtppm-admin.css

    r3373612 r3379285  
    1212    align-items: center;
    1313}
     14
    1415.mmpt-modal-content {
    1516    background-color: #fefefe;
     
    2122    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    2223}
     24
    2325.mmpt-close-button {
    2426    color: #aaa;
     
    2830    cursor: pointer;
    2931}
     32
    3033.mmpt-close-button:hover,
    3134.mmpt-close-button:focus {
     
    3336    text-decoration: none;
    3437}
     38
     39#mmpt-link-btn {
     40    margin-left: 30px;
     41}
  • quick-translate-pot-po-mo/trunk/assets/qtppm-admin.js

    r3373612 r3379285  
    308308    });
    309309
     310    $('#mmpt-link-btn').on('click', function(e) {
     311        e.preventDefault();
     312        showModal(
     313            QuickTranslate.i18n.confirm_auto_fill,
     314            true,
     315            function() {
     316                window.location.href = QuickTranslate.admin_url_auto_translator;
     317            }
     318        );
     319    });
     320
    310321})(jQuery);
  • quick-translate-pot-po-mo/trunk/languages/quick-translate-pot-po-mo-ja.po

    r3372110 r3379285  
    11msgid ""
    22msgstr ""
    3 "Project-Id-Version: Quick Translate POT/PO/MO 1.1.0\n"
     3"Project-Id-Version: Quick Translate POT/PO/MO 2.0.0\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2025-10-01 10:34:18+0000\n"
    6 "PO-Revision-Date: 2025-10-01 10:35:27+0000\n"
     5"POT-Creation-Date: 2025-10-16 03:05:57+0000\n"
     6"PO-Revision-Date: 2025-10-16 03:10:54+0000\n"
    77"Last-Translator: Kasuga\n"
    88"Language-Team: \n"
     
    1717msgstr "Quick Translate POT/PO/MO"
    1818
    19 msgid "With this plugin, you can easily generate and edit a plugin’s translation files, and quickly apply the results."
    20 msgstr "このプラグインを使えば、プラグインの翻訳ファイルを簡単に生成・編集し、その結果を素早く反映できます。"
     19msgid "With this plugin, you can easily generate and edit a plugin’s translation files, quickly apply the results, and even automatically translate them using Google Translate or DeepL."
     20msgstr "このプラグインを使うと、プラグインの翻訳ファイルを簡単に生成・編集でき、結果をすばやく適用できます。さらに、Google Translate や DeepL を使って自動翻訳することもできます。"
    2121
    2222msgid "Kasuga"
    2323msgstr "Kasuga"
    2424
     25msgid "Auto Translator Tool"
     26msgstr "自動翻訳ツール"
     27
     28msgid "Auto Translator"
     29msgstr "自動翻訳"
     30
     31msgid "PO Auto Fill (Auto Translation Tool)"
     32msgstr "PO Auto Fill(自動翻訳ツール)"
     33
     34msgid "This tool automatically translates untranslated strings in PO files using the Google or DeepL API."
     35msgstr "このツールは、Google または DeepL API を使用して、PO ファイル内の未翻訳文字列を自動的に翻訳します。"
     36
     37msgid "* To use this feature, you need to register for the Google API or DeepL API and obtain an API key."
     38msgstr "※この機能を利用するには、Google API または DeepL API に登録し、API キーを取得する必要があります。"
     39
     40msgid "Target Plugin:"
     41msgstr "対象プラグイン:"
     42
     43msgid "Select a Plugin"
     44msgstr "プラグインの選択"
     45
     46msgid "The PO file corresponding to the <strong><code>%s</code></strong> locale will be used."
     47msgstr "対応するPOファイルは<strong><code>%s</code></strong>ロケールが使用されます。"
     48
     49msgid "Select Translation API:"
     50msgstr "翻訳APIを選択:"
     51
     52msgid "Google API Key:"
     53msgstr "Google APIキー:"
     54
     55msgid "Save Key"
     56msgstr "保存キー"
     57
     58msgid "DeepL API Key:"
     59msgstr "DeepL APIキー:"
     60
     61msgid "Translation Preview"
     62msgstr "翻訳プレビュー"
     63
     64msgid "Save"
     65msgstr "保存"
     66
     67msgid "Back to \"Quick Translate POT/PO/MO\""
     68msgstr "「Quick Translate POT/PO/MO」に戻る"
     69
     70msgid "Press the Preview button to translate untranslated strings and display the results."
     71msgstr "プレビューボタンを押すと、翻訳されていない文字列が翻訳され、結果が表示されます。"
     72
     73msgid "Insufficient permissions."
     74msgstr "権限が不十分です。"
     75
     76msgid "Invalid API service specified."
     77msgstr "無効なAPIサービスが指定されました。"
     78
     79msgid "API key cannot be empty."
     80msgstr "APIキーを入力して下さい。"
     81
     82msgid "API key saved."
     83msgstr "APIキーが保存されました。"
     84
     85msgid "Plugin is not selected."
     86msgstr "プラグインが選択されていません。"
     87
     88msgid "API key is not entered."
     89msgstr "APIキーが入力されていません。"
     90
     91msgid "PO file not found. Expected paths: %s"
     92msgstr "POファイルが見つかりません。想定されるパス: %s"
     93
     94msgid "Failed to read PO file."
     95msgstr "POファイルの読み取りに失敗しました。"
     96
     97msgid "No untranslated strings found."
     98msgstr "翻訳済み"
     99
     100msgid "API communication error: "
     101msgstr "API通信エラー: "
     102
     103msgid "msgid (Source String)"
     104msgstr "msgid (原文)"
     105
     106msgid "msgstr (Translation)"
     107msgstr "msgstr (翻訳)"
     108
     109msgid "Translation preview completed."
     110msgstr "翻訳プレビューが完了しました。"
     111
     112msgid "Invalid file path."
     113msgstr "ファイルパスが無効です。"
     114
     115msgid "Invalid file path: Must be within wp-content."
     116msgstr "無効なファイルパス: wp-content内にある必要があります。"
     117
     118msgid "Invalid file path: Security check failed."
     119msgstr "無効なファイルパス: セキュリティチェックに失敗しました。"
     120
     121msgid "PO file does not exist or is not readable."
     122msgstr "POファイルが存在しないか、読み取り不可です。"
     123
     124msgid "PO file is not writable. Check file permissions."
     125msgstr "POファイルは書き込み不可です。ファイルの権限を確認してください。"
     126
     127msgid "Failed to write to PO file."
     128msgstr "POファイルへの書き込みに失敗しました。"
     129
     130msgid "%s string translated and saved to PO file."
     131msgstr "%s文字列が翻訳され、POファイルに保存されました。"
     132
     133msgid "Service, key, or target strings are missing."
     134msgstr "サービス、キー、またはターゲット文字列がありません。"
     135
     136msgid "HTTP %1$s: %2$s"
     137msgstr "HTTP %1$s : %2$s"
     138
     139msgid "Unknown HTTP error"
     140msgstr "不明なHTTPエラー"
     141
     142msgid "Google API Error"
     143msgstr "Google API エラー"
     144
     145msgid "Failed to parse Google API response"
     146msgstr "Google API レスポンスの解析に失敗しました"
     147
     148msgid "No response body"
     149msgstr "応答本文なし"
     150
     151msgid "DeepL API Error: %s"
     152msgstr "DeepL API エラー: %s"
     153
     154msgid "Failed to parse DeepL API response"
     155msgstr "DeepL API レスポンスの解析に失敗しました"
     156
     157msgid "Unsupported translation service"
     158msgstr "サポートされていない翻訳サービス"
     159
     160msgid "Saving API key..."
     161msgstr "APIキーを保存しています..."
     162
     163msgid "API key saved successfully."
     164msgstr "APIキーが正常に保存されました。"
     165
     166msgid "Failed to save API key."
     167msgstr "APIキーの保存に失敗しました。"
     168
     169msgid "Failed to retrieve operation result."
     170msgstr "操作結果を取得できませんでした。"
     171
     172msgid "Failed to communicate with the server."
     173msgstr "サーバーとの通信に失敗しました。"
     174
     175msgid "Fetching untranslated strings and calling API..."
     176msgstr "翻訳されていない文字列を取得して APIを呼び出しています..."
     177
     178msgid "Preview failed:"
     179msgstr "プレビューに失敗しました:"
     180
     181msgid "API key is not set."
     182msgstr "APIキーが設定されていません。"
     183
     184msgid "No plugin selected."
     185msgstr "プラグインが選択されていません。"
     186
     187msgid "Selected API"
     188msgstr "選択されたAPI"
     189
     190msgid "Please save the key for %s."
     191msgstr "%sのキーを保存してください。"
     192
     193msgid "Translating..."
     194msgstr "翻訳中..."
     195
     196msgid "Translation completed."
     197msgstr "翻訳が完了しました。"
     198
     199msgid "string(s) are ready to be saved."
     200msgstr "文字列を保存する準備ができました。"
     201
     202msgid "No new strings were found for translation."
     203msgstr "翻訳用の新しい文字列は見つかりませんでした。"
     204
     205msgid "Translation process failed."
     206msgstr "翻訳プロセスに失敗しました。"
     207
     208msgid "Server Response"
     209msgstr "サーバー応答"
     210
     211msgid "No response from the server."
     212msgstr "サーバーからの応答がありません。"
     213
     214msgid "Saving to PO file..."
     215msgstr "POファイルに保存しています..."
     216
     217msgid "Save successful!"
     218msgstr "保存しました。"
     219
     220msgid "Save failed:"
     221msgstr "保存に失敗しました:"
     222
     223msgid "The untranslated parts of the PO file (<code>%s</code>) will be overwritten."
     224msgstr "POファイルの未翻訳部分( <code>%s</code> )は上書きされます。"
     225
     226msgid "This action cannot be undone. Are you sure you want to proceed?"
     227msgstr "この操作は元に戻せません。続行してもよろしいですか?"
     228
     229msgid "Save process completed."
     230msgstr "保存処理が完了しました。"
     231
     232msgid "Processing..."
     233msgstr "処理中..."
     234
     235msgid "Yes, Overwrite and Save"
     236msgstr "はい、上書きして保存します。"
     237
     238msgid "Close"
     239msgstr "閉じる"
     240
    25241msgid "Tools"
    26242msgstr "ツール"
    27243
    28 msgid "Quick Translation Tool (plugin's POT/PO/MO Generator & Editor)"
    29 msgstr "プラグイン翻訳ファイルツール(POT/PO/MOファイルの生成・編集ツール)"
    30 
    31 msgid "Quick Translation Tool (POT/PO/MO)"
    32 msgstr "Quick Translation Tool (POT/PO/MO)"
    33 
    34 msgid "Please select a plugin."
    35 msgstr "プラグインを選択してください。"
     244msgid "Quick Translate POT/PO/MO (plugin's POT/PO/MO Generator & Editor)"
     245msgstr "Quick Translate POT/PO/MO (POT/PO/MOファイルの生成と編集)"
    36246
    37247msgid "Loading..."
     
    78288
    79289msgid "No internationalization functions (like __(), _e(), etc.) were found in the plugin. POT/PO files cannot be created."
    80 msgstr "プラグイン内に国際化関数(__()、_e()など)が見つかりませんでした。POT/PO ファイルを作成できません。"
     290msgstr "プラグイン内に国際化関数(__()、_e()など)が見つかりませんでした。POT/POファイルを作成できません。"
    81291
    82292msgid "Are you sure you want to delete the MO file? This action cannot be undone."
     
    98308msgstr "この翻訳エントリを削除してもよろしいですか?保存すると完全に削除されます。"
    99309
     310msgid "POT file not found."
     311msgstr "POTファイルが見つかりません。"
     312
     313msgid "PO file not found."
     314msgstr "POファイルが見つかりません。"
     315
     316msgid "MO file not found."
     317msgstr "MOファイルが見つかりません。"
     318
     319msgid "You are about to move to \"PO Auto Fill\". Continue?"
     320msgstr "「PO Auto Fill」へ移動します。続行しますか?"
     321
     322msgid "Plugin not found."
     323msgstr "プラグインが見つかりません。"
     324
     325msgid "* For the <strong><code>%s</code></strong> locale, the POT, PO, and MO files will be used. The following operations will be performed on the <em>languages</em> folder inside the currently selected plugin."
     326msgstr "<strong><code>%s</code></strong> ロケールでのPOT、PO、MOファイルが使用されます。 <br>以下の操作は、現在選択されているプラグイン内の <em>languages</em>フォルダーに対して実行されます。"
     327
     328msgid "1. Generate POT file"
     329msgstr "1. POTファイルの生成"
     330
     331msgid "Generates the latest POT file based on the selected plugin’s source code."
     332msgstr "選択したプラグインのソースコードをもとに、最新のPOTファイルを生成します。"
     333
     334msgid "Generate POT"
     335msgstr "POTの生成"
     336
     337msgid "Download POT"
     338msgstr "POTをダウンロード"
     339
     340msgid "2. Generate / Update PO file from POT"
     341msgstr "2. POTファイルからPOファイルを生成/更新"
     342
     343msgid "When updating a PO file, the existing translations (msgstr) corresponding to the strings (msgid) in the POT file are preserved in the updated PO file."
     344msgstr "POファイルを更新する際、POTファイルの文字列(msgid)に対応する既存の翻訳(msgstr)は、更新後のPOファイルに保持されます。"
     345
     346msgid "Generate / Update PO"
     347msgstr "POを生成/更新"
     348
     349msgid "Download PO"
     350msgstr "POをダウンロード"
     351
     352msgid "Go to \"PO Auto Fill\" (Auto Translation Tool)"
     353msgstr "\"PO Auto Fill\" (自動翻訳ツール)へ移動"
     354
     355msgid "3. Edit PO file & Generate MO file"
     356msgstr "3. POファイルを編集してMOファイルを生成"
     357
     358msgid "Changes in the editor are saved to the PO file and the MO file is generated simultaneously only when you click the \"Save Changes and Generate MO\" button. The MO file is a binary file that WordPress uses to actually display translations."
     359msgstr "エディターでの変更は、「変更を保存してMOファイルを生成」ボタンをクリックしたときにのみPOファイルへ保存され、同時にMOファイルが生成されます。MOファイルは、WordPressが実際に翻訳を表示する際に使用するバイナリファイルです。"
     360
     361msgid "Load PO"
     362msgstr "POの読み込み"
     363
     364msgid "Delete MO"
     365msgstr "MOを削除"
     366
     367msgid "Download MO"
     368msgstr "MOをダウンロード"
     369
     370msgid "Save Changes and Generate MO"
     371msgstr "変更を保存してMOを生成"
     372
     373msgid "Yes"
     374msgstr "はい"
     375
     376msgid "No"
     377msgstr "いいえ"
     378
     379msgid "You do not have permission. Please log in as an administrator."
     380msgstr "権限がありません。管理者としてログインしてください。"
     381
     382msgid "Failed to parse PO file."
     383msgstr "POファイルの解析に失敗しました。"
     384
     385msgid "WP_Filesystem could not be initialized. Please check your file permissions or credentials."
     386msgstr "WP_Filesystem を初期化できませんでした。ファイルのパーミッションまたは認証情報を確認してください。"
     387
     388msgid "Failed to read file. Please check file permissions."
     389msgstr "ファイルの読み取りに失敗しました。ファイルのパーミッションを確認してください。"
     390
     391msgid "Failed to create the directory. Please check file permissions."
     392msgstr "ディレクトリの作成に失敗しました。ファイルのパーミッションを確認してください。"
     393
     394msgid "Failed to delete file. Please check file permissions."
     395msgstr "ファイルの削除に失敗しました。ファイルのパーミッションを確認してください。"
     396
    100397msgid "POT file not found. Please generate it first."
    101398msgstr "POTファイルが見つかりません。まず生成してください。"
    102399
    103 msgid "PO file not found. Please generate it first."
    104 msgstr "POファイルが見つかりません。まず生成してください。"
    105 
    106 msgid "MO file not found. Please generate it first."
    107 msgstr "MOファイルが見つかりません。まず生成してください。"
    108 
    109 msgid "Plugin not found."
    110 msgstr "プラグインが見つかりません。"
    111 
    112 msgid "* The following operations will be performed on the languages folder located inside the currently selected plugin."
    113 msgstr "* 以下の操作は、選択中のプラグイン内にあるlanguagesフォルダを対象に行われます。"
    114 
    115 msgid "1. Generate POT file"
    116 msgstr "1. POTファイルの生成"
    117 
    118 msgid "Generates the latest POT file based on the selected plugin’s source code."
    119 msgstr "選択したプラグインのソースコードをもとに、最新のPOTファイルを生成します。"
    120 
    121 msgid "Target Plugin:"
    122 msgstr "対象プラグイン"
    123 
    124 msgid "Select"
    125 msgstr "選択"
    126 
    127 msgid "Generate POT"
    128 msgstr "POTの生成"
    129 
    130 msgid "Download POT"
    131 msgstr "POTをダウンロード"
    132 
    133 msgid "2. Generate / Update PO file from POT"
    134 msgstr "2. POTファイルからPOファイルを生成/更新"
    135 
    136 msgid "When updating a PO file, the existing translations (msgstr) corresponding to the strings (msgid) in the POT file are preserved in the updated PO file."
    137 msgstr "POファイルを更新する際、POTファイルの文字列(msgid)に対応する既存の翻訳(msgstr)は、更新後のPOファイルに保持されます。"
    138 
    139 msgid "Generate / Update PO"
    140 msgstr "POを生成/更新"
    141 
    142 msgid "Download PO"
    143 msgstr "POをダウンロード"
    144 
    145 msgid "3. Edit PO file & Generate MO file"
    146 msgstr "3. POファイルを編集してMOファイルを生成"
    147 
    148 msgid "Changes in the editor are saved to the PO file and the MO file is generated simultaneously only when you click the \"Save Changes and Generate MO\" button. The MO file is a binary file that WordPress uses to actually display translations."
    149 msgstr "エディターでの変更は、「変更を保存してMOファイルを生成」ボタンをクリックしたときにのみPOファイルへ保存され、同時にMOファイルが生成されます。MOファイルは、WordPressが実際に翻訳を表示する際に使用するバイナリファイルです。"
    150 
    151 msgid "Select a Plugin"
    152 msgstr "プラグインの選択"
    153 
    154 msgid "Load PO"
    155 msgstr "POの読み込み"
    156 
    157 msgid "Delete MO"
    158 msgstr "MOを削除"
    159 
    160 msgid "Download MO"
    161 msgstr "MOをダウンロード"
    162 
    163 msgid "Save Changes and Generate MO"
    164 msgstr "変更を保存してMOを生成"
    165 
    166 msgid "Yes"
    167 msgstr "はい"
    168 
    169 msgid "No"
    170 msgstr "いいえ"
    171 
    172 msgid "Close"
    173 msgstr "閉じる"
    174 
    175 msgid "You do not have permission. Please log in as an administrator."
    176 msgstr "権限がありません。管理者としてログインしてください。"
    177 
    178 msgid "Failed to parse PO file."
    179 msgstr "POファイルの解析に失敗しました。"
    180 
    181 msgid "msgid (Source String)"
    182 msgstr "msgid (原文)"
    183 
    184 msgid "msgstr (Translation)"
    185 msgstr "msgstr (翻訳)"
    186 
    187 msgid "PO file not found."
    188 msgstr "POファイルが見つかりません。"
    189 
    190 msgid "WP_Filesystem could not be initialized. Please check your file permissions or credentials."
    191 msgstr "WP_Filesystem を初期化できませんでした。ファイルのパーミッションまたは認証情報を確認してください。"
    192 
    193 msgid "Failed to read file. Please check file permissions."
    194 msgstr "ファイルの読み取りに失敗しました。ファイルのパーミッションを確認してください。"
    195 
    196 msgid "Failed to create the directory. Please check file permissions."
    197 msgstr "ディレクトリの作成に失敗しました。ファイルのパーミッションを確認してください。"
    198 
    199 msgid "Failed to delete file. Please check file permissions."
    200 msgstr "ファイルの削除に失敗しました。ファイルのパーミッションを確認してください。"
    201 
  • quick-translate-pot-po-mo/trunk/languages/quick-translate-pot-po-mo.pot

    r3372110 r3379285  
    11msgid ""
    22msgstr ""
    3 "Project-Id-Version: Quick Translate POT/PO/MO 1.1.0\n"
     3"Project-Id-Version: Quick Translate POT/PO/MO 2.0.0\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2025-10-01 10:34:18+0000\n"
     5"POT-Creation-Date: 2025-10-16 03:05:57+0000\n"
    66"PO-Revision-Date: \n"
    77"Last-Translator: \n"
     
    1717msgstr ""
    1818
    19 msgid "With this plugin, you can easily generate and edit a plugin’s translation files, and quickly apply the results."
     19msgid "With this plugin, you can easily generate and edit a plugin’s translation files, quickly apply the results, and even automatically translate them using Google Translate or DeepL."
    2020msgstr ""
    2121
     
    2323msgstr ""
    2424
     25msgid "Auto Translator Tool"
     26msgstr ""
     27
     28msgid "Auto Translator"
     29msgstr ""
     30
     31msgid "PO Auto Fill (Auto Translation Tool)"
     32msgstr ""
     33
     34msgid "This tool automatically translates untranslated strings in PO files using the Google or DeepL API."
     35msgstr ""
     36
     37msgid "* To use this feature, you need to register for the Google API or DeepL API and obtain an API key."
     38msgstr ""
     39
     40msgid "Target Plugin:"
     41msgstr ""
     42
     43msgid "Select a Plugin"
     44msgstr ""
     45
     46msgid "The PO file corresponding to the <strong><code>%s</code></strong> locale will be used."
     47msgstr ""
     48
     49msgid "Select Translation API:"
     50msgstr ""
     51
     52msgid "Google API Key:"
     53msgstr ""
     54
     55msgid "Save Key"
     56msgstr ""
     57
     58msgid "DeepL API Key:"
     59msgstr ""
     60
     61msgid "Translation Preview"
     62msgstr ""
     63
     64msgid "Save"
     65msgstr ""
     66
     67msgid "Back to \"Quick Translate POT/PO/MO\""
     68msgstr ""
     69
     70msgid "Press the Preview button to translate untranslated strings and display the results."
     71msgstr ""
     72
     73msgid "Insufficient permissions."
     74msgstr ""
     75
     76msgid "Invalid API service specified."
     77msgstr ""
     78
     79msgid "API key cannot be empty."
     80msgstr ""
     81
     82msgid "API key saved."
     83msgstr ""
     84
     85msgid "Plugin is not selected."
     86msgstr ""
     87
     88msgid "API key is not entered."
     89msgstr ""
     90
     91msgid "PO file not found. Expected paths: %s"
     92msgstr ""
     93
     94msgid "Failed to read PO file."
     95msgstr ""
     96
     97msgid "No untranslated strings found."
     98msgstr ""
     99
     100msgid "API communication error: "
     101msgstr ""
     102
     103msgid "msgid (Source String)"
     104msgstr ""
     105
     106msgid "msgstr (Translation)"
     107msgstr ""
     108
     109msgid "Translation preview completed."
     110msgstr ""
     111
     112msgid "Invalid file path."
     113msgstr ""
     114
     115msgid "Invalid file path: Must be within wp-content."
     116msgstr ""
     117
     118msgid "Invalid file path: Security check failed."
     119msgstr ""
     120
     121msgid "PO file does not exist or is not readable."
     122msgstr ""
     123
     124msgid "PO file is not writable. Check file permissions."
     125msgstr ""
     126
     127msgid "Failed to write to PO file."
     128msgstr ""
     129
     130msgid "%s string translated and saved to PO file."
     131msgstr ""
     132
     133msgid "Service, key, or target strings are missing."
     134msgstr ""
     135
     136msgid "HTTP %1$s: %2$s"
     137msgstr ""
     138
     139msgid "Unknown HTTP error"
     140msgstr ""
     141
     142msgid "Google API Error"
     143msgstr ""
     144
     145msgid "Failed to parse Google API response"
     146msgstr ""
     147
     148msgid "No response body"
     149msgstr ""
     150
     151msgid "DeepL API Error: %s"
     152msgstr ""
     153
     154msgid "Failed to parse DeepL API response"
     155msgstr ""
     156
     157msgid "Unsupported translation service"
     158msgstr ""
     159
     160msgid "Saving API key..."
     161msgstr ""
     162
     163msgid "API key saved successfully."
     164msgstr ""
     165
     166msgid "Failed to save API key."
     167msgstr ""
     168
     169msgid "Failed to retrieve operation result."
     170msgstr ""
     171
     172msgid "Failed to communicate with the server."
     173msgstr ""
     174
     175msgid "Fetching untranslated strings and calling API..."
     176msgstr ""
     177
     178msgid "Preview failed:"
     179msgstr ""
     180
     181msgid "API key is not set."
     182msgstr ""
     183
     184msgid "No plugin selected."
     185msgstr ""
     186
     187msgid "Selected API"
     188msgstr ""
     189
     190msgid "Please save the key for %s."
     191msgstr ""
     192
     193msgid "Translating..."
     194msgstr ""
     195
     196msgid "Translation completed."
     197msgstr ""
     198
     199msgid "string(s) are ready to be saved."
     200msgstr ""
     201
     202msgid "No new strings were found for translation."
     203msgstr ""
     204
     205msgid "Translation process failed."
     206msgstr ""
     207
     208msgid "Server Response"
     209msgstr ""
     210
     211msgid "No response from the server."
     212msgstr ""
     213
     214msgid "Saving to PO file..."
     215msgstr ""
     216
     217msgid "Save successful!"
     218msgstr ""
     219
     220msgid "Save failed:"
     221msgstr ""
     222
     223msgid "The untranslated parts of the PO file (<code>%s</code>) will be overwritten."
     224msgstr ""
     225
     226msgid "This action cannot be undone. Are you sure you want to proceed?"
     227msgstr ""
     228
     229msgid "Save process completed."
     230msgstr ""
     231
     232msgid "Processing..."
     233msgstr ""
     234
     235msgid "Yes, Overwrite and Save"
     236msgstr ""
     237
     238msgid "Close"
     239msgstr ""
     240
    25241msgid "Tools"
    26242msgstr ""
    27243
    28 msgid "Quick Translation Tool (plugin's POT/PO/MO Generator & Editor)"
    29 msgstr ""
    30 
    31 msgid "Quick Translation Tool (POT/PO/MO)"
    32 msgstr ""
    33 
    34 msgid "Please select a plugin."
     244msgid "Quick Translate POT/PO/MO (plugin's POT/PO/MO Generator & Editor)"
    35245msgstr ""
    36246
     
    98308msgstr ""
    99309
     310msgid "POT file not found."
     311msgstr ""
     312
     313msgid "PO file not found."
     314msgstr ""
     315
     316msgid "MO file not found."
     317msgstr ""
     318
     319msgid "You are about to move to \"PO Auto Fill\". Continue?"
     320msgstr ""
     321
     322msgid "Plugin not found."
     323msgstr ""
     324
     325msgid "* For the <strong><code>%s</code></strong> locale, the POT, PO, and MO files will be used. The following operations will be performed on the <em>languages</em> folder inside the currently selected plugin."
     326msgstr ""
     327
     328msgid "1. Generate POT file"
     329msgstr ""
     330
     331msgid "Generates the latest POT file based on the selected plugin’s source code."
     332msgstr ""
     333
     334msgid "Generate POT"
     335msgstr ""
     336
     337msgid "Download POT"
     338msgstr ""
     339
     340msgid "2. Generate / Update PO file from POT"
     341msgstr ""
     342
     343msgid "When updating a PO file, the existing translations (msgstr) corresponding to the strings (msgid) in the POT file are preserved in the updated PO file."
     344msgstr ""
     345
     346msgid "Generate / Update PO"
     347msgstr ""
     348
     349msgid "Download PO"
     350msgstr ""
     351
     352msgid "Go to \"PO Auto Fill\" (Auto Translation Tool)"
     353msgstr ""
     354
     355msgid "3. Edit PO file & Generate MO file"
     356msgstr ""
     357
     358msgid "Changes in the editor are saved to the PO file and the MO file is generated simultaneously only when you click the \"Save Changes and Generate MO\" button. The MO file is a binary file that WordPress uses to actually display translations."
     359msgstr ""
     360
     361msgid "Load PO"
     362msgstr ""
     363
     364msgid "Delete MO"
     365msgstr ""
     366
     367msgid "Download MO"
     368msgstr ""
     369
     370msgid "Save Changes and Generate MO"
     371msgstr ""
     372
     373msgid "Yes"
     374msgstr ""
     375
     376msgid "No"
     377msgstr ""
     378
     379msgid "You do not have permission. Please log in as an administrator."
     380msgstr ""
     381
     382msgid "Failed to parse PO file."
     383msgstr ""
     384
     385msgid "WP_Filesystem could not be initialized. Please check your file permissions or credentials."
     386msgstr ""
     387
     388msgid "Failed to read file. Please check file permissions."
     389msgstr ""
     390
     391msgid "Failed to create the directory. Please check file permissions."
     392msgstr ""
     393
     394msgid "Failed to delete file. Please check file permissions."
     395msgstr ""
     396
    100397msgid "POT file not found. Please generate it first."
    101398msgstr ""
    102399
    103 msgid "PO file not found. Please generate it first."
    104 msgstr ""
    105 
    106 msgid "MO file not found. Please generate it first."
    107 msgstr ""
    108 
    109 msgid "Plugin not found."
    110 msgstr ""
    111 
    112 msgid "* The following operations will be performed on the languages folder located inside the currently selected plugin."
    113 msgstr ""
    114 
    115 msgid "1. Generate POT file"
    116 msgstr ""
    117 
    118 msgid "Generates the latest POT file based on the selected plugin’s source code."
    119 msgstr ""
    120 
    121 msgid "Target Plugin:"
    122 msgstr ""
    123 
    124 msgid "Select"
    125 msgstr ""
    126 
    127 msgid "Generate POT"
    128 msgstr ""
    129 
    130 msgid "Download POT"
    131 msgstr ""
    132 
    133 msgid "2. Generate / Update PO file from POT"
    134 msgstr ""
    135 
    136 msgid "When updating a PO file, the existing translations (msgstr) corresponding to the strings (msgid) in the POT file are preserved in the updated PO file."
    137 msgstr ""
    138 
    139 msgid "Generate / Update PO"
    140 msgstr ""
    141 
    142 msgid "Download PO"
    143 msgstr ""
    144 
    145 msgid "3. Edit PO file & Generate MO file"
    146 msgstr ""
    147 
    148 msgid "Changes in the editor are saved to the PO file and the MO file is generated simultaneously only when you click the \"Save Changes and Generate MO\" button. The MO file is a binary file that WordPress uses to actually display translations."
    149 msgstr ""
    150 
    151 msgid "Select a Plugin"
    152 msgstr ""
    153 
    154 msgid "Load PO"
    155 msgstr ""
    156 
    157 msgid "Delete MO"
    158 msgstr ""
    159 
    160 msgid "Download MO"
    161 msgstr ""
    162 
    163 msgid "Save Changes and Generate MO"
    164 msgstr ""
    165 
    166 msgid "Yes"
    167 msgstr ""
    168 
    169 msgid "No"
    170 msgstr ""
    171 
    172 msgid "Close"
    173 msgstr ""
    174 
    175 msgid "You do not have permission. Please log in as an administrator."
    176 msgstr ""
    177 
    178 msgid "Failed to parse PO file."
    179 msgstr ""
    180 
    181 msgid "msgid (Source String)"
    182 msgstr ""
    183 
    184 msgid "msgstr (Translation)"
    185 msgstr ""
    186 
    187 msgid "PO file not found."
    188 msgstr ""
    189 
    190 msgid "WP_Filesystem could not be initialized. Please check your file permissions or credentials."
    191 msgstr ""
    192 
    193 msgid "Failed to read file. Please check file permissions."
    194 msgstr ""
    195 
    196 msgid "Failed to create the directory. Please check file permissions."
    197 msgstr ""
    198 
    199 msgid "Failed to delete file. Please check file permissions."
    200 msgstr ""
    201 
  • quick-translate-pot-po-mo/trunk/quick-translate-pot-po-mo.php

    r3373612 r3379285  
    22/**
    33 * Plugin Name: Quick Translate POT/PO/MO
    4  * Description: With this plugin, you can easily generate and edit a plugin’s translation files, and quickly apply the results.
    5  * Version: 1.1.1
     4 * Description: With this plugin, you can easily generate and edit a plugin’s translation files, quickly apply the results, and even automatically translate them using Google Translate or DeepL.
     5 * Version: 2.0.0
    66 * Author: Kasuga
    77 * License: GPLv2 or later
     
    2727 */
    2828function quick_translate_add_action_links( $links ) {
     29
    2930    $settings_link = '<a href="' . esc_url( admin_url( 'tools.php?page=quick-translate-tools' ) ) . '">' . esc_html__( 'Tools', 'quick-translate-pot-po-mo' ) . '</a>';
    3031    array_unshift( $links, $settings_link );
     32
    3133    return $links;
    3234}
     
    7476 */
    7577function quick_translate_add_admin_menu() {
     78
    7679    add_management_page(
    77         esc_html__( "Quick Translation Tool (plugin's POT/PO/MO Generator & Editor)", 'quick-translate-pot-po-mo' ),
    78         esc_html__( 'Quick Translation Tool (POT/PO/MO)', 'quick-translate-pot-po-mo' ),
     80        esc_html__( "Quick Translate POT/PO/MO (plugin's POT/PO/MO Generator & Editor)", 'quick-translate-pot-po-mo' ),
     81        esc_html__( 'Quick Translate POT/PO/MO', 'quick-translate-pot-po-mo' ),
    7982        'manage_options',
    8083        'quick-translate-tools',
     
    9295 */
    9396function quick_translate_enqueue_assets( $hook ) {
     97
    9498    if ( 'tools_page_quick-translate-tools' !== $hook ) {
    9599        return;
     
    115119        'QuickTranslate',
    116120        array(
    117             'ajax_url' => admin_url( 'admin-ajax.php' ),
    118             'nonce'    => wp_create_nonce( 'quick_translate_nonce' ),
    119             'i18n'     => array(
    120                 'select_plugin'         => esc_js( __( 'Please select a plugin.', 'quick-translate-pot-po-mo' ) ),
    121                 'loading'               => esc_js( __( 'Loading...', 'quick-translate-pot-po-mo' ) ),
    122                 'confirm_save'          => esc_js( __( 'Saving will overwrite the .po file and regenerate the .mo file. Are you sure?', 'quick-translate-pot-po-mo' ) ),
    123                 'save_complete'         => esc_js( __( 'Saving and MO generation are complete.', 'quick-translate-pot-po-mo' ) ),
    124                 'error_prefix'          => esc_js( __( 'Error: ', 'quick-translate-pot-po-mo' ) ),
    125                 'pot_overwrite_confirm' => esc_js( __( 'A POT file already exists. Do you want to overwrite it?', 'quick-translate-pot-po-mo' ) ),
    126                 'po_overwrite_confirm'  => esc_js( __( 'A PO file already exists. Do you want to update it? Existing translations will be preserved.', 'quick-translate-pot-po-mo' ) ),
    127                 'permission_error'      => esc_js( __( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ),
    128                 'nonce_error'           => esc_js( __( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ),
    129                 'no_plugin_selected'    => esc_js( __( 'No plugin specified.', 'quick-translate-pot-po-mo' ) ),
    130                 'write_error'           => esc_js( __( 'Failed to write file. Please check file permissions.', 'quick-translate-pot-po-mo' ) ),
    131                 'pot_generated'         => esc_js( __( 'POT file has been generated.', 'quick-translate-pot-po-mo' ) ),
    132                 'po_generated'          => esc_js( __( 'PO file has been generated.', 'quick-translate-pot-po-mo' ) ),
    133                 'po_updated'            => esc_js( __( 'PO file has been updated.', 'quick-translate-pot-po-mo' ) ),
    134                 'generation_started'    => esc_js( __( 'Generating files...', 'quick-translate-pot-po-mo' ) ),
    135                 'no_i18n_found'         => esc_js( __( 'No internationalization functions (like __(), _e(), etc.) were found in the plugin. POT/PO files cannot be created.', 'quick-translate-pot-po-mo' ) ),
    136                 'confirm_delete_mo'     => esc_js( __( 'Are you sure you want to delete the MO file? This action cannot be undone.', 'quick-translate-pot-po-mo' ) ),
    137                 'delete_mo_complete'    => esc_js( __( 'MO file has been successfully deleted.', 'quick-translate-pot-po-mo' ) ),
    138                 'delete_mo_not_found'   => esc_js( __( 'MO file not found. Nothing to delete.', 'quick-translate-pot-po-mo' ) ),
    139                 'pot_file_not_found'    => esc_js( __( 'POT file not found. Please generate the POT file first.', 'quick-translate-pot-po-mo' ) ),
    140                 'po_file_not_found'     => esc_js( __( 'PO file not found. Please generate the PO file first.', 'quick-translate-pot-po-mo' ) ),
    141                 'confirm_delete_row'    => esc_js( __( 'Are you sure you want to delete this translation entry? This will be permanently removed when you save.', 'quick-translate-pot-po-mo' ) ),
    142                 'download_pot_error'    => esc_js( __( 'POT file not found. Please generate it first.', 'quick-translate-pot-po-mo' ) ),
    143                 'download_po_error'     => esc_js( __( 'PO file not found. Please generate it first.', 'quick-translate-pot-po-mo' ) ),
    144                 'download_mo_error'     => esc_js( __( 'MO file not found. Please generate it first.', 'quick-translate-pot-po-mo' ) ),
     121            'ajax_url'                  => admin_url( 'admin-ajax.php' ),
     122            'nonce'                     => wp_create_nonce( 'quick_translate_nonce' ),
     123            'i18n'                      => array(
     124                'select_plugin'         => __( 'No plugin selected.', 'quick-translate-pot-po-mo' ),
     125                'loading'               => __( 'Loading...', 'quick-translate-pot-po-mo' ),
     126                'confirm_save'          => __( 'Saving will overwrite the .po file and regenerate the .mo file. Are you sure?', 'quick-translate-pot-po-mo' ),
     127                'save_complete'         => __( 'Saving and MO generation are complete.', 'quick-translate-pot-po-mo' ),
     128                'error_prefix'          => __( 'Error: ', 'quick-translate-pot-po-mo' ),
     129                'pot_overwrite_confirm' => __( 'A POT file already exists. Do you want to overwrite it?', 'quick-translate-pot-po-mo' ),
     130                'po_overwrite_confirm'  => __( 'A PO file already exists. Do you want to update it? Existing translations will be preserved.', 'quick-translate-pot-po-mo' ),
     131                'permission_error'      => __( 'You do not have permission.', 'quick-translate-pot-po-mo' ),
     132                'nonce_error'           => __( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ),
     133                'no_plugin_selected'    => __( 'No plugin specified.', 'quick-translate-pot-po-mo' ),
     134                'write_error'           => __( 'Failed to write file. Please check file permissions.', 'quick-translate-pot-po-mo' ),
     135                'pot_generated'         => __( 'POT file has been generated.', 'quick-translate-pot-po-mo' ),
     136                'po_generated'          => __( 'PO file has been generated.', 'quick-translate-pot-po-mo' ),
     137                'po_updated'            => __( 'PO file has been updated.', 'quick-translate-pot-po-mo' ),
     138                'generation_started'    => __( 'Generating files...', 'quick-translate-pot-po-mo' ),
     139                'no_i18n_found'         => __( 'No internationalization functions (like __(), _e(), etc.) were found in the plugin. POT/PO files cannot be created.', 'quick-translate-pot-po-mo' ),
     140                'confirm_delete_mo'     => __( 'Are you sure you want to delete the MO file? This action cannot be undone.', 'quick-translate-pot-po-mo' ),
     141                'delete_mo_complete'    => __( 'MO file has been successfully deleted.', 'quick-translate-pot-po-mo' ),
     142                'delete_mo_not_found'   => __( 'MO file not found. Nothing to delete.', 'quick-translate-pot-po-mo' ),
     143                'pot_file_not_found'    => __( 'POT file not found. Please generate the POT file first.', 'quick-translate-pot-po-mo' ),
     144                'po_file_not_found'     => __( 'PO file not found. Please generate the PO file first.', 'quick-translate-pot-po-mo' ),
     145                'confirm_delete_row'    => __( 'Are you sure you want to delete this translation entry? This will be permanently removed when you save.', 'quick-translate-pot-po-mo' ),
     146                'download_pot_error'    => __( 'POT file not found.', 'quick-translate-pot-po-mo' ),
     147                'download_po_error'     => __( 'PO file not found.', 'quick-translate-pot-po-mo' ),
     148                'download_mo_error'     => __( 'MO file not found.', 'quick-translate-pot-po-mo' ),
     149                'confirm_auto_fill'     => __( 'You are about to move to "PO Auto Fill". Continue?', 'quick-translate-pot-po-mo' ),
    145150            ),
     151            'admin_url_auto_translator' => admin_url( 'tools.php?page=auto-translator' ),
    146152        )
    147153    );
     
    165171    foreach ( $plugins as $plugin_file => $data ) {
    166172        $folder = explode( '/', $plugin_file )[0];
     173
    167174        if ( $folder === $plugin_slug ) {
    168175            return array(
     
    184191 */
    185192function quick_translate_plugin_select_options() {
     193
    186194    if ( ! function_exists( 'get_plugins' ) ) {
    187195        require_once ABSPATH . 'wp-admin/includes/plugin.php';
     
    190198    $plugins = get_plugins();
    191199    $seen    = array();
     200
    192201    foreach ( $plugins as $file => $data ) {
    193202        $folder = explode( '/', $file )[0];
     203
    194204        if ( isset( $seen[ $folder ] ) ) {
    195205            continue;
    196206        }
     207
    197208        $seen[ $folder ] = true;
     209
    198210        ?>
    199211        <option value="<?php echo esc_attr( $folder ); ?>"><?php echo esc_html( $data['Name'] ); ?> (<?php echo esc_html( $folder ); ?>)</option>
     
    210222 */
    211223function quick_translate_page() {
     224
    212225    if ( ! current_user_can( 'manage_options' ) ) {
    213226        wp_die( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    214227    }
     228
     229    $locale  = get_locale();
    215230
    216231    ?>
     
    218233        <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
    219234
    220         <h5><?php esc_html_e( '* The following operations will be performed on the languages folder located inside the currently selected plugin.', 'quick-translate-pot-po-mo' ); ?></h5>
     235        <p><?php
     236            // translators: %s: The locale code (e.g. ja_JP).
     237                $message = __( '* For the <strong><code>%s</code></strong> locale, the POT, PO, and MO files will be used. The following operations will be performed on the <em>languages</em> folder inside the currently selected plugin.', 'quick-translate-pot-po-mo' );
     238                printf( wp_kses_post( $message ), esc_html( $locale ) );
     239            ?></p>
    221240
    222241        <h2><?php esc_html_e( '1. Generate POT file', 'quick-translate-pot-po-mo' ); ?></h2>
     
    225244            <p>
    226245                <?php esc_html_e( 'Target Plugin:', 'quick-translate-pot-po-mo' ); ?>
    227                 <select name="plugin_slug" id="mmpt-generate-pot-select" required>
    228                     <option value="">-- <?php esc_html_e( 'Select', 'quick-translate-pot-po-mo' ); ?> --</option>
     246                <select name="plugin_select" id="mmpt-generate-pot-select" class="regular-text">
     247                    <option value="">-- <?php esc_html_e( 'Select a Plugin', 'quick-translate-pot-po-mo' ); ?> --</option>
    229248                    <?php quick_translate_plugin_select_options(); ?>
    230249                </select>
     
    247266            <p>
    248267                <?php esc_html_e( 'Target Plugin:', 'quick-translate-pot-po-mo' ); ?>
    249                 <select name="plugin_slug" id="mmpt-generate-po-select" required>
    250                     <option value="">-- <?php esc_html_e( 'Select', 'quick-translate-pot-po-mo' ); ?> --</option>
     268                <select name="plugin_select" id="mmpt-generate-po-select" class="regular-text">
     269                    <option value="">-- <?php esc_html_e( 'Select a Plugin', 'quick-translate-pot-po-mo' ); ?> --</option>
    251270                    <?php quick_translate_plugin_select_options(); ?>
    252271                </select>
     
    259278                    <?php esc_html_e( 'Download PO', 'quick-translate-pot-po-mo' ); ?>
    260279                </button>
     280                <button type="button" class="button button-primary" id="mmpt-link-btn">
     281                    <?php esc_html_e( 'Go to "PO Auto Fill" (Auto Translation Tool)', 'quick-translate-pot-po-mo' ); ?>
     282                </button>
    261283            </p>
    262284        </form>
     
    269291        echo '<p>' . esc_html( $text ) . '</p>';
    270292        ?>
    271 
    272293        <p>
    273             <select id="mmpt-select-plugin">
     294            <select name="plugin_select" id="mmpt-select-plugin" class="regular-text">
    274295                <option value="">-- <?php esc_html_e( 'Select a Plugin', 'quick-translate-pot-po-mo' ); ?> --</option>
    275296                <?php quick_translate_plugin_select_options(); ?>
     
    283304            </button>
    284305        </p>
    285 
    286306        <div id="mmpt-po-editor" style="display:none; margin-top:20px;">
    287307            <form id="mmpt-save-po-form">
     
    296316            </form>
    297317        </div>
    298 
    299318        <div id="mmpt-modal" class="mmpt-modal" style="display:none;">
    300319            <div class="mmpt-modal-content">
     
    317336        </div>
    318337    </div>
    319 
    320338    <?php
    321339}
     
    329347 */
    330348function mmpt_check_i18n_callback() {
     349
    331350    if ( ! current_user_can( 'manage_options' ) ) {
    332351        wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    333352    }
     353
    334354    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    335355        wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    348368    $has_i18n = false;
    349369    $rii      = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $info['path'] ) );
    350 
    351370    foreach ( $rii as $file ) {
     371
    352372        if ( ! $file->isFile() ) {
    353373            continue;
    354374        }
     375
    355376        $ext = pathinfo( $file->getFilename(), PATHINFO_EXTENSION );
    356377        if ( ! in_array( $ext, array( 'php', 'js', 'html', 'twig' ), true ) ) {
     
    380401 */
    381402function mmpt_check_pot_file_callback() {
     403
    382404    if ( ! current_user_can( 'manage_options' ) ) {
    383405        wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    384406    }
     407
    385408    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    386409        wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    410433 */
    411434function mmpt_check_po_file_callback() {
     435
    412436    if ( ! current_user_can( 'manage_options' ) ) {
    413437        wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    414438    }
     439
    415440    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    416441        wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    429454    $locale  = get_locale();
    430455    $po_file = $info['path'] . '/languages/' . $info['text_domain'] . '-' . $locale . '.po';
    431 
    432456    wp_send_json_success( my_file_exists( $po_file ) );
    433457}
     
    441465 */
    442466function mmpt_check_mo_file_callback() {
     467
    443468    if ( ! current_user_can( 'manage_options' ) ) {
    444469        wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    445470    }
     471
    446472    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    447473        wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    460486    $locale  = get_locale();
    461487    $mo_file = $info['path'] . '/languages/' . $info['text_domain'] . '-' . $locale . '.mo';
    462 
    463488    wp_send_json_success( my_file_exists( $mo_file ) );
    464489}
     
    472497 */
    473498function mmpt_generate_pot_callback() {
     499
    474500    if ( ! current_user_can( 'manage_options' ) ) {
    475501        wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    476502    }
     503
    477504    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    478505        wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    490517
    491518    $result = my_generate_pot_file( $plugin_slug, $info['text_domain'] );
    492 
    493519    if ( is_wp_error( $result ) ) {
    494520        wp_send_json_error( esc_html( $result->get_error_message() ) );
     
    506532 */
    507533function mmpt_generate_po_callback() {
     534
    508535    if ( ! current_user_can( 'manage_options' ) ) {
    509536        wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    510537    }
     538
    511539    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    512540        wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    529557
    530558    $result = my_generate_po_file( $plugin_slug, $info['text_domain'] );
    531 
    532559    if ( is_wp_error( $result ) ) {
    533560        wp_send_json_error( esc_html( $result->get_error_message() ) );
     
    547574 */
    548575function mmpt_load_po_callback() {
     576
    549577    if ( ! current_user_can( 'manage_options' ) ) {
    550578        wp_send_json_error( esc_html__( 'You do not have permission. Please log in as an administrator.', 'quick-translate-pot-po-mo' ) );
    551579    }
     580
    552581    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    553582        wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    563592        wp_send_json_error( esc_html( $info->get_error_message() ) );
    564593    }
     594
    565595    $plugin_path = $info['path'];
    566596    $text_domain = $info['text_domain'];
    567 
    568597    $locale  = get_locale();
    569598    $po_file = $plugin_path . '/languages/' . $text_domain . '-' . $locale . '.po';
    570 
    571599    if ( ! my_file_exists( $po_file ) ) {
    572600        wp_send_json_error( esc_html__( 'PO file not found. Please generate the PO file first.', 'quick-translate-pot-po-mo' ) );
     
    625653 */
    626654function mmpt_save_po_callback() {
     655
    627656    if ( ! current_user_can( 'manage_options' ) ) {
    628657        wp_send_json_error( esc_html__( 'You do not have permission. Please log in as an administrator.', 'quick-translate-pot-po-mo' ) );
     
    642671        wp_send_json_error( esc_html( $info->get_error_message() ) );
    643672    }
     673
    644674    $plugin_path = $info['path'];
    645675    $text_domain = $info['text_domain'];
    646 
    647676    $locale = get_locale();
    648 
    649677    $pot_file = $plugin_path . '/languages/' . $text_domain . '.pot';
    650678    $po_file  = $plugin_path . '/languages/' . $text_domain . '-' . $locale . '.po';
     
    692720
    693721        if ( ! empty( $msgid ) ) {
     722
    694723            if ( isset( $existing_entries_by_msgid[ $msgid ] ) ) {
    695724                $entry           = $existing_entries_by_msgid[ $msgid ];
     
    726755 */
    727756function mmpt_delete_mo_file_callback() {
     757
    728758    if ( ! current_user_can( 'manage_options' ) ) {
    729759        wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    730760    }
     761
    731762    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    732763        wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    734765
    735766    $plugin_slug = isset( $_POST['plugin_slug'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin_slug'] ) ) : '';
    736 
    737767    if ( ! $plugin_slug ) {
    738768        wp_send_json_error( esc_html__( 'No plugin specified.', 'quick-translate-pot-po-mo' ) );
     
    743773        wp_send_json_error( esc_html( $info->get_error_message() ) );
    744774    }
     775
    745776    $plugin_path = $info['path'];
    746777    $text_domain = $info['text_domain'];
    747 
    748778    $locale  = get_locale();
    749779    $mo_file = $plugin_path . '/languages/' . $text_domain . '-' . $locale . '.mo';
     
    767797 */
    768798function mmpt_download_pot_callback() {
     799
    769800    if ( ! current_user_can( 'manage_options' ) ) {
    770801        wp_die( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    771802    }
     803
    772804    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    773805        wp_die( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    785817
    786818    $pot_file = $info['path'] . '/languages/' . $info['text_domain'] . '.pot';
    787 
    788819    $file_contents = my_read_file_contents( $pot_file );
    789820    if ( is_wp_error( $file_contents ) ) {
     
    806837 */
    807838function mmpt_download_po_callback() {
     839
    808840    if ( ! current_user_can( 'manage_options' ) ) {
    809841        wp_die( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    810842    }
     843
    811844    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    812845        wp_die( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    825858    $locale  = get_locale();
    826859    $po_file = $info['path'] . '/languages/' . $info['text_domain'] . '-' . $locale . '.po';
    827 
    828860    $file_contents = my_read_file_contents( $po_file );
    829861    if ( is_wp_error( $file_contents ) ) {
     
    846878 */
    847879function mmpt_download_mo_callback() {
     880
    848881    if ( ! current_user_can( 'manage_options' ) ) {
    849882        wp_die( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) );
    850883    }
     884
    851885    if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) {
    852886        wp_die( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) );
     
    865899    $locale  = get_locale();
    866900    $mo_file = $info['path'] . '/languages/' . $info['text_domain'] . '-' . $locale . '.mo';
    867 
    868901    $file_contents = my_read_file_contents( $mo_file );
    869902    if ( is_wp_error( $file_contents ) ) {
     
    886919 */
    887920function my_init_filesystem() {
     921
    888922    global $wp_filesystem;
    889923    if ( empty( $wp_filesystem ) ) {
     
    892926        }
    893927        require_once ABSPATH . 'wp-admin/includes/file.php';
     928
    894929        $creds = request_filesystem_credentials( site_url() . '/wp-admin/', '', false, false, null );
    895930        if ( ! WP_Filesystem( $creds ) ) {
     
    897932        }
    898933    }
     934
    899935    return true;
    900936}
     
    909945 */
    910946function my_file_exists( $file_path ) {
     947
    911948    $result = my_init_filesystem();
    912949    if ( is_wp_error( $result ) ) {
    913950        return false;
    914951    }
     952
    915953    global $wp_filesystem;
    916954    return $wp_filesystem->exists( $file_path );
     
    926964 */
    927965function my_read_file_contents( $file_path ) {
     966
    928967    $result = my_init_filesystem();
    929968    if ( is_wp_error( $result ) ) {
    930969        return $result;
    931970    }
     971
    932972    global $wp_filesystem;
    933973    $content = $wp_filesystem->get_contents( $file_path );
     
    935975        return new WP_Error( 'read_error', esc_html__( 'Failed to read file. Please check file permissions.', 'quick-translate-pot-po-mo' ) );
    936976    }
     977
    937978    return $content;
    938979}
     
    948989 */
    949990function my_write_file_contents( $file_path, $content ) {
     991
    950992    $result = my_init_filesystem();
    951993    if ( is_wp_error( $result ) ) {
    952994        return $result;
    953995    }
     996
    954997    global $wp_filesystem;
    955998    $success = $wp_filesystem->put_contents( $file_path, $content, FS_CHMOD_FILE );
     
    9571000        return new WP_Error( 'write_error', esc_html__( 'Failed to write file. Please check file permissions.', 'quick-translate-pot-po-mo' ) );
    9581001    }
     1002
    9591003    return true;
    9601004}
     
    9691013 */
    9701014function my_create_dir( $dir_path ) {
     1015
    9711016    $result = my_init_filesystem();
    9721017    if ( is_wp_error( $result ) ) {
    9731018        return $result;
    9741019    }
     1020
    9751021    global $wp_filesystem;
    9761022    if ( $wp_filesystem->is_dir( $dir_path ) ) {
    9771023        return true;
    9781024    }
     1025
    9791026    $success = $wp_filesystem->mkdir( $dir_path );
    9801027    if ( ! $success ) {
    9811028        return new WP_Error( 'dir_creation_failed', esc_html__( 'Failed to create the directory. Please check file permissions.', 'quick-translate-pot-po-mo' ) );
    9821029    }
     1030
    9831031    return true;
    9841032}
     
    9931041 */
    9941042function my_delete_file( $file ) {
     1043
    9951044    $result = my_init_filesystem();
    9961045    if ( is_wp_error( $result ) ) {
    9971046        return $result;
    9981047    }
     1048
    9991049    global $wp_filesystem;
    10001050    if ( ! $wp_filesystem->exists( $file ) ) {
    10011051        return false;
    10021052    }
     1053
    10031054    $success = $wp_filesystem->delete( $file );
    10041055    if ( ! $success ) {
    10051056        return new WP_Error( 'delete_error', esc_html__( 'Failed to delete file. Please check file permissions.', 'quick-translate-pot-po-mo' ) );
    10061057    }
     1058
    10071059    return true;
    10081060}
     
    10181070 */
    10191071function my_generate_pot_file( $plugin_slug, $text_domain ) {
     1072
    10201073    if ( ! function_exists( 'get_plugins' ) ) {
    10211074        require_once ABSPATH . 'wp-admin/includes/plugin.php';
     
    10481101    if ( $plugin_file && isset( $plugins[ $plugin_file ] ) ) {
    10491102        $plugin_data = $plugins[ $plugin_file ];
    1050        
     1103
    10511104        if ( ! empty( $plugin_data['Name'] ) ) {
    10521105            $strings[ html_entity_decode( $plugin_data['Name'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ] = '';
    10531106        }
     1107
    10541108        if ( ! empty( $plugin_data['Description'] ) ) {
    10551109            $strings[ html_entity_decode( $plugin_data['Description'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ] = '';
    10561110        }
     1111
    10571112        if ( ! empty( $plugin_data['Author'] ) ) {
    10581113            $strings[ html_entity_decode( $plugin_data['Author'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ] = '';
     
    10621117    $rii = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $plugin_path ) );
    10631118    foreach ( $rii as $file ) {
     1119
    10641120        if ( ! $file->isFile() ) {
    10651121            continue;
    10661122        }
     1123
    10671124        $ext = pathinfo( $file->getFilename(), PATHINFO_EXTENSION );
    10681125        if ( ! in_array( $ext, array( 'php', 'js', 'html', 'twig' ), true ) ) {
     
    10831140
    10841141        foreach ( $matches as $m ) {
    1085             $msgid = stripcslashes( $m[2] );           
    1086             $msgid = html_entity_decode( $msgid, ENT_QUOTES | ENT_HTML5, 'UTF-8' );
     1142            $msgid             = stripcslashes( $m[2] );
     1143            $msgid             = html_entity_decode( $msgid, ENT_QUOTES | ENT_HTML5, 'UTF-8' );
    10871144            $strings[ $msgid ] = '';
    10881145        }
     
    10931150    }
    10941151
    1095     $header_string  = 'msgid ""' . "\n" . 'msgstr ""' . "\n";
    1096    
     1152    $header_string = 'msgid ""' . "\n" . 'msgstr ""' . "\n";
    10971153    $header_string .= '"Project-Id-Version: ' . addcslashes( $plugin_data['Name'], '"' ) . ' ' . addcslashes( $plugin_data['Version'], '"' ) . '\\n"' . "\n";
    10981154    $header_string .= '"Report-Msgid-Bugs-To: \\n"' . "\n";
     
    11351191 */
    11361192function my_generate_po_file( $plugin_slug, $text_domain ) {
     1193
    11371194    $plugin_path   = WP_PLUGIN_DIR . '/' . $plugin_slug;
    11381195    $languages_dir = $plugin_path . '/languages';
     
    11651222        $existing_translations = array();
    11661223        foreach ( $existing_po_entries as $entry ) {
     1224
    11671225            if ( isset( $entry['msgid'] ) && isset( $entry['msgstr'] ) ) {
    11681226                $existing_translations[ $entry['msgid'] ] = $entry['msgstr'];
     
    11711229
    11721230        foreach ( $pot_entries as $pot_entry ) {
     1231
    11731232            if ( isset( $pot_entry['msgid'] ) ) {
    11741233                $msgid        = $pot_entry['msgid'];
     
    11801239            }
    11811240        }
     1241
    11821242        $is_update = true;
     1243
    11831244    } else {
     1245
    11841246        $po_entries = $pot_entries;
    11851247        $is_update  = false;
     
    11981260 *
    11991261 * @since 1.0.0
     1262 * @since 1.1.1 Add HTML entity decoding for msgid/msgstr.
    12001263 *
    12011264 * @param string $po_file The path to the PO file.
    12021265 * @return array|WP_Error|false
    12031266 */
    1204 /**
    1205  * Parses a PO file into an array of entries.
    1206  *
    1207  * @since 1.0.0
    1208  * @since 1.2.0 Add HTML entity decoding for msgid/msgstr.
    1209  *
    1210  * @param string $po_file The path to the PO file.
    1211  * @return array|WP_Error|false
    1212  */
    12131267function my_parse_po_file( $po_file ) {
     1268
    12141269    if ( ! my_file_exists( $po_file ) ) {
    12151270        return false;
     
    12221277
    12231278    $lines = preg_split( "/\r\n|\n|\r/", $content );
    1224    
    1225     $entries = array();
    1226     $entry   = array();
    1227     $state   = null;
     1279
     1280    $entries     = array();
     1281    $entry       = array();
     1282    $state       = null;
    12281283    $current_key = null;
    12291284
    12301285    foreach ( $lines as $line ) {
     1286
    12311287        $line = trim( $line );
    1232 
    12331288        if ( '' === $line ) {
     1289
    12341290            if ( ! empty( $entry ) && isset( $entry['msgid'] ) ) {
     1291
    12351292                if ( isset( $entry['msgid'] ) ) {
    12361293                    $entry['msgid'] = html_entity_decode( $entry['msgid'], ENT_QUOTES | ENT_HTML5, 'UTF-8' );
    12371294                }
     1295
    12381296                if ( isset( $entry['msgstr'] ) ) {
    12391297                    $entry['msgstr'] = html_entity_decode( $entry['msgstr'], ENT_QUOTES | ENT_HTML5, 'UTF-8' );
    12401298                }
     1299
    12411300                $entries[] = $entry;
    12421301            }
    1243             $entry = array();
    1244             $state = null;
     1302
     1303            $entry       = array();
     1304            $state       = null;
    12451305            $current_key = null;
    12461306            continue;
     
    12521312
    12531313        if ( preg_match( '/^msgid\s+"(.*)"$/', $line, $matches ) ) {
     1314
    12541315            $entry['msgid'] = stripcslashes( $matches[1] );
    1255             $current_key = 'msgid';
    1256             $state = 'msgid';
     1316            $current_key    = 'msgid';
     1317            $state          = 'msgid';
    12571318            continue;
     1319
    12581320        } elseif ( preg_match( '/^msgstr\s+"(.*)"$/', $line, $matches ) ) {
     1321
    12591322            $entry['msgstr'] = stripcslashes( $matches[1] );
    1260             $current_key = 'msgstr';
    1261             $state = 'msgstr';
     1323            $current_key     = 'msgstr';
     1324            $state           = 'msgstr';
    12621325            continue;
     1326
    12631327        } elseif ( preg_match( '/^msgctxt\s+"(.*)"$/', $line, $matches ) ) {
     1328
    12641329            $entry['msgctxt'] = stripcslashes( $matches[1] );
    1265             $current_key = 'msgctxt';
     1330            $current_key      = 'msgctxt';
    12661331            continue;
    12671332        }
    1268        
     1333
    12691334        if ( ( 'msgid' === $current_key || 'msgstr' === $current_key || 'msgctxt' === $current_key ) && preg_match( '/^"(.*)"$/', $line, $m ) ) {
     1335
    12701336            $entry[ $current_key ] .= stripcslashes( $m[1] );
    12711337            continue;
    12721338        }
    12731339    }
    1274    
     1340
    12751341    if ( ! empty( $entry ) && isset( $entry['msgid'] ) ) {
     1342
    12761343        if ( isset( $entry['msgid'] ) ) {
    12771344            $entry['msgid'] = html_entity_decode( $entry['msgid'], ENT_QUOTES | ENT_HTML5, 'UTF-8' );
    12781345        }
     1346
    12791347        if ( isset( $entry['msgstr'] ) ) {
    12801348            $entry['msgstr'] = html_entity_decode( $entry['msgstr'], ENT_QUOTES | ENT_HTML5, 'UTF-8' );
    12811349        }
     1350
    12821351        $entries[] = $entry;
    12831352    }
     
    12981367 */
    12991368function my_save_po_file( $po_file, $entries, $pot_file, $plugin_slug ) {
     1369
    13001370    $locale       = get_locale();
    13011371    $plural_forms = my_get_plural_forms( substr( $locale, 0, 2 ) );
     
    13081378
    13091379    if ( $plugin_slug ) {
     1380
    13101381        foreach ( $plugins as $file => $data ) {
     1382
    13111383            if ( strpos( $file, $plugin_slug . '/' ) === 0 ) {
    13121384                $plugin_file = $file;
     
    13141386            }
    13151387        }
     1388
    13161389        if ( $plugin_file && isset( $plugins[ $plugin_file ] ) ) {
    13171390            $plugin_data = $plugins[ $plugin_file ];
     
    13191392    }
    13201393
    1321     $header_string  = 'msgid ""' . "\n" . 'msgstr ""' . "\n";
    1322    
    1323     $plugin_name_decoded = html_entity_decode( $plugin_data['Name'], ENT_QUOTES | ENT_HTML5, 'UTF-8' );
     1394    $header_string = 'msgid ""' . "\n" . 'msgstr ""' . "\n";
     1395
     1396    $plugin_name_decoded    = html_entity_decode( $plugin_data['Name'], ENT_QUOTES | ENT_HTML5, 'UTF-8' );
    13241397    $plugin_version_decoded = html_entity_decode( $plugin_data['Version'], ENT_QUOTES | ENT_HTML5, 'UTF-8' );
    1325    
     1398
    13261399    $header_string .= '"Project-Id-Version: ' . addcslashes( $plugin_name_decoded, '"' ) . ' ' . addcslashes( $plugin_version_decoded, '"' ) . '\\n"' . "\n";
    13271400    $header_string .= '"Report-Msgid-Bugs-To: \\n"' . "\n";
     1401
    13281402    if ( file_exists( $pot_file ) ) {
    13291403        $header_string .= '"POT-Creation-Date: ' . gmdate( 'Y-m-d H:i:s+0000', filemtime( $pot_file ) ) . '\\n"' . "\n";
     
    13311405        $header_string .= '"POT-Creation-Date: NOT FOUND\\n"' . "\n";
    13321406    }
     1407
    13331408    $header_string .= '"PO-Revision-Date: ' . gmdate( 'Y-m-d H:i:s+0000' ) . '\\n"' . "\n";
    13341409
    1335     $current_user = wp_get_current_user();
     1410    $current_user    = wp_get_current_user();
    13361411    $translator_name = addcslashes( $current_user->display_name, '"' );
    13371412
     
    13481423
    13491424    foreach ( $entries as $entry ) {
     1425
    13501426        if ( ! isset( $entry['msgid'] ) || ! isset( $entry['msgstr'] ) ) {
    13511427            continue;
    13521428        }
     1429
    13531430        if ( '' === $entry['msgid'] ) {
    13541431            continue;
    13551432        }
     1433
    13561434        $content .= 'msgid "' . addcslashes( $entry['msgid'], '"' ) . "\"\n";
    13571435        $content .= 'msgstr "' . addcslashes( $entry['msgstr'], '"' ) . "\"\n\n";
     
    13781456 */
    13791457function my_generate_mo_from_po( $po_file, $mo_file ) {
     1458
    13801459    if ( ! my_file_exists( $po_file ) ) {
    13811460        return new WP_Error( 'po_not_found', esc_html__( 'PO file not found.', 'quick-translate-pot-po-mo' ) );
     
    13861465        return $entries;
    13871466    }
     1467
    13881468    if ( false === $entries ) {
    13891469        return new WP_Error( 'parse_error', esc_html__( 'Failed to parse PO file.', 'quick-translate-pot-po-mo' ) );
     
    13951475
    13961476    foreach ( $entries as $entry ) {
     1477
    13971478        if ( ! isset( $entry['msgid'] ) ) {
    13981479            continue;
    13991480        }
     1481
    14001482        if ( '' === $entry['msgid'] ) {
    14011483            continue;
    14021484        }
     1485
    14031486        $ids[]  = $entry['msgid'];
    14041487        $strs[] = isset( $entry['msgstr'] ) && ! empty( $entry['msgstr'] ) ? $entry['msgstr'] : $entry['msgid'];
     
    14071490    $id_count = count( $ids );
    14081491    $offsets  = 7 * 4 + $id_count * 8 * 2;
    1409 
    14101492    $id_table    = '';
    14111493    $str_table   = '';
     
    14351517        $mo .= pack( 'I', $offset + $offsets );
    14361518    }
     1519
    14371520    foreach ( $str_offsets as $offset ) {
    14381521        $mo .= pack( 'I', strlen( $strs[ array_search( $offset, $str_offsets, true ) ] ) );
     
    14601543 */
    14611544function my_get_plural_forms( $lang_code ) {
     1545
    14621546    $plural_forms_map = array(
    14631547        'af'  => 'nplurals=2; plural=(n != 1);',
     
    15481632    return isset( $plural_forms_map[ $lang_code ] ) ? $plural_forms_map[ $lang_code ] : 'nplurals=2; plural=(n != 1);';
    15491633}
     1634
     1635require_once plugin_dir_path( __FILE__ ) . 'po-auto-fill-helper.php';
     1636
     1637register_uninstall_hook( __FILE__, 'po_auto_full_helper_uninstall' );
     1638
     1639function po_auto_full_helper_uninstall() {
     1640
     1641    delete_option( 'auto_translator_api_service' );
     1642    delete_option( 'auto_translator_google_key' );
     1643    delete_option( 'auto_translator_deepl_key' );
     1644}
  • quick-translate-pot-po-mo/trunk/readme.txt

    r3373612 r3379285  
    66Requires PHP: 7.4
    77Tested up to: 6.8
    8 Stable tag: 1.1.1
     8Stable tag: 2.0.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2424* **Edit PO Files**: Directly edit translation strings in an existing PO file.
    2525* **Generate MO Files (Binary File)**: Automatically create the binary MO file that WordPress uses when you save your PO file edits.
     26* **PO File Automatic Translation Tool**: It automatically translates the untranslated parts of a PO file using Google Translation or DeepL.
    2627* **Download POT, PO, and MO Files**: Download each POT, PO, and MO file to your local directory.
    2728* **Delete MO Files**: Remove unnecessary MO files.
     
    3435
    35361. Go to the **"1. Generate POT file"** section.
    36 2. Select the desired plugin from the **"Target Plugin"** dropdown menu.
     372. Select the target plugin from the **"Select a Plugin"** dropdown.
    37383. Click the **"Generate POT"** button.
    38394. If a POT file already exists, a confirmation pop-up will appear.
     
    4344
    44451. Go to the **"2. Generate / Update PO file from POT"** section.
    45 2. Select the target plugin from the **"Target Plugin"** dropdown.
     462. Select the target plugin from the **"Select a Plugin"** dropdown.
    46473. Click the **"Generate / Update PO"** button.
    4748
     
    5354
    54551. Go to the **"3. Edit PO file & Generate MO file"** section.
    55 2. Select the plugin from the **"Select a Plugin"** dropdown.
     562. Select the target plugin from the **"Select a Plugin"** dropdown.
    56573. Click **"Load PO"** to display the PO file contents in a table.
    57584. Edit translations directly in the **"msgstr"** column.
     
    5960
    6061➡ Changes in the editor are saved to the PO file and the MO file is generated simultaneously only when you click the "Save Changes and Generate MO" button.
     62---
     63
     64##For more effective translation work:
     65### Step 2.5: Automatically Translate a PO File
     66
     671. Click the **"Go to PO Auto Fill Tool"** button.
     682. Select the target plugin from the **"Select a Plugin"** dropdown.
     693. Choose either **Google API** or **DeepL API**.
     704. Enter the corresponding **API key**.
     715. Click the **"Preview Translation"** button.
     726. Click the **"Save"** button to save the results to the PO file.
     737. Click the **"Back to Quick Translate POT/PO/MO"** button to edit the saved PO file.
     74
     75➡ To use this tool for automatic translation, you need to **register with Google Translation or DeepL and obtain an API key**. Both services can be used within their free usage limits.
     76---
    6177
    6278#### Table Operations
     
    1151311. Plugin settings screen
    1161322. Button display in an actual blog post
     1333. The Automatic Translation Tool Screen
    117134
    118135== Changelog ==
     136= 2.0.0 =
     137* Added the auto translatable tool using Google API or DeepL API.
     138* Made minor fixes.
     139
    119140= 1.1.1 =
    120141* Fixed bugs related to special characters.
Note: See TracChangeset for help on using the changeset viewer.