Changeset 3379285
- Timestamp:
- 10/16/2025 07:45:25 AM (4 months ago)
- Location:
- quick-translate-pot-po-mo
- Files:
-
- 20 added
- 7 edited
-
tags/2.0.0 (added)
-
tags/2.0.0/assets (added)
-
tags/2.0.0/assets/pafh-admin.css (added)
-
tags/2.0.0/assets/pafh-admin.js (added)
-
tags/2.0.0/assets/qtppm-admin.css (added)
-
tags/2.0.0/assets/qtppm-admin.js (added)
-
tags/2.0.0/languages (added)
-
tags/2.0.0/languages/quick-translate-pot-po-mo-ja.mo (added)
-
tags/2.0.0/languages/quick-translate-pot-po-mo-ja.po (added)
-
tags/2.0.0/languages/quick-translate-pot-po-mo.pot (added)
-
tags/2.0.0/po-auto-fill-helper.php (added)
-
tags/2.0.0/quick-translate-pot-po-mo.php (added)
-
tags/2.0.0/readme.txt (added)
-
tags/2.0.0/screenshot-1.png (added)
-
tags/2.0.0/screenshot-2.png (added)
-
tags/2.0.0/screenshot-3.png (added)
-
trunk/assets/pafh-admin.css (added)
-
trunk/assets/pafh-admin.js (added)
-
trunk/assets/qtppm-admin.css (modified) (4 diffs)
-
trunk/assets/qtppm-admin.js (modified) (1 diff)
-
trunk/languages/quick-translate-pot-po-mo-ja.mo (modified) (previous)
-
trunk/languages/quick-translate-pot-po-mo-ja.po (modified) (4 diffs)
-
trunk/languages/quick-translate-pot-po-mo.pot (modified) (4 diffs)
-
trunk/po-auto-fill-helper.php (added)
-
trunk/quick-translate-pot-po-mo.php (modified) (77 diffs)
-
trunk/readme.txt (modified) (7 diffs)
-
trunk/screenshot-3.png (added)
Legend:
- Unmodified
- Added
- Removed
-
quick-translate-pot-po-mo/trunk/assets/qtppm-admin.css
r3373612 r3379285 12 12 align-items: center; 13 13 } 14 14 15 .mmpt-modal-content { 15 16 background-color: #fefefe; … … 21 22 box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 22 23 } 24 23 25 .mmpt-close-button { 24 26 color: #aaa; … … 28 30 cursor: pointer; 29 31 } 32 30 33 .mmpt-close-button:hover, 31 34 .mmpt-close-button:focus { … … 33 36 text-decoration: none; 34 37 } 38 39 #mmpt-link-btn { 40 margin-left: 30px; 41 } -
quick-translate-pot-po-mo/trunk/assets/qtppm-admin.js
r3373612 r3379285 308 308 }); 309 309 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 310 321 })(jQuery); -
quick-translate-pot-po-mo/trunk/languages/quick-translate-pot-po-mo-ja.po
r3372110 r3379285 1 1 msgid "" 2 2 msgstr "" 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" 4 4 "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" 7 7 "Last-Translator: Kasuga\n" 8 8 "Language-Team: \n" … … 17 17 msgstr "Quick Translate POT/PO/MO" 18 18 19 msgid "With this plugin, you can easily generate and edit a plugin’s translation files, and quickly apply the results."20 msgstr "このプラグインを使 えば、プラグインの翻訳ファイルを簡単に生成・編集し、その結果を素早く反映できます。"19 msgid "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." 20 msgstr "このプラグインを使うと、プラグインの翻訳ファイルを簡単に生成・編集でき、結果をすばやく適用できます。さらに、Google Translate や DeepL を使って自動翻訳することもできます。" 21 21 22 22 msgid "Kasuga" 23 23 msgstr "Kasuga" 24 24 25 msgid "Auto Translator Tool" 26 msgstr "自動翻訳ツール" 27 28 msgid "Auto Translator" 29 msgstr "自動翻訳" 30 31 msgid "PO Auto Fill (Auto Translation Tool)" 32 msgstr "PO Auto Fill(自動翻訳ツール)" 33 34 msgid "This tool automatically translates untranslated strings in PO files using the Google or DeepL API." 35 msgstr "このツールは、Google または DeepL API を使用して、PO ファイル内の未翻訳文字列を自動的に翻訳します。" 36 37 msgid "* To use this feature, you need to register for the Google API or DeepL API and obtain an API key." 38 msgstr "※この機能を利用するには、Google API または DeepL API に登録し、API キーを取得する必要があります。" 39 40 msgid "Target Plugin:" 41 msgstr "対象プラグイン:" 42 43 msgid "Select a Plugin" 44 msgstr "プラグインの選択" 45 46 msgid "The PO file corresponding to the <strong><code>%s</code></strong> locale will be used." 47 msgstr "対応するPOファイルは<strong><code>%s</code></strong>ロケールが使用されます。" 48 49 msgid "Select Translation API:" 50 msgstr "翻訳APIを選択:" 51 52 msgid "Google API Key:" 53 msgstr "Google APIキー:" 54 55 msgid "Save Key" 56 msgstr "保存キー" 57 58 msgid "DeepL API Key:" 59 msgstr "DeepL APIキー:" 60 61 msgid "Translation Preview" 62 msgstr "翻訳プレビュー" 63 64 msgid "Save" 65 msgstr "保存" 66 67 msgid "Back to \"Quick Translate POT/PO/MO\"" 68 msgstr "「Quick Translate POT/PO/MO」に戻る" 69 70 msgid "Press the Preview button to translate untranslated strings and display the results." 71 msgstr "プレビューボタンを押すと、翻訳されていない文字列が翻訳され、結果が表示されます。" 72 73 msgid "Insufficient permissions." 74 msgstr "権限が不十分です。" 75 76 msgid "Invalid API service specified." 77 msgstr "無効なAPIサービスが指定されました。" 78 79 msgid "API key cannot be empty." 80 msgstr "APIキーを入力して下さい。" 81 82 msgid "API key saved." 83 msgstr "APIキーが保存されました。" 84 85 msgid "Plugin is not selected." 86 msgstr "プラグインが選択されていません。" 87 88 msgid "API key is not entered." 89 msgstr "APIキーが入力されていません。" 90 91 msgid "PO file not found. Expected paths: %s" 92 msgstr "POファイルが見つかりません。想定されるパス: %s" 93 94 msgid "Failed to read PO file." 95 msgstr "POファイルの読み取りに失敗しました。" 96 97 msgid "No untranslated strings found." 98 msgstr "翻訳済み" 99 100 msgid "API communication error: " 101 msgstr "API通信エラー: " 102 103 msgid "msgid (Source String)" 104 msgstr "msgid (原文)" 105 106 msgid "msgstr (Translation)" 107 msgstr "msgstr (翻訳)" 108 109 msgid "Translation preview completed." 110 msgstr "翻訳プレビューが完了しました。" 111 112 msgid "Invalid file path." 113 msgstr "ファイルパスが無効です。" 114 115 msgid "Invalid file path: Must be within wp-content." 116 msgstr "無効なファイルパス: wp-content内にある必要があります。" 117 118 msgid "Invalid file path: Security check failed." 119 msgstr "無効なファイルパス: セキュリティチェックに失敗しました。" 120 121 msgid "PO file does not exist or is not readable." 122 msgstr "POファイルが存在しないか、読み取り不可です。" 123 124 msgid "PO file is not writable. Check file permissions." 125 msgstr "POファイルは書き込み不可です。ファイルの権限を確認してください。" 126 127 msgid "Failed to write to PO file." 128 msgstr "POファイルへの書き込みに失敗しました。" 129 130 msgid "%s string translated and saved to PO file." 131 msgstr "%s文字列が翻訳され、POファイルに保存されました。" 132 133 msgid "Service, key, or target strings are missing." 134 msgstr "サービス、キー、またはターゲット文字列がありません。" 135 136 msgid "HTTP %1$s: %2$s" 137 msgstr "HTTP %1$s : %2$s" 138 139 msgid "Unknown HTTP error" 140 msgstr "不明なHTTPエラー" 141 142 msgid "Google API Error" 143 msgstr "Google API エラー" 144 145 msgid "Failed to parse Google API response" 146 msgstr "Google API レスポンスの解析に失敗しました" 147 148 msgid "No response body" 149 msgstr "応答本文なし" 150 151 msgid "DeepL API Error: %s" 152 msgstr "DeepL API エラー: %s" 153 154 msgid "Failed to parse DeepL API response" 155 msgstr "DeepL API レスポンスの解析に失敗しました" 156 157 msgid "Unsupported translation service" 158 msgstr "サポートされていない翻訳サービス" 159 160 msgid "Saving API key..." 161 msgstr "APIキーを保存しています..." 162 163 msgid "API key saved successfully." 164 msgstr "APIキーが正常に保存されました。" 165 166 msgid "Failed to save API key." 167 msgstr "APIキーの保存に失敗しました。" 168 169 msgid "Failed to retrieve operation result." 170 msgstr "操作結果を取得できませんでした。" 171 172 msgid "Failed to communicate with the server." 173 msgstr "サーバーとの通信に失敗しました。" 174 175 msgid "Fetching untranslated strings and calling API..." 176 msgstr "翻訳されていない文字列を取得して APIを呼び出しています..." 177 178 msgid "Preview failed:" 179 msgstr "プレビューに失敗しました:" 180 181 msgid "API key is not set." 182 msgstr "APIキーが設定されていません。" 183 184 msgid "No plugin selected." 185 msgstr "プラグインが選択されていません。" 186 187 msgid "Selected API" 188 msgstr "選択されたAPI" 189 190 msgid "Please save the key for %s." 191 msgstr "%sのキーを保存してください。" 192 193 msgid "Translating..." 194 msgstr "翻訳中..." 195 196 msgid "Translation completed." 197 msgstr "翻訳が完了しました。" 198 199 msgid "string(s) are ready to be saved." 200 msgstr "文字列を保存する準備ができました。" 201 202 msgid "No new strings were found for translation." 203 msgstr "翻訳用の新しい文字列は見つかりませんでした。" 204 205 msgid "Translation process failed." 206 msgstr "翻訳プロセスに失敗しました。" 207 208 msgid "Server Response" 209 msgstr "サーバー応答" 210 211 msgid "No response from the server." 212 msgstr "サーバーからの応答がありません。" 213 214 msgid "Saving to PO file..." 215 msgstr "POファイルに保存しています..." 216 217 msgid "Save successful!" 218 msgstr "保存しました。" 219 220 msgid "Save failed:" 221 msgstr "保存に失敗しました:" 222 223 msgid "The untranslated parts of the PO file (<code>%s</code>) will be overwritten." 224 msgstr "POファイルの未翻訳部分( <code>%s</code> )は上書きされます。" 225 226 msgid "This action cannot be undone. Are you sure you want to proceed?" 227 msgstr "この操作は元に戻せません。続行してもよろしいですか?" 228 229 msgid "Save process completed." 230 msgstr "保存処理が完了しました。" 231 232 msgid "Processing..." 233 msgstr "処理中..." 234 235 msgid "Yes, Overwrite and Save" 236 msgstr "はい、上書きして保存します。" 237 238 msgid "Close" 239 msgstr "閉じる" 240 25 241 msgid "Tools" 26 242 msgstr "ツール" 27 243 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 "プラグインを選択してください。" 244 msgid "Quick Translate POT/PO/MO (plugin's POT/PO/MO Generator & Editor)" 245 msgstr "Quick Translate POT/PO/MO (POT/PO/MOファイルの生成と編集)" 36 246 37 247 msgid "Loading..." … … 78 288 79 289 msgid "No internationalization functions (like __(), _e(), etc.) were found in the plugin. POT/PO files cannot be created." 80 msgstr "プラグイン内に国際化関数(__()、_e()など)が見つかりませんでした。POT/PO ファイルを作成できません。"290 msgstr "プラグイン内に国際化関数(__()、_e()など)が見つかりませんでした。POT/POファイルを作成できません。" 81 291 82 292 msgid "Are you sure you want to delete the MO file? This action cannot be undone." … … 98 308 msgstr "この翻訳エントリを削除してもよろしいですか?保存すると完全に削除されます。" 99 309 310 msgid "POT file not found." 311 msgstr "POTファイルが見つかりません。" 312 313 msgid "PO file not found." 314 msgstr "POファイルが見つかりません。" 315 316 msgid "MO file not found." 317 msgstr "MOファイルが見つかりません。" 318 319 msgid "You are about to move to \"PO Auto Fill\". Continue?" 320 msgstr "「PO Auto Fill」へ移動します。続行しますか?" 321 322 msgid "Plugin not found." 323 msgstr "プラグインが見つかりません。" 324 325 msgid "* 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." 326 msgstr "<strong><code>%s</code></strong> ロケールでのPOT、PO、MOファイルが使用されます。 <br>以下の操作は、現在選択されているプラグイン内の <em>languages</em>フォルダーに対して実行されます。" 327 328 msgid "1. Generate POT file" 329 msgstr "1. POTファイルの生成" 330 331 msgid "Generates the latest POT file based on the selected plugin’s source code." 332 msgstr "選択したプラグインのソースコードをもとに、最新のPOTファイルを生成します。" 333 334 msgid "Generate POT" 335 msgstr "POTの生成" 336 337 msgid "Download POT" 338 msgstr "POTをダウンロード" 339 340 msgid "2. Generate / Update PO file from POT" 341 msgstr "2. POTファイルからPOファイルを生成/更新" 342 343 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." 344 msgstr "POファイルを更新する際、POTファイルの文字列(msgid)に対応する既存の翻訳(msgstr)は、更新後のPOファイルに保持されます。" 345 346 msgid "Generate / Update PO" 347 msgstr "POを生成/更新" 348 349 msgid "Download PO" 350 msgstr "POをダウンロード" 351 352 msgid "Go to \"PO Auto Fill\" (Auto Translation Tool)" 353 msgstr "\"PO Auto Fill\" (自動翻訳ツール)へ移動" 354 355 msgid "3. Edit PO file & Generate MO file" 356 msgstr "3. POファイルを編集してMOファイルを生成" 357 358 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." 359 msgstr "エディターでの変更は、「変更を保存してMOファイルを生成」ボタンをクリックしたときにのみPOファイルへ保存され、同時にMOファイルが生成されます。MOファイルは、WordPressが実際に翻訳を表示する際に使用するバイナリファイルです。" 360 361 msgid "Load PO" 362 msgstr "POの読み込み" 363 364 msgid "Delete MO" 365 msgstr "MOを削除" 366 367 msgid "Download MO" 368 msgstr "MOをダウンロード" 369 370 msgid "Save Changes and Generate MO" 371 msgstr "変更を保存してMOを生成" 372 373 msgid "Yes" 374 msgstr "はい" 375 376 msgid "No" 377 msgstr "いいえ" 378 379 msgid "You do not have permission. Please log in as an administrator." 380 msgstr "権限がありません。管理者としてログインしてください。" 381 382 msgid "Failed to parse PO file." 383 msgstr "POファイルの解析に失敗しました。" 384 385 msgid "WP_Filesystem could not be initialized. Please check your file permissions or credentials." 386 msgstr "WP_Filesystem を初期化できませんでした。ファイルのパーミッションまたは認証情報を確認してください。" 387 388 msgid "Failed to read file. Please check file permissions." 389 msgstr "ファイルの読み取りに失敗しました。ファイルのパーミッションを確認してください。" 390 391 msgid "Failed to create the directory. Please check file permissions." 392 msgstr "ディレクトリの作成に失敗しました。ファイルのパーミッションを確認してください。" 393 394 msgid "Failed to delete file. Please check file permissions." 395 msgstr "ファイルの削除に失敗しました。ファイルのパーミッションを確認してください。" 396 100 397 msgid "POT file not found. Please generate it first." 101 398 msgstr "POTファイルが見つかりません。まず生成してください。" 102 399 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 1 1 msgid "" 2 2 msgstr "" 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" 4 4 "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" 6 6 "PO-Revision-Date: \n" 7 7 "Last-Translator: \n" … … 17 17 msgstr "" 18 18 19 msgid "With this plugin, you can easily generate and edit a plugin’s translation files, and quickly apply the results."19 msgid "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." 20 20 msgstr "" 21 21 … … 23 23 msgstr "" 24 24 25 msgid "Auto Translator Tool" 26 msgstr "" 27 28 msgid "Auto Translator" 29 msgstr "" 30 31 msgid "PO Auto Fill (Auto Translation Tool)" 32 msgstr "" 33 34 msgid "This tool automatically translates untranslated strings in PO files using the Google or DeepL API." 35 msgstr "" 36 37 msgid "* To use this feature, you need to register for the Google API or DeepL API and obtain an API key." 38 msgstr "" 39 40 msgid "Target Plugin:" 41 msgstr "" 42 43 msgid "Select a Plugin" 44 msgstr "" 45 46 msgid "The PO file corresponding to the <strong><code>%s</code></strong> locale will be used." 47 msgstr "" 48 49 msgid "Select Translation API:" 50 msgstr "" 51 52 msgid "Google API Key:" 53 msgstr "" 54 55 msgid "Save Key" 56 msgstr "" 57 58 msgid "DeepL API Key:" 59 msgstr "" 60 61 msgid "Translation Preview" 62 msgstr "" 63 64 msgid "Save" 65 msgstr "" 66 67 msgid "Back to \"Quick Translate POT/PO/MO\"" 68 msgstr "" 69 70 msgid "Press the Preview button to translate untranslated strings and display the results." 71 msgstr "" 72 73 msgid "Insufficient permissions." 74 msgstr "" 75 76 msgid "Invalid API service specified." 77 msgstr "" 78 79 msgid "API key cannot be empty." 80 msgstr "" 81 82 msgid "API key saved." 83 msgstr "" 84 85 msgid "Plugin is not selected." 86 msgstr "" 87 88 msgid "API key is not entered." 89 msgstr "" 90 91 msgid "PO file not found. Expected paths: %s" 92 msgstr "" 93 94 msgid "Failed to read PO file." 95 msgstr "" 96 97 msgid "No untranslated strings found." 98 msgstr "" 99 100 msgid "API communication error: " 101 msgstr "" 102 103 msgid "msgid (Source String)" 104 msgstr "" 105 106 msgid "msgstr (Translation)" 107 msgstr "" 108 109 msgid "Translation preview completed." 110 msgstr "" 111 112 msgid "Invalid file path." 113 msgstr "" 114 115 msgid "Invalid file path: Must be within wp-content." 116 msgstr "" 117 118 msgid "Invalid file path: Security check failed." 119 msgstr "" 120 121 msgid "PO file does not exist or is not readable." 122 msgstr "" 123 124 msgid "PO file is not writable. Check file permissions." 125 msgstr "" 126 127 msgid "Failed to write to PO file." 128 msgstr "" 129 130 msgid "%s string translated and saved to PO file." 131 msgstr "" 132 133 msgid "Service, key, or target strings are missing." 134 msgstr "" 135 136 msgid "HTTP %1$s: %2$s" 137 msgstr "" 138 139 msgid "Unknown HTTP error" 140 msgstr "" 141 142 msgid "Google API Error" 143 msgstr "" 144 145 msgid "Failed to parse Google API response" 146 msgstr "" 147 148 msgid "No response body" 149 msgstr "" 150 151 msgid "DeepL API Error: %s" 152 msgstr "" 153 154 msgid "Failed to parse DeepL API response" 155 msgstr "" 156 157 msgid "Unsupported translation service" 158 msgstr "" 159 160 msgid "Saving API key..." 161 msgstr "" 162 163 msgid "API key saved successfully." 164 msgstr "" 165 166 msgid "Failed to save API key." 167 msgstr "" 168 169 msgid "Failed to retrieve operation result." 170 msgstr "" 171 172 msgid "Failed to communicate with the server." 173 msgstr "" 174 175 msgid "Fetching untranslated strings and calling API..." 176 msgstr "" 177 178 msgid "Preview failed:" 179 msgstr "" 180 181 msgid "API key is not set." 182 msgstr "" 183 184 msgid "No plugin selected." 185 msgstr "" 186 187 msgid "Selected API" 188 msgstr "" 189 190 msgid "Please save the key for %s." 191 msgstr "" 192 193 msgid "Translating..." 194 msgstr "" 195 196 msgid "Translation completed." 197 msgstr "" 198 199 msgid "string(s) are ready to be saved." 200 msgstr "" 201 202 msgid "No new strings were found for translation." 203 msgstr "" 204 205 msgid "Translation process failed." 206 msgstr "" 207 208 msgid "Server Response" 209 msgstr "" 210 211 msgid "No response from the server." 212 msgstr "" 213 214 msgid "Saving to PO file..." 215 msgstr "" 216 217 msgid "Save successful!" 218 msgstr "" 219 220 msgid "Save failed:" 221 msgstr "" 222 223 msgid "The untranslated parts of the PO file (<code>%s</code>) will be overwritten." 224 msgstr "" 225 226 msgid "This action cannot be undone. Are you sure you want to proceed?" 227 msgstr "" 228 229 msgid "Save process completed." 230 msgstr "" 231 232 msgid "Processing..." 233 msgstr "" 234 235 msgid "Yes, Overwrite and Save" 236 msgstr "" 237 238 msgid "Close" 239 msgstr "" 240 25 241 msgid "Tools" 26 242 msgstr "" 27 243 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." 244 msgid "Quick Translate POT/PO/MO (plugin's POT/PO/MO Generator & Editor)" 35 245 msgstr "" 36 246 … … 98 308 msgstr "" 99 309 310 msgid "POT file not found." 311 msgstr "" 312 313 msgid "PO file not found." 314 msgstr "" 315 316 msgid "MO file not found." 317 msgstr "" 318 319 msgid "You are about to move to \"PO Auto Fill\". Continue?" 320 msgstr "" 321 322 msgid "Plugin not found." 323 msgstr "" 324 325 msgid "* 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." 326 msgstr "" 327 328 msgid "1. Generate POT file" 329 msgstr "" 330 331 msgid "Generates the latest POT file based on the selected plugin’s source code." 332 msgstr "" 333 334 msgid "Generate POT" 335 msgstr "" 336 337 msgid "Download POT" 338 msgstr "" 339 340 msgid "2. Generate / Update PO file from POT" 341 msgstr "" 342 343 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." 344 msgstr "" 345 346 msgid "Generate / Update PO" 347 msgstr "" 348 349 msgid "Download PO" 350 msgstr "" 351 352 msgid "Go to \"PO Auto Fill\" (Auto Translation Tool)" 353 msgstr "" 354 355 msgid "3. Edit PO file & Generate MO file" 356 msgstr "" 357 358 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." 359 msgstr "" 360 361 msgid "Load PO" 362 msgstr "" 363 364 msgid "Delete MO" 365 msgstr "" 366 367 msgid "Download MO" 368 msgstr "" 369 370 msgid "Save Changes and Generate MO" 371 msgstr "" 372 373 msgid "Yes" 374 msgstr "" 375 376 msgid "No" 377 msgstr "" 378 379 msgid "You do not have permission. Please log in as an administrator." 380 msgstr "" 381 382 msgid "Failed to parse PO file." 383 msgstr "" 384 385 msgid "WP_Filesystem could not be initialized. Please check your file permissions or credentials." 386 msgstr "" 387 388 msgid "Failed to read file. Please check file permissions." 389 msgstr "" 390 391 msgid "Failed to create the directory. Please check file permissions." 392 msgstr "" 393 394 msgid "Failed to delete file. Please check file permissions." 395 msgstr "" 396 100 397 msgid "POT file not found. Please generate it first." 101 398 msgstr "" 102 399 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 2 2 /** 3 3 * 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.14 * 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 6 6 * Author: Kasuga 7 7 * License: GPLv2 or later … … 27 27 */ 28 28 function quick_translate_add_action_links( $links ) { 29 29 30 $settings_link = '<a href="' . esc_url( admin_url( 'tools.php?page=quick-translate-tools' ) ) . '">' . esc_html__( 'Tools', 'quick-translate-pot-po-mo' ) . '</a>'; 30 31 array_unshift( $links, $settings_link ); 32 31 33 return $links; 32 34 } … … 74 76 */ 75 77 function quick_translate_add_admin_menu() { 78 76 79 add_management_page( 77 esc_html__( "Quick Translat ion Tool(plugin's POT/PO/MO Generator & Editor)", 'quick-translate-pot-po-mo' ),78 esc_html__( 'Quick Translat ion 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' ), 79 82 'manage_options', 80 83 'quick-translate-tools', … … 92 95 */ 93 96 function quick_translate_enqueue_assets( $hook ) { 97 94 98 if ( 'tools_page_quick-translate-tools' !== $hook ) { 95 99 return; … … 115 119 'QuickTranslate', 116 120 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' ), 145 150 ), 151 'admin_url_auto_translator' => admin_url( 'tools.php?page=auto-translator' ), 146 152 ) 147 153 ); … … 165 171 foreach ( $plugins as $plugin_file => $data ) { 166 172 $folder = explode( '/', $plugin_file )[0]; 173 167 174 if ( $folder === $plugin_slug ) { 168 175 return array( … … 184 191 */ 185 192 function quick_translate_plugin_select_options() { 193 186 194 if ( ! function_exists( 'get_plugins' ) ) { 187 195 require_once ABSPATH . 'wp-admin/includes/plugin.php'; … … 190 198 $plugins = get_plugins(); 191 199 $seen = array(); 200 192 201 foreach ( $plugins as $file => $data ) { 193 202 $folder = explode( '/', $file )[0]; 203 194 204 if ( isset( $seen[ $folder ] ) ) { 195 205 continue; 196 206 } 207 197 208 $seen[ $folder ] = true; 209 198 210 ?> 199 211 <option value="<?php echo esc_attr( $folder ); ?>"><?php echo esc_html( $data['Name'] ); ?> (<?php echo esc_html( $folder ); ?>)</option> … … 210 222 */ 211 223 function quick_translate_page() { 224 212 225 if ( ! current_user_can( 'manage_options' ) ) { 213 226 wp_die( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 214 227 } 228 229 $locale = get_locale(); 215 230 216 231 ?> … … 218 233 <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> 219 234 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> 221 240 222 241 <h2><?php esc_html_e( '1. Generate POT file', 'quick-translate-pot-po-mo' ); ?></h2> … … 225 244 <p> 226 245 <?php esc_html_e( 'Target Plugin:', 'quick-translate-pot-po-mo' ); ?> 227 <select name="plugin_s lug" 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> 229 248 <?php quick_translate_plugin_select_options(); ?> 230 249 </select> … … 247 266 <p> 248 267 <?php esc_html_e( 'Target Plugin:', 'quick-translate-pot-po-mo' ); ?> 249 <select name="plugin_s lug" 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> 251 270 <?php quick_translate_plugin_select_options(); ?> 252 271 </select> … … 259 278 <?php esc_html_e( 'Download PO', 'quick-translate-pot-po-mo' ); ?> 260 279 </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> 261 283 </p> 262 284 </form> … … 269 291 echo '<p>' . esc_html( $text ) . '</p>'; 270 292 ?> 271 272 293 <p> 273 <select id="mmpt-select-plugin">294 <select name="plugin_select" id="mmpt-select-plugin" class="regular-text"> 274 295 <option value="">-- <?php esc_html_e( 'Select a Plugin', 'quick-translate-pot-po-mo' ); ?> --</option> 275 296 <?php quick_translate_plugin_select_options(); ?> … … 283 304 </button> 284 305 </p> 285 286 306 <div id="mmpt-po-editor" style="display:none; margin-top:20px;"> 287 307 <form id="mmpt-save-po-form"> … … 296 316 </form> 297 317 </div> 298 299 318 <div id="mmpt-modal" class="mmpt-modal" style="display:none;"> 300 319 <div class="mmpt-modal-content"> … … 317 336 </div> 318 337 </div> 319 320 338 <?php 321 339 } … … 329 347 */ 330 348 function mmpt_check_i18n_callback() { 349 331 350 if ( ! current_user_can( 'manage_options' ) ) { 332 351 wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 333 352 } 353 334 354 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 335 355 wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 348 368 $has_i18n = false; 349 369 $rii = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $info['path'] ) ); 350 351 370 foreach ( $rii as $file ) { 371 352 372 if ( ! $file->isFile() ) { 353 373 continue; 354 374 } 375 355 376 $ext = pathinfo( $file->getFilename(), PATHINFO_EXTENSION ); 356 377 if ( ! in_array( $ext, array( 'php', 'js', 'html', 'twig' ), true ) ) { … … 380 401 */ 381 402 function mmpt_check_pot_file_callback() { 403 382 404 if ( ! current_user_can( 'manage_options' ) ) { 383 405 wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 384 406 } 407 385 408 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 386 409 wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 410 433 */ 411 434 function mmpt_check_po_file_callback() { 435 412 436 if ( ! current_user_can( 'manage_options' ) ) { 413 437 wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 414 438 } 439 415 440 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 416 441 wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 429 454 $locale = get_locale(); 430 455 $po_file = $info['path'] . '/languages/' . $info['text_domain'] . '-' . $locale . '.po'; 431 432 456 wp_send_json_success( my_file_exists( $po_file ) ); 433 457 } … … 441 465 */ 442 466 function mmpt_check_mo_file_callback() { 467 443 468 if ( ! current_user_can( 'manage_options' ) ) { 444 469 wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 445 470 } 471 446 472 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 447 473 wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 460 486 $locale = get_locale(); 461 487 $mo_file = $info['path'] . '/languages/' . $info['text_domain'] . '-' . $locale . '.mo'; 462 463 488 wp_send_json_success( my_file_exists( $mo_file ) ); 464 489 } … … 472 497 */ 473 498 function mmpt_generate_pot_callback() { 499 474 500 if ( ! current_user_can( 'manage_options' ) ) { 475 501 wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 476 502 } 503 477 504 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 478 505 wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 490 517 491 518 $result = my_generate_pot_file( $plugin_slug, $info['text_domain'] ); 492 493 519 if ( is_wp_error( $result ) ) { 494 520 wp_send_json_error( esc_html( $result->get_error_message() ) ); … … 506 532 */ 507 533 function mmpt_generate_po_callback() { 534 508 535 if ( ! current_user_can( 'manage_options' ) ) { 509 536 wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 510 537 } 538 511 539 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 512 540 wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 529 557 530 558 $result = my_generate_po_file( $plugin_slug, $info['text_domain'] ); 531 532 559 if ( is_wp_error( $result ) ) { 533 560 wp_send_json_error( esc_html( $result->get_error_message() ) ); … … 547 574 */ 548 575 function mmpt_load_po_callback() { 576 549 577 if ( ! current_user_can( 'manage_options' ) ) { 550 578 wp_send_json_error( esc_html__( 'You do not have permission. Please log in as an administrator.', 'quick-translate-pot-po-mo' ) ); 551 579 } 580 552 581 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 553 582 wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 563 592 wp_send_json_error( esc_html( $info->get_error_message() ) ); 564 593 } 594 565 595 $plugin_path = $info['path']; 566 596 $text_domain = $info['text_domain']; 567 568 597 $locale = get_locale(); 569 598 $po_file = $plugin_path . '/languages/' . $text_domain . '-' . $locale . '.po'; 570 571 599 if ( ! my_file_exists( $po_file ) ) { 572 600 wp_send_json_error( esc_html__( 'PO file not found. Please generate the PO file first.', 'quick-translate-pot-po-mo' ) ); … … 625 653 */ 626 654 function mmpt_save_po_callback() { 655 627 656 if ( ! current_user_can( 'manage_options' ) ) { 628 657 wp_send_json_error( esc_html__( 'You do not have permission. Please log in as an administrator.', 'quick-translate-pot-po-mo' ) ); … … 642 671 wp_send_json_error( esc_html( $info->get_error_message() ) ); 643 672 } 673 644 674 $plugin_path = $info['path']; 645 675 $text_domain = $info['text_domain']; 646 647 676 $locale = get_locale(); 648 649 677 $pot_file = $plugin_path . '/languages/' . $text_domain . '.pot'; 650 678 $po_file = $plugin_path . '/languages/' . $text_domain . '-' . $locale . '.po'; … … 692 720 693 721 if ( ! empty( $msgid ) ) { 722 694 723 if ( isset( $existing_entries_by_msgid[ $msgid ] ) ) { 695 724 $entry = $existing_entries_by_msgid[ $msgid ]; … … 726 755 */ 727 756 function mmpt_delete_mo_file_callback() { 757 728 758 if ( ! current_user_can( 'manage_options' ) ) { 729 759 wp_send_json_error( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 730 760 } 761 731 762 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 732 763 wp_send_json_error( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 734 765 735 766 $plugin_slug = isset( $_POST['plugin_slug'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin_slug'] ) ) : ''; 736 737 767 if ( ! $plugin_slug ) { 738 768 wp_send_json_error( esc_html__( 'No plugin specified.', 'quick-translate-pot-po-mo' ) ); … … 743 773 wp_send_json_error( esc_html( $info->get_error_message() ) ); 744 774 } 775 745 776 $plugin_path = $info['path']; 746 777 $text_domain = $info['text_domain']; 747 748 778 $locale = get_locale(); 749 779 $mo_file = $plugin_path . '/languages/' . $text_domain . '-' . $locale . '.mo'; … … 767 797 */ 768 798 function mmpt_download_pot_callback() { 799 769 800 if ( ! current_user_can( 'manage_options' ) ) { 770 801 wp_die( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 771 802 } 803 772 804 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 773 805 wp_die( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 785 817 786 818 $pot_file = $info['path'] . '/languages/' . $info['text_domain'] . '.pot'; 787 788 819 $file_contents = my_read_file_contents( $pot_file ); 789 820 if ( is_wp_error( $file_contents ) ) { … … 806 837 */ 807 838 function mmpt_download_po_callback() { 839 808 840 if ( ! current_user_can( 'manage_options' ) ) { 809 841 wp_die( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 810 842 } 843 811 844 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 812 845 wp_die( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 825 858 $locale = get_locale(); 826 859 $po_file = $info['path'] . '/languages/' . $info['text_domain'] . '-' . $locale . '.po'; 827 828 860 $file_contents = my_read_file_contents( $po_file ); 829 861 if ( is_wp_error( $file_contents ) ) { … … 846 878 */ 847 879 function mmpt_download_mo_callback() { 880 848 881 if ( ! current_user_can( 'manage_options' ) ) { 849 882 wp_die( esc_html__( 'You do not have permission.', 'quick-translate-pot-po-mo' ) ); 850 883 } 884 851 885 if ( ! check_ajax_referer( 'quick_translate_nonce', '_ajax_nonce', false ) ) { 852 886 wp_die( esc_html__( 'Nonce verification failed. Please reload the page and try again.', 'quick-translate-pot-po-mo' ) ); … … 865 899 $locale = get_locale(); 866 900 $mo_file = $info['path'] . '/languages/' . $info['text_domain'] . '-' . $locale . '.mo'; 867 868 901 $file_contents = my_read_file_contents( $mo_file ); 869 902 if ( is_wp_error( $file_contents ) ) { … … 886 919 */ 887 920 function my_init_filesystem() { 921 888 922 global $wp_filesystem; 889 923 if ( empty( $wp_filesystem ) ) { … … 892 926 } 893 927 require_once ABSPATH . 'wp-admin/includes/file.php'; 928 894 929 $creds = request_filesystem_credentials( site_url() . '/wp-admin/', '', false, false, null ); 895 930 if ( ! WP_Filesystem( $creds ) ) { … … 897 932 } 898 933 } 934 899 935 return true; 900 936 } … … 909 945 */ 910 946 function my_file_exists( $file_path ) { 947 911 948 $result = my_init_filesystem(); 912 949 if ( is_wp_error( $result ) ) { 913 950 return false; 914 951 } 952 915 953 global $wp_filesystem; 916 954 return $wp_filesystem->exists( $file_path ); … … 926 964 */ 927 965 function my_read_file_contents( $file_path ) { 966 928 967 $result = my_init_filesystem(); 929 968 if ( is_wp_error( $result ) ) { 930 969 return $result; 931 970 } 971 932 972 global $wp_filesystem; 933 973 $content = $wp_filesystem->get_contents( $file_path ); … … 935 975 return new WP_Error( 'read_error', esc_html__( 'Failed to read file. Please check file permissions.', 'quick-translate-pot-po-mo' ) ); 936 976 } 977 937 978 return $content; 938 979 } … … 948 989 */ 949 990 function my_write_file_contents( $file_path, $content ) { 991 950 992 $result = my_init_filesystem(); 951 993 if ( is_wp_error( $result ) ) { 952 994 return $result; 953 995 } 996 954 997 global $wp_filesystem; 955 998 $success = $wp_filesystem->put_contents( $file_path, $content, FS_CHMOD_FILE ); … … 957 1000 return new WP_Error( 'write_error', esc_html__( 'Failed to write file. Please check file permissions.', 'quick-translate-pot-po-mo' ) ); 958 1001 } 1002 959 1003 return true; 960 1004 } … … 969 1013 */ 970 1014 function my_create_dir( $dir_path ) { 1015 971 1016 $result = my_init_filesystem(); 972 1017 if ( is_wp_error( $result ) ) { 973 1018 return $result; 974 1019 } 1020 975 1021 global $wp_filesystem; 976 1022 if ( $wp_filesystem->is_dir( $dir_path ) ) { 977 1023 return true; 978 1024 } 1025 979 1026 $success = $wp_filesystem->mkdir( $dir_path ); 980 1027 if ( ! $success ) { 981 1028 return new WP_Error( 'dir_creation_failed', esc_html__( 'Failed to create the directory. Please check file permissions.', 'quick-translate-pot-po-mo' ) ); 982 1029 } 1030 983 1031 return true; 984 1032 } … … 993 1041 */ 994 1042 function my_delete_file( $file ) { 1043 995 1044 $result = my_init_filesystem(); 996 1045 if ( is_wp_error( $result ) ) { 997 1046 return $result; 998 1047 } 1048 999 1049 global $wp_filesystem; 1000 1050 if ( ! $wp_filesystem->exists( $file ) ) { 1001 1051 return false; 1002 1052 } 1053 1003 1054 $success = $wp_filesystem->delete( $file ); 1004 1055 if ( ! $success ) { 1005 1056 return new WP_Error( 'delete_error', esc_html__( 'Failed to delete file. Please check file permissions.', 'quick-translate-pot-po-mo' ) ); 1006 1057 } 1058 1007 1059 return true; 1008 1060 } … … 1018 1070 */ 1019 1071 function my_generate_pot_file( $plugin_slug, $text_domain ) { 1072 1020 1073 if ( ! function_exists( 'get_plugins' ) ) { 1021 1074 require_once ABSPATH . 'wp-admin/includes/plugin.php'; … … 1048 1101 if ( $plugin_file && isset( $plugins[ $plugin_file ] ) ) { 1049 1102 $plugin_data = $plugins[ $plugin_file ]; 1050 1103 1051 1104 if ( ! empty( $plugin_data['Name'] ) ) { 1052 1105 $strings[ html_entity_decode( $plugin_data['Name'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ] = ''; 1053 1106 } 1107 1054 1108 if ( ! empty( $plugin_data['Description'] ) ) { 1055 1109 $strings[ html_entity_decode( $plugin_data['Description'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ] = ''; 1056 1110 } 1111 1057 1112 if ( ! empty( $plugin_data['Author'] ) ) { 1058 1113 $strings[ html_entity_decode( $plugin_data['Author'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ] = ''; … … 1062 1117 $rii = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $plugin_path ) ); 1063 1118 foreach ( $rii as $file ) { 1119 1064 1120 if ( ! $file->isFile() ) { 1065 1121 continue; 1066 1122 } 1123 1067 1124 $ext = pathinfo( $file->getFilename(), PATHINFO_EXTENSION ); 1068 1125 if ( ! in_array( $ext, array( 'php', 'js', 'html', 'twig' ), true ) ) { … … 1083 1140 1084 1141 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' ); 1087 1144 $strings[ $msgid ] = ''; 1088 1145 } … … 1093 1150 } 1094 1151 1095 $header_string = 'msgid ""' . "\n" . 'msgstr ""' . "\n"; 1096 1152 $header_string = 'msgid ""' . "\n" . 'msgstr ""' . "\n"; 1097 1153 $header_string .= '"Project-Id-Version: ' . addcslashes( $plugin_data['Name'], '"' ) . ' ' . addcslashes( $plugin_data['Version'], '"' ) . '\\n"' . "\n"; 1098 1154 $header_string .= '"Report-Msgid-Bugs-To: \\n"' . "\n"; … … 1135 1191 */ 1136 1192 function my_generate_po_file( $plugin_slug, $text_domain ) { 1193 1137 1194 $plugin_path = WP_PLUGIN_DIR . '/' . $plugin_slug; 1138 1195 $languages_dir = $plugin_path . '/languages'; … … 1165 1222 $existing_translations = array(); 1166 1223 foreach ( $existing_po_entries as $entry ) { 1224 1167 1225 if ( isset( $entry['msgid'] ) && isset( $entry['msgstr'] ) ) { 1168 1226 $existing_translations[ $entry['msgid'] ] = $entry['msgstr']; … … 1171 1229 1172 1230 foreach ( $pot_entries as $pot_entry ) { 1231 1173 1232 if ( isset( $pot_entry['msgid'] ) ) { 1174 1233 $msgid = $pot_entry['msgid']; … … 1180 1239 } 1181 1240 } 1241 1182 1242 $is_update = true; 1243 1183 1244 } else { 1245 1184 1246 $po_entries = $pot_entries; 1185 1247 $is_update = false; … … 1198 1260 * 1199 1261 * @since 1.0.0 1262 * @since 1.1.1 Add HTML entity decoding for msgid/msgstr. 1200 1263 * 1201 1264 * @param string $po_file The path to the PO file. 1202 1265 * @return array|WP_Error|false 1203 1266 */ 1204 /**1205 * Parses a PO file into an array of entries.1206 *1207 * @since 1.0.01208 * @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|false1212 */1213 1267 function my_parse_po_file( $po_file ) { 1268 1214 1269 if ( ! my_file_exists( $po_file ) ) { 1215 1270 return false; … … 1222 1277 1223 1278 $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; 1228 1283 $current_key = null; 1229 1284 1230 1285 foreach ( $lines as $line ) { 1286 1231 1287 $line = trim( $line ); 1232 1233 1288 if ( '' === $line ) { 1289 1234 1290 if ( ! empty( $entry ) && isset( $entry['msgid'] ) ) { 1291 1235 1292 if ( isset( $entry['msgid'] ) ) { 1236 1293 $entry['msgid'] = html_entity_decode( $entry['msgid'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ); 1237 1294 } 1295 1238 1296 if ( isset( $entry['msgstr'] ) ) { 1239 1297 $entry['msgstr'] = html_entity_decode( $entry['msgstr'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ); 1240 1298 } 1299 1241 1300 $entries[] = $entry; 1242 1301 } 1243 $entry = array(); 1244 $state = null; 1302 1303 $entry = array(); 1304 $state = null; 1245 1305 $current_key = null; 1246 1306 continue; … … 1252 1312 1253 1313 if ( preg_match( '/^msgid\s+"(.*)"$/', $line, $matches ) ) { 1314 1254 1315 $entry['msgid'] = stripcslashes( $matches[1] ); 1255 $current_key = 'msgid';1256 $state = 'msgid';1316 $current_key = 'msgid'; 1317 $state = 'msgid'; 1257 1318 continue; 1319 1258 1320 } elseif ( preg_match( '/^msgstr\s+"(.*)"$/', $line, $matches ) ) { 1321 1259 1322 $entry['msgstr'] = stripcslashes( $matches[1] ); 1260 $current_key = 'msgstr';1261 $state = 'msgstr';1323 $current_key = 'msgstr'; 1324 $state = 'msgstr'; 1262 1325 continue; 1326 1263 1327 } elseif ( preg_match( '/^msgctxt\s+"(.*)"$/', $line, $matches ) ) { 1328 1264 1329 $entry['msgctxt'] = stripcslashes( $matches[1] ); 1265 $current_key = 'msgctxt';1330 $current_key = 'msgctxt'; 1266 1331 continue; 1267 1332 } 1268 1333 1269 1334 if ( ( 'msgid' === $current_key || 'msgstr' === $current_key || 'msgctxt' === $current_key ) && preg_match( '/^"(.*)"$/', $line, $m ) ) { 1335 1270 1336 $entry[ $current_key ] .= stripcslashes( $m[1] ); 1271 1337 continue; 1272 1338 } 1273 1339 } 1274 1340 1275 1341 if ( ! empty( $entry ) && isset( $entry['msgid'] ) ) { 1342 1276 1343 if ( isset( $entry['msgid'] ) ) { 1277 1344 $entry['msgid'] = html_entity_decode( $entry['msgid'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ); 1278 1345 } 1346 1279 1347 if ( isset( $entry['msgstr'] ) ) { 1280 1348 $entry['msgstr'] = html_entity_decode( $entry['msgstr'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ); 1281 1349 } 1350 1282 1351 $entries[] = $entry; 1283 1352 } … … 1298 1367 */ 1299 1368 function my_save_po_file( $po_file, $entries, $pot_file, $plugin_slug ) { 1369 1300 1370 $locale = get_locale(); 1301 1371 $plural_forms = my_get_plural_forms( substr( $locale, 0, 2 ) ); … … 1308 1378 1309 1379 if ( $plugin_slug ) { 1380 1310 1381 foreach ( $plugins as $file => $data ) { 1382 1311 1383 if ( strpos( $file, $plugin_slug . '/' ) === 0 ) { 1312 1384 $plugin_file = $file; … … 1314 1386 } 1315 1387 } 1388 1316 1389 if ( $plugin_file && isset( $plugins[ $plugin_file ] ) ) { 1317 1390 $plugin_data = $plugins[ $plugin_file ]; … … 1319 1392 } 1320 1393 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' ); 1324 1397 $plugin_version_decoded = html_entity_decode( $plugin_data['Version'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ); 1325 1398 1326 1399 $header_string .= '"Project-Id-Version: ' . addcslashes( $plugin_name_decoded, '"' ) . ' ' . addcslashes( $plugin_version_decoded, '"' ) . '\\n"' . "\n"; 1327 1400 $header_string .= '"Report-Msgid-Bugs-To: \\n"' . "\n"; 1401 1328 1402 if ( file_exists( $pot_file ) ) { 1329 1403 $header_string .= '"POT-Creation-Date: ' . gmdate( 'Y-m-d H:i:s+0000', filemtime( $pot_file ) ) . '\\n"' . "\n"; … … 1331 1405 $header_string .= '"POT-Creation-Date: NOT FOUND\\n"' . "\n"; 1332 1406 } 1407 1333 1408 $header_string .= '"PO-Revision-Date: ' . gmdate( 'Y-m-d H:i:s+0000' ) . '\\n"' . "\n"; 1334 1409 1335 $current_user = wp_get_current_user();1410 $current_user = wp_get_current_user(); 1336 1411 $translator_name = addcslashes( $current_user->display_name, '"' ); 1337 1412 … … 1348 1423 1349 1424 foreach ( $entries as $entry ) { 1425 1350 1426 if ( ! isset( $entry['msgid'] ) || ! isset( $entry['msgstr'] ) ) { 1351 1427 continue; 1352 1428 } 1429 1353 1430 if ( '' === $entry['msgid'] ) { 1354 1431 continue; 1355 1432 } 1433 1356 1434 $content .= 'msgid "' . addcslashes( $entry['msgid'], '"' ) . "\"\n"; 1357 1435 $content .= 'msgstr "' . addcslashes( $entry['msgstr'], '"' ) . "\"\n\n"; … … 1378 1456 */ 1379 1457 function my_generate_mo_from_po( $po_file, $mo_file ) { 1458 1380 1459 if ( ! my_file_exists( $po_file ) ) { 1381 1460 return new WP_Error( 'po_not_found', esc_html__( 'PO file not found.', 'quick-translate-pot-po-mo' ) ); … … 1386 1465 return $entries; 1387 1466 } 1467 1388 1468 if ( false === $entries ) { 1389 1469 return new WP_Error( 'parse_error', esc_html__( 'Failed to parse PO file.', 'quick-translate-pot-po-mo' ) ); … … 1395 1475 1396 1476 foreach ( $entries as $entry ) { 1477 1397 1478 if ( ! isset( $entry['msgid'] ) ) { 1398 1479 continue; 1399 1480 } 1481 1400 1482 if ( '' === $entry['msgid'] ) { 1401 1483 continue; 1402 1484 } 1485 1403 1486 $ids[] = $entry['msgid']; 1404 1487 $strs[] = isset( $entry['msgstr'] ) && ! empty( $entry['msgstr'] ) ? $entry['msgstr'] : $entry['msgid']; … … 1407 1490 $id_count = count( $ids ); 1408 1491 $offsets = 7 * 4 + $id_count * 8 * 2; 1409 1410 1492 $id_table = ''; 1411 1493 $str_table = ''; … … 1435 1517 $mo .= pack( 'I', $offset + $offsets ); 1436 1518 } 1519 1437 1520 foreach ( $str_offsets as $offset ) { 1438 1521 $mo .= pack( 'I', strlen( $strs[ array_search( $offset, $str_offsets, true ) ] ) ); … … 1460 1543 */ 1461 1544 function my_get_plural_forms( $lang_code ) { 1545 1462 1546 $plural_forms_map = array( 1463 1547 'af' => 'nplurals=2; plural=(n != 1);', … … 1548 1632 return isset( $plural_forms_map[ $lang_code ] ) ? $plural_forms_map[ $lang_code ] : 'nplurals=2; plural=(n != 1);'; 1549 1633 } 1634 1635 require_once plugin_dir_path( __FILE__ ) . 'po-auto-fill-helper.php'; 1636 1637 register_uninstall_hook( __FILE__, 'po_auto_full_helper_uninstall' ); 1638 1639 function 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 6 6 Requires PHP: 7.4 7 7 Tested up to: 6.8 8 Stable tag: 1.1.18 Stable tag: 2.0.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 24 24 * **Edit PO Files**: Directly edit translation strings in an existing PO file. 25 25 * **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. 26 27 * **Download POT, PO, and MO Files**: Download each POT, PO, and MO file to your local directory. 27 28 * **Delete MO Files**: Remove unnecessary MO files. … … 34 35 35 36 1. Go to the **"1. Generate POT file"** section. 36 2. Select the desired plugin from the **"Target Plugin"** dropdown menu.37 2. Select the target plugin from the **"Select a Plugin"** dropdown. 37 38 3. Click the **"Generate POT"** button. 38 39 4. If a POT file already exists, a confirmation pop-up will appear. … … 43 44 44 45 1. Go to the **"2. Generate / Update PO file from POT"** section. 45 2. Select the target plugin from the **" TargetPlugin"** dropdown.46 2. Select the target plugin from the **"Select a Plugin"** dropdown. 46 47 3. Click the **"Generate / Update PO"** button. 47 48 … … 53 54 54 55 1. Go to the **"3. Edit PO file & Generate MO file"** section. 55 2. Select the plugin from the **"Select a Plugin"** dropdown.56 2. Select the target plugin from the **"Select a Plugin"** dropdown. 56 57 3. Click **"Load PO"** to display the PO file contents in a table. 57 58 4. Edit translations directly in the **"msgstr"** column. … … 59 60 60 61 ➡ 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 67 1. Click the **"Go to PO Auto Fill Tool"** button. 68 2. Select the target plugin from the **"Select a Plugin"** dropdown. 69 3. Choose either **Google API** or **DeepL API**. 70 4. Enter the corresponding **API key**. 71 5. Click the **"Preview Translation"** button. 72 6. Click the **"Save"** button to save the results to the PO file. 73 7. 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 --- 61 77 62 78 #### Table Operations … … 115 131 1. Plugin settings screen 116 132 2. Button display in an actual blog post 133 3. The Automatic Translation Tool Screen 117 134 118 135 == Changelog == 136 = 2.0.0 = 137 * Added the auto translatable tool using Google API or DeepL API. 138 * Made minor fixes. 139 119 140 = 1.1.1 = 120 141 * Fixed bugs related to special characters.
Note: See TracChangeset
for help on using the changeset viewer.