前言介紹
- 這款 WordPress 外掛「Theme and plugin translation for Polylang (TTfP)」是 2016-02-02 上架。
- 目前有 10000 個安裝啟用數。
- 上一次更新是 2025-03-15,距離現在已有 49 天。
- 外掛最低要求 WordPress 5.7 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.0 以上。
- 有 34 人給過評分。
- 論壇上目前有 2 個提問,問題解答率 0%
外掛協作開發者
外掛標籤
polylang | languages | translate | translation | multilanguage |
內容簡介
「Polylang 的主題和外掛程式翻譯」是什麼?
這是 Polylang 外掛的擴充套件。Polylang 是一個可讓 WordPress 網站多語言化的擴充套件。
這個外掛可以讓 Polylang 翻譯 WordPress 主題和外掛程式。
如何設定?
選擇要針對 Polylang 翻譯文字的主題和外掛程式。
在管理儀錶板中:
Languages -> TTfP 設定
它是如何運作的?
「Polylang 的主題和外掛程式翻譯」會自動搜尋所有 WordPress 主題和外掛程式的檔案。它會從這些檔案中,選擇那些副檔名為:
php
inc
twig
此外,它還實現了與 Timber 庫 (更多資訊請參閱:http://timber.upstatement.com) 的整合,這使得翻譯 twig 的模板非常簡單。
在搜尋到模板或外掛程式的文字時,它會從 Polylang 函式中選擇文字,例如:
_e(string $text, string $domain = ‘default’);
__(string $text, string $domain = ‘default’);
_x(string $text, string $context, string $domain = ‘default’);
pll_e(string $text);
pll__(string $text);
esc_html(string $text);
esc_html_e(string $text, string $domain = ‘default’);
esc_html__(string $text, string $domain = ‘default’);
_n(string $single, string $plural, int $number, string $domain = ‘default’);
esc_attr_e(string $text, string $domain = ‘default’);
esc_attr__(string $text, string $domain = ‘default’);
在您的 function.php、主題模板或外掛程式中使用:
例如:
在 Timber 上下文中,聲明這些函式:
$context['pll_e'] = TimberHelper::function_wrapper('pll_e');
$context['pll_'] = TimberHelper::function_wrapper('pll_');
詳情請參閱:https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/
這些函式是由 Polylang 外掛定義的,用於輸出翻譯。
有了「Polylang 的主題和外掛程式翻譯」,您可以非常簡單地找到這些需翻譯的字符串並添加到 Polylang 註冊中。
然後,您可以在管理儀錶板中翻譯這些文字。
掃描結果可在翻譯選項卡中查看:
設定 -> 語言 -> 字串翻譯
或者
語言 -> 字串翻譯
您不需要使用 poedit 等程式,也不會更改像 .pot、.po、.mo 這樣的擴展名文件。
「Polylang 的主題和外掛程式翻譯」非常高效,因為掃描器只在儀錶板的選項卡中運行:
設定 -> 語言 -> 字串翻譯
或者
語言 -> 字串翻譯
匯出和匯入字串翻譯
在儀錶板中:
語言 -> TTfP 設定
篩選器參考
ttfp_domains
允許外掛程式和主題(在 functions.php 中)修改文字域的列表(用於檢索翻譯字符串的唯一標識符)。
文字域列表顯示在:
原文外掛簡介
What is “Theme and plugin translation for Polylang”?
Extension for Polylang plugin (Polylang is an extension to make multilingual WordPress websites.).
Plugin is needed to translate the WordPress themes and plugins by Polylang.
How to configure it?
Select themes and plugins to find texts for translation by Polylang.
In admin dashboard:
Languages -> TTfP Settings
How it is work?
“Theme and plugin translation for Polylang” automatically searches all files of WordPress themes and plugins. It chooses from this file only those files with extensions:
php
inc
twig
In addition, is implemented the integration with Timber library (read more: http://timber.upstatement.com) – which allows to translate twig’s skins in simple way.
Plugin in searched skins or plugins chooses texts from Polylang functions, such as:
_e(string $text, string $domain = ‘default’);
__(string $text, string $domain = ‘default’);
_x(string $text, string $context, string $domain = ‘default’);
pll_e(string $text);
pll__(string $text);
esc_html(string $text);
esc_html_e(string $text, string $domain = ‘default’);
esc_html__(string $text, string $domain = ‘default’);
_n(string $single, string $plural, int $number, string $domain = ‘default’);
esc_attr_e(string $text, string $domain = ‘default’);
esc_attr__(string $text, string $domain = ‘default’);
In your function.php, themes or plugins.
For example:
On the timber context declare this functions like:
$context['pll_e'] = TimberHelper::function_wrapper('pll_e');
$context['pll_'] = TimberHelper::function_wrapper('pll_');
See more on: https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/
These functions are defined by Polylang plugin for printing translations.
Thanks “Theme and plugin translation for Polylang” you can find these strings to translate and add to Polylang register on very simple way.
And then you can translate these texts from the admin dashboard.
The scan result can be seen on the tab with translations:
Settings -> Languages -> String translation
or
Languages -> String translation
You don’t need programs like poedit – you don’t change files with extensions like: .pot, .po, .mo.
“Theme and plugin translation for Polylang” is highly efficient because the scanner is worked only on admin dashboard in tab:
In dashboard:
Settings -> Languages -> String translation
or
Languages -> String translation
Export and import string translation
In dashboard:
Languages -> TTfP Settings
Filter reference
ttfp_domains
Allows plugins and themes (in functions.php) to modify list of text domains (unique identifier for retrieving translated strings).
List of text domains is displayed on “TTfP Settings” page to select them for translation by polylang engine.
Example:
add_filter('ttfp_domains', 'custom_ttfp_domains', 10, 1);
function custom_ttfp_domains(array $domains):array
{
$domains[] = "my-custom-domain";
return $domains;
}
Filter reference
ttfp_translation_access
Returns whether the user has capability to view and edit translations provided by TTfP.
Example:
add_filter('ttfp_translation_access', 'custom_ttfp_translation_access', 10, 1);
function custom_ttfp_translation_access(bool $hasAccess):bool
{
return current_user_can('edit_posts');
}
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Theme and plugin translation for Polylang (TTfP)」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
3.4.6 | 3.4.7 | 3.4.8 | 3.4.9 | trunk |
延伸相關外掛(你可能也想知道)
Loco Translate 》Loco Translate 提供在瀏覽器中編輯 WordPress 翻譯文件和與自動翻譯服務集成的功能。, 它還為開發人員提供 Gettext/本地化工具,例如提取字符串和生成模板。...。
Polylang 》ts, Polylang is developed by the Polylang team with the help of numerous contributors., If you want to contribute or report an issue, please visit ...。
Translate WordPress with GTranslate 》Translate WordPress with GTranslate外掛使用 Google Translate 自動翻譯服務,讓您的 WordPress 網站多語言化,並發揮 Google 的力量。有103種語言可供選擇...。
Translate Multilingual sites – TranslatePress 》透過可視化的翻譯介面,直接從前端翻譯您的WordPress網站並製作多語言網站,體驗更好的翻譯方式。, TranslatePress是一個任何人都可以使用的WordPress翻譯外...。
Cyr-To-Lat 》將文章、頁面和分類別名中的 Cyrillic 字元轉換為 Latin 字元,有助於建立易於閱讀的 URL。, 特點, , 唯一具有完全可編輯的轉換表的外掛程式。可以添加/刪除...。
Translate WordPress – Google Language Translator 》Google Language Translator 外掛現已經成為 GTranslate 家族的一員!, GTranslate 自 2008 年以來一直是一家領先的網站翻譯服務提供商,為全球超過 500,000 ...。
Translate WordPress and go Multilingual – Weglot 》Weglot Translate是領先的WordPress翻譯外掛,全球有超過60,000個使用者信任。您可以在幾分鐘內將WordPress網站翻譯成110多種語言,無需編碼即可實現多語言。...。
Performant Translations 》- 本專案使用了一種新的方法來處理 WordPress 的翻譯檔案,大幅提升本地化速度。, - 深入的 i18n 效能分析顯示,經過本地化處理的 WordPress 網站載入速度顯...。
Say what? 》這是一個易於使用的外掛,允許您改變網站上的字符串而無需編輯 WordPress 核心或外掛程式碼。只需輸入當前字符串和您想要替換的內容,外掛程式就會自動執行其...。
WP Multilang – Translation and Multilingual Plugin 》WP Multilang 是 WordPress 的多語言外掛。, 翻譯文章類型、分類法、元字段、選項、多媒體檔案中的文本字段、選單、標題和小工具中的文本字段。, WP Multilan...。
Prisna GWT – Google Website Translator 》這個外掛讓 Google 自動翻譯服務的強大功能可翻譯您的網站成 100 多種語言,是 WordPress 的一個簡單而完整的多語言解決方案。, 功能:, , 易於安裝,包括內聯...。
My WP Translate 》這是一個簡單而強大的 WordPress 翻譯外掛程式,可在支援翻譯的大部分主題和外掛中使用。, , 為什麼要選擇 My WP Translate 自 MyThemeShop:, , 在 WordPres...。
Admin Language Per User 》這個插件讓你的後台管理面板可以以英文或任何已安裝的語言顯示,即使你的網站翻譯為其他語言。語言偏好設置可以基於使用者個人設定設定。, 在多站點上已進行...。
Polylang Theme Strings 》什麼是「Polylang 主題字串」,它是用來做什麼的?, 此外掛提供多種附加功能,可應用於 Polylang 掛件。它會自動掃描所有啟用 WP 主題(和所有掛件)的樣本檔...。
Admin Locale 》這個外掛提供了在網站上以某種語言運行(例如阿拉伯語),並在管理面板中使用另一種語言(例如英語)的能力。, 只需前往「設定」»「一般」,然後選擇您...。