[WordPress] 外掛分享: Localize js

首頁外掛目錄 › Localize js
全新外掛
安裝啟用
尚無評分
4100 天前
最後更新
問題解決
WordPress 3.0+ v1.0 上架:2014-12-10

內容簡介

WordPress有wp_localize_scripts函數可以用來翻譯,但傳送給它的字串必須是硬編碼的。 直到您解析.js文件,並使用快速正則表達式掃描_e()的出現次數並使用WordPress _e函數本地化數據來本地化它們。*注意*。您的.po文件必須包括來自JavaScript文件的字符串。要在Poedit中執行此操作,請參閱http://stackoverflow.com/questions/16557327/how-to-generate-po-file-from-js-file-using-poedit。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Localize js」→ 直接安裝(推薦)

原文外掛簡介

WordPress has the function wp_localize_scripts for translation, but the strings passed to it have to be hard-coded. Until you parse the .js-files and scan for occurrences of _e() with a fast regexp, and localize them with the data using the WordPress _e-function to localize from a .po file. *Note*. Your po-file has to include strings from javascript files. To do this in Poedit, see http://stackoverflow.com/questions/16557327/how-to-generate-po-file-from-js-file-using-poedit.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon