[WordPress] 外掛分享: Add Locale Class

首頁外掛目錄 › Add Locale Class
全新外掛
安裝啟用
尚無評分
863 天前
最後更新
問題解決
WordPress 2.8+ v1.0.5 上架:2017-08-13

內容簡介

在多語言網站上,您可能希望根據當前使用的語言來渲染 CSS。Add Local Class 外掛通過在正面和管理頁面的 body 標記中添加當前語言代碼作為類別來解決此問題。

例如,如果您將網站的語言設置為法語,那麼所使用的語言代碼為 fr_FR。Add Local Class 會檢索語言代碼,將其格式化為"locale-fr-fr",並將其添加到網站前端的 body 標記中。它還會檢索後端用戶的語言代碼,並在網站後端將其設置為 body 標記類別。如果網站的語言更改為美式英語,那麼類別會更改為"locale-en-us"。

您可以在 CSS 文件中為法語和英語編寫不同的規則:

. locale-fr-fr .button {
背景顏色:藍色;
}

. locale-en-us .button {
背景顏色:紅色;
}

使用 Add Local Class 外掛,您可以在網站上使用特定於語言的 CSS。

此外掛沒有設置頁面。您只需安裝並啟用即可。

Add Local Class 外掛由 Max Foundry 提供。我們製作了一個 WordPress 資訊圖庫外掛、一個針對 WordPress 媒體庫文件夾的外掛和 MaxButtons。

外掛標籤

開發者團隊

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

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Add Locale Class」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

On multi language sites there may be occasions when you want to render CSS according to the current language in use. The Add Local Class plugin solves this problem by adding the current language code as a class in the body tag on both front end and admin pages.
For example, if you set the language of the site to French, then the language code used is fr_FR. Add Local Class will retrieve the language code format it as ‘locale-fr-fr’ and add it to the body tags on the front end of the site. It will also retrieve the language code of the backend user and set it as a body tag class on the back end of the site. Should the site’s language be changed to U.S. English, then the class would be changed to ‘locale-en-us’.
In your CSS file you can have one rule for French and another for English:
. locale-fr-fr .button {
background-color: blue;
}
. locale-en-us .button {
background-color: red;
}
With the Add Local Class plugin it possible to make use of language specific CSS on your site.
This plugin does not have a settings page. You simple install and activate it.
The Add Local Class plugin is brought to you by Max Foundry. We make a WordPress Gallery plugin, a plugin for WordPress media library folders and MaxButtons.

文章
Filter
Apply Filters
Mastodon