外掛說明
這是一個實用且簡單易用的外掛,它為 WordPress 多站網路 (例如多站網路中的子網域或子目錄網站) 新增多語內容功能。Multisite Language Switcher 讓網站管理員不費吹灰之力便能管理文章、頁面、自訂內容類型、分類、標籤集自訂分類法的譯文。
這個外掛使用了源自 FamFamFam 的旗幟圖示,由衷感謝 Mark James 的作品。此外,也必須感謝 Jürgen Mayer 為外掛製作的橫幅。
請記得為這個外掛評等,謝謝。
本地化人員
感謝全體本地化人員的卓越貢獻。
- 德國德文 (de_DE):由 Dennis Ploetner 提供
- 義大利文 (it_IT):由 Antonella Cucinelli 提供
- 荷蘭文 (nl_NL):由 Alexandra Kleijn 提供
- 巴西葡萄牙文 (pt_BR):由 Coolweb 提供
- 西班牙西班牙文 (es_ES):由 Andreas Breitschopp 提供
- 法國法文 (fr_FR):由 Andreas Breitschopp 提供
- 俄文 (ru_RU):由 Andrey Vystavkin 提供
- 烏克蘭文 (uk):由 Victor Melnichenko 提供
- 克羅埃西亞文 (hr_HR):由 Brankec69 提供
- 羅馬尼亞文 (ro_RO):由 Armand K 提供
- 波蘭文 (pl_PL):由 Kamil Frejlich 提供
- 立陶宛文 (lt_LT):由 Ovidijus Pukys 提供
- 加泰羅尼亞文 (ca_ES):由 Joan López 提供
- 捷克文 (cs_CZ):由 Rastr 提供
- 匈牙利文 (hu_HU):由 RobiG 提供
- 喬治亞文 (ka_GE):由 Jas Saran 提供
- 希臘文 (el):由 Christoforos Aivazidis 提供
- 塞爾維亞文 (sr_RS):由 Web Hosting Hub 提供
- 土耳其文 (tr):由 Alican Cakil 提供
- 亞美尼亞文 (hy_AM):由 Yeghishe Nersisyan 提供
- 孟加拉文 (bn_BD):由 Md. Nazmul Huda 提供
- 日文 (ja):由 ThemeBoy 提供
- 瑞典文 (sv_SE):由 Erik Bernskiold 提供
- 台灣繁體中文 (zh_TW) 及中國簡體中文 (zh_CN):分別由 Alex Lion (阿力獅) 及 DrBenson 提供
- 阿拉伯文 (ar):由 Mohamed Elwan 提供
- 挪威文 (nb_NO):由 Ibrahim Qraiqe 提供
- 保加利亞文 (bg_BG):由 Vencislav Raev 提供
- 墨西哥西班牙文 (es_MX):由 Fernando Mata 提供
You can translate this plugin on translate.wordpress.org, or if you prefer and have created your language pack, or have an update of an existing one, you can send me your Gettext PO and MO so that I can
bundle it into the Multisite Language Switcher. You can download the latest POT file
from here.
螢幕擷圖
適用於區塊編輯器
這個外掛提供 1 個可供區塊編輯器使用的區塊。
- Multisite Language Switcher Review the settings for the Multisite Language Switcher plugin, as the block utilizes the API function `msls_the_switcher()` for its output.
安裝方式
- 使用 WordPress 管理後台安裝外掛或…
- 將外掛安裝套件壓縮檔解壓縮得到的資料夾完整上傳至 WordPress 網站的
/wp-content/plugins目錄中。 - 在外掛管理頁面啟用這個外掛。多站網路管理員能為多站網路的全部子網站啟用外掛,或由個別子網站的網站管理員分別啟用外掛。
- After activation, configure the plugin once in each blog under
Settings->Multisite Language Switcher
完成安裝後,網站便能…
- Connect your translated pages and posts in
Posts->EditorPages->Edit - Connect your translated categories and tags in
Posts->CategoriesorPosts->Tags - 跨語言連結網站上的自訂內容類型及自訂分類法。
- create a missing translation in one step – straight from the editor metabox, or from the
Add from Translationsubmenu, which lists everything that is not translated yet and can create translations in bulk (Quick Create, new in 3.0) - 如果有提供對應的翻譯內容,便能使用小工具、區塊編輯器的區塊、短代碼
[sc_msls]及content_filter向使用者顯示相關提示。 - 使用小工具短代碼
[sc_msls_widget]。 - optionally you can place the code
<?php if ( function_exists( 'msls_the_switcher' ) ) msls_the_switcher(); ?>directly in your theme files
Review the Multisite Language Switcher Website for more information. Developers will find the API functions, every action and filter, and a set of integration snippets in the developer documentation.
常見問題集
-
在 [一般] 設定頁面中沒有可供使用的 [網站介面語言] 選項。
-
請先查看這份官方文件中對你的母語的說明。
-
有需求要讓網站保持英文介面。
-
請在控制台的 [個人資料] 設定頁面選取個人要使用的網站語言介面。
-
是否需要使用多站網路?
-
是否建置多站網路取決於網站管理員,但是如果要使用 Multisite Language Switcher,就必須採用多站網路。
-
如何依據使用者的瀏覽器偏好語言將使用者重新導向至對應的語言網站?
-
The Multisite Language Switcher does not redirect the users automatically. I’m not sure if the plugin should do that.
-
請參考 MslsMenu 附加元件外掛。
-
如何在網站上將 Multisite Language Switcher 的功能加入 HTML 選取功能中?
-
請參考 MslsSelect 附加元件外掛。
-
是否有可以呼叫取得訪客目前檢視頁面的語言資訊的函式?
-
網站管理員應該使用 WordPress API 函式
get_locale(),但也可以使用下列程式碼:$blog = msls_blog_collection()->get_current_blog(); $language = $blog->get_language();The class behind it moved to
lloc\Msls\Blog\Collectionin version 3.0.0. The old name
lloc\Msls\MslsBlogCollection still resolves, so existing code keeps working. -
如果還有其他問題,可以在何處提問?
-
請造訪 MSLS 網站或 WordPress 技術支援論壇以進一步了解相關資訊。
使用者評論
參與者及開發者
變更記錄
3.0.2
- Fixed: with more than 100 users on a blog, opening the settings page raised a PHP notice that ended up in the error log (and in services such as Sentry). The truncated user list is now reported as a hint below the “Reference user” dropdown instead.
- Changed: MSLS no longer runs
count_users()to detect the truncation, which removes a costly query from the settings page on blogs with many users.
3.0.1
- Fixed: 3.0.0 could not be published on WordPress.org
- The plugin code is identical to 3.0.0.
3.0.0
- New: Quick Create – create the translated post straight from the editor metabox, or pick a source post on the new
Add from Translationsubmenu (single and bulk). Backed by a REST endpoint and switchable in the settings. - New:
msls_quick_create_capabilitylets integrations override the Quick Create permission checks. Additional filters cover the post data, the inserted post, the REST response, the untranslated-posts list and the mapped taxonomy terms. - New: filter hooks for the AJAX suggest results of the post and term metaboxes.
- New: a developer reference in
docs/– public API, every hook, integration snippets and the Playwright setup. - Changed: the
lloc\Msls\namespace is split into per-concern sub-namespaces. Every pre-3.0 class name (MslsOptions,MslsLink,MslsOutput, …) keeps working through a backwards-compatibility alias, so add-ons and custom code do not need changes. - Changed: the public helper functions moved to
includes/api.php, and the$attrargument ofmsls_get_switcher()is now optional. - Fixed: add-ons such as MslsMenu and MslsSelect could be silently disabled because the plugin registered its classes too late. Aliases and API functions are now available the moment the plugin file is loaded.
- Fixed: authorization is checked on the destination post during content import, and the ContentImporter permission and post type checks were corrected.
- Fixed: no
home_url()fallback for taxonomy and query archives anymore. - Fixed: broken links on the page for the latest posts.
- Fixed: several issues in the blog collection.
- Internal: strict typing throughout, PHPStan level 8 clean,
ABSPATHguards, Plugin Check and PHPCS findings addressed, a wp-env based local multisite and a Playwright end-to-end suite.
2.10.1
- Fixed: deprecated function warning pointed to a non-existent function.
- Documentation: README.md code snippets reflect the new function names.
2.10.0
- New: prefixed public helper functions (
msls_get_*,msls_the_switcher) with deprecation shims for the legacy names. - New: action hook names are exposed as constants for safer programmatic use.
- Accessibility:
aria-current="page"on the active language link. - Fixed: path-related issue affecting asset/loader resolution.
The full history is kept in the separate Changelog.
