Linux 软件免费装
Banner图

PerfLocale

开发者 alexgeorgiev
更新时间 2026年12月4日 16:44
PHP版本: 8.1 及以上
WordPress版本: 7.1
版权: GPL-2.0+
版权网址: 版权信息

标签

language i18n translation localization multilingual

下载

1.0.5 1.0.2 1.0.7.5 1.0.8 1.0.0 1.0.4 1.0.6 1.0.7 1.0.7.1 1.0.7.1.1 1.0.7.2 1.0.7.3 1.0.3 1.0.7.3.1 1.0.7.4 1.0.1 1.0.8.0.1 1.0.8.1

详情介绍:

PerfLocale is a multilingual plugin for WordPress. It tries to add as little work to each page as it can: it loads only the code a request needs, reads the links and slugs of a page's posts together instead of one by one, and keeps what it looked up in memory for the rest of the request. Between requests it keeps them in your persistent object cache (such as Redis) or, without one, in transients. Features More for visitors and search engines A Content-Language HTTP header, a data-nosnippet wrapper when a page shows content in another language as a fallback, and optional Speculation Rules prerendering and View Transitions when a visitor switches languages. Integrations Each integration loads when the plugin or theme it is for is active: WooCommerce, Elementor, Beaver Builder, Bricks, Oxygen (Classic and 6), ACF, Meta Box, Pods, Gravity Forms, WPForms, Contact Form 7, Yoast SEO, Rank Math, AIOSEO, SEOPress, The SEO Framework, Slim SEO, and the Blocksy, Kadence and Neve themes. For developers More than 200 action and filter hooks, a REST API, WP-CLI commands and a documented addon system. A PHP helper API lets you translate a string or run a piece of your own code in a chosen language. Classes and methods marked @api do not change in a breaking way within 1.x. Works on multisite. Full docs at perflocale.com/docs. Try it without installing anything. Open a throwaway WordPress site in your browser with PerfLocale already active: Open PerfLocale in WordPress Playground Where to go next

安装:

  1. Go to Plugins → Add New Plugin, search for PerfLocale, then click Install Now and Activate.
  2. Go to PerfLocale → Languages, add your languages, and click Set as Default on your site's main language.
  3. Go to PerfLocale → Settings → URL & Routing and choose your language URLs: /de/ (the default), de.example.com, per-language domains, or ?lang=de.
  4. Translate: open a post, page or category, and in its Translations panel click + Create beside a language. Then edit the new translation in the normal editor.
  5. Add a language switcher: the Language Switcher block or widget, the [perflocale_switcher] shortcode, or a menu under PerfLocale → Settings → Language Switcher.
  6. Optional: under PerfLocale → Settings → SEO, select your SEO plugin. Hreflang tags are on by default.
  7. Optional: for machine translation, enable Machine Translation under PerfLocale → Integrations, then choose a provider under PerfLocale → Settings → Integrations → Machine Translation and add its API key (DeepL, Google or Microsoft). On WordPress 7.0 or newer you can choose the WordPress AI Client instead and connect an AI provider under Settings → Connectors.
  8. Open Tools → Site Health. It tells you if your server needs anything.
Good to know

屏幕截图:

  • WooCommerce cart in German - translated product titles, attributes, and currency
  • PerfLocale dashboard - per-language translation progress for every post type, with draft and outdated counts
  • Settings - Export & Import: bring existing translations across from WPML, Polylang, or TranslatePress as a background job that is safe to re-run
  • Languages screen - add languages, set the default, and mark text direction
  • Settings - Performance: string-translation mode (files or database), object cache, and slug preloading
  • Strings screen - translate gettext strings from any plugin or theme, with PO export and import
  • Settings - URL & Routing: missing-translation action and per-language fallback chains
  • Jobs - bulk and whole-site translation runs in the background: chunked, resumable, with automatic retries and per-blog status

升级注意事项:

1.0.8.1 WordPress 7.2 and Windows server support, PHP 8.6 fixes, security hardening, a block-by-block review of Content ReSync updates, a GeoIP database file as visitor country source and stricter language domains. 1.0.8.0.1 Security hardening. PerfLocale now works with PHP 8.6. 1.0.8 Security hardening. Translated URL bases, Content ReSync, machine translation of long posts in parts, less code per page. The Contact Form 7 integration needs CF7 5.8 or later and pauses with an older CF7. To go back, restore the pre-update database backup and wp-content/uploads/perflocale/. 1.0.7.5 Security hardening. Less code on every page, large XLIFF imports as background jobs (the REST route answers 202 with a job id), a Strings screen that never overwrites changes made after you opened it, and database upgrades that retry on their own. 1.0.7.4 Security hardening. Background jobs that continue after a stopped worker, protected blocks that keep their markup, and less code on visitor pages. 1.0.7.3.1 Opening an unpublished translation in a page builder opens the translation, not the original page. 1.0.7.3 Security hardening. Machine translations that would break block markup are no longer saved, a more complete and safer Export & Import, Site Editor menus and patterns per language, and less work on large sites. 1.0.7.2 Security hardening. Less code on visitor pages, the language switcher in 24 languages, and more reliable stock, Sync Fields and slug redirects under concurrent edits. 1.0.7.1.1 Fixes an error after every save in the block editor. 1.0.7.1 Security hardening. Faster cart and checkout on stores whose language copies share stock, Sync Fields that keeps the original's publish date, Create in the Site Editor's Translations panel, and a Site Health check for missing language packs. 1.0.7 Security hardening. A language that still has posts can no longer be deleted (deactivate it instead), and a Merge import no longer changes this site's settings or roles. Custom fields, WooCommerce stock, bulk translation jobs and imports are more reliable. 1.0.6 Security hardening and stricter permission checks. Importing a JSON file from another site can now ask you to confirm this site is a copy of it. On WooCommerce stores, default-language pages no longer set the language cookie. Multisite uninstall and activation are more reliable.

常见问题:

Does PerfLocale slow down my site?

It adds some work to each page, as every multilingual plugin does, and it is written to keep that work small. It loads only the code a request needs, reads the data of a page's posts together, and keeps what it looked up in memory for the request. Between requests it uses your persistent object cache (such as Redis) or, without one, transients. Larger sites - many translated posts across many languages - benefit from a persistent object cache. PerfLocale works with page-cache plugins (WP Super Cache, W3 Total Cache, LiteSpeed Cache, etc.); cached pages already include the translated output from the request that filled the cache. Real-world page speed depends mostly on your theme, hosting, and other plugins.

Does it work with WooCommerce?

Yes. You can translate products, variations, categories and attributes. Inventory (stock, SKU, GTIN, price, weight, dimensions) stays in sync across language variants whenever WooCommerce saves a product, whether the change comes from an order, the product editor, Quick Edit, the REST API, an import, or another plugin. Prices can be shown in several currencies, with exchange rates from the European Central Bank's daily reference rates or from a provider your site registers through a filter. Order emails are sent in the customer's language, and the mini-cart, cart and checkout use the visitor's language.

Does it work with page builders?

Yes. PerfLocale integrates with Elementor, Beaver Builder, Bricks Builder, Oxygen Classic, and Oxygen 6.0. Each builder's content is registered as translatable meta, and dedicated Language Switcher widgets/elements are provided for Elementor, Beaver Builder, and Bricks - in Oxygen (Classic or 6.0) use the [perflocale_switcher] shortcode in a Code Block or Shortcode element.

Does it translate block-theme templates and template parts?

Yes. It is off by default. Tick Templates and template parts under Site parts at PerfLocale → Settings → Translation and the block templates and template parts you edit in the Site Editor - header, footer, 404, archive layouts - become translatable like any other content, along with the patterns, navigation labels and post content embedded in them. A translation only takes effect once you publish it. WordPress renders an empty region for a template part it cannot resolve, so a half-finished header would leave a blank strip across the site; until the translation is published, visitors keep seeing the original. The Site Editor's own Translations panel shows which languages exist and labels anything still in draft.

How do I translate patterns and block-theme menus?

It depends on which kind of pattern you used, and the two look identical in the editor. A pattern you insert from the inserter is copied into the page, so its text is simply part of that page - translate the page under PerfLocale → Translations and the text comes with it. (This is also why the theme's pattern strings on the Strings screen don't apply to it: those are used when the theme renders the pattern file itself, while the copy in your page is plain HTML.) A synced pattern is stored once and the page only holds a reference to it, so there is nothing in the page to translate. Tick "Synced patterns" under Site parts at PerfLocale → Settings → Translation, then translate each pattern like any other post; PerfLocale serves the right one per language, including patterns nested inside a Group. Block-theme menus work the same way. Menu link addresses are already translated without any setting; enable "Navigation menus" in the same place to translate the visible labels too. In both cases, if a translation is missing or still a draft the original renders - never a blank space.

How do I translate the site title and tagline?

Go to PerfLocale → Strings and translate them like any other string - they are listed there as "Site Title" and "Tagline". There is nothing to switch on, and no scan to run: they are registered automatically when the plugin is updated or activated. Your original title and tagline are never overwritten. PerfLocale serves the translated text on the front end only, and refuses any attempt to write a translated value back over the original.

Can I migrate from WPML, Polylang, or TranslatePress?

Yes. PerfLocale includes built-in migration tools for all three plugins. PerfLocale refuses to run while WPML, Polylang or TranslatePress is active, so deactivate the old plugin first - its data stays in the database - then go to PerfLocale → Settings → Export & Import and use the Migration section. Migrations run in batches and leave the old plugin's data untouched. An import that stops part-way can be run again: translations already imported are reused, not duplicated. Back up your database before a large import.

Does it support RTL languages?

Yes. PerfLocale detects the text direction from the language configuration and sets the correct dir="rtl" attribute on the HTML element. PerfLocale's own stylesheets, for the language switcher and the admin screens, have right-to-left versions for languages such as Arabic and Hebrew.

Is it compatible with caching plugins?

Yes. Page-cache plugins such as WP Super Cache, W3 Total Cache, LiteSpeed Cache and WP Rocket work with PerfLocale, because each language version has its own URL and so its own cache entry. Any response whose language was decided by something other than the URL - a GeoIP or browser-language redirect, a returning visitor's language cookie - is sent with WordPress' no-cache headers (nocache_headers()), so a cache that respects them does not store one visitor's language and serve it to everyone. On an edge or server cache (Varnish, nginx fastcgi_cache) make sure Cache-Control is honoured or those responses are excluded. Note that enabling GeoIP / browser redirection makes default-language entry URLs uncacheable by design - a page cache serving them from cache would skip the redirect entirely; if you need both, use the bundled edge worker (assets/js/edge-helper.js) to route at the CDN instead. In cookieless mode those redirects do not run, so the default-language entry URLs stay cacheable.

Can I use it on multisite?

Yes. Each site in the network has its own languages and translations. PerfLocale's in-memory caches are kept per site and are reset when code switches from one site to another.

Can I keep API keys out of the database?

Yes. PerfLocale reads each machine-translation API key from these sources, in this order, and uses the first one that has a value: an environment variable, a wp-config.php constant, a key saved under Settings → Connectors (WordPress 7.0 and later; DeepL, Google, Microsoft and LibreTranslate), then the PerfLocale setting. Set PERFLOCALE_DEEPL_API_KEY, PERFLOCALE_GOOGLE_API_KEY, PERFLOCALE_MICROSOFT_API_KEY, PERFLOCALE_LIBRE_API_KEY, PERFLOCALE_LIBRE_URL, PERFLOCALE_AGENCY_URL or PERFLOCALE_AGENCY_API_KEY in your container env or wp-config.php and the admin-side fields become read-only, showing which environment variable or wp-config.php constant supplies the value. With an environment variable or a constant, database backups, exports and SQL dumps do not contain the key.

What happens to my translations if I uninstall the plugin?

By default nothing is lost: uninstalling removes the plugin's roles, capabilities, and scheduled tasks, but keeps all translations, languages, and settings in the database so a later re-install picks up exactly where you left off. If you want a complete removal instead, enable "Delete all plugin data when uninstalling" in PerfLocale → Settings → Advanced before uninstalling - then every plugin table and option is deleted. On an object cache that cannot clear groups, PerfLocale's cached copies expire on their own within a day, or within the GeoIP cache time you set. Your posts and pages (including translated ones) are always preserved as normal WordPress content. On a multisite network each site's own choice is applied to that site, and your users' PerfLocale screen preferences, which every site shares, are removed only if no site chose to keep its data. Deleting the plugin from a very large network can run out of PHP execution time before every site is done: PerfLocale stops cleanly between sites, logs how many were purged and how many remain, and records where it stopped. Re-install the plugin and delete it again without activating it and the next pass carries on from there; from WP-CLI, wp plugin uninstall perflocale has no time limit and finishes the network in one pass. If a site fails, the log names it and the same steps retry it once the cause is fixed.

Does PerfLocale expose anything to edge workers?

When you enable Edge Worker Integration (PerfLocale → Settings → Advanced), the plugin publishes one public REST endpoint that edge runtimes (Cloudflare Workers, Vercel Edge, Netlify Edge, AWS Lambda@Edge) can read to route visitors before the request reaches WordPress:

  • GET /wp-json/perflocale/v1/config - returns the routing and language data an edge worker needs: active language slugs and locales, URL mode (subdirectory / subdomain / domain / query), URL prefix type, default language, hide-default-prefix flag, excluded paths, detection and redirect order, home path, plugin version, and the edge-hint header name (X-PerfLocale-Lang) and cookie name. Response includes Cache-Control: public, max-age=300, s-maxage=3600, stale-while-revalidate=86400 plus an ETag so edges and browsers can revalidate cheaply with If-None-Match (304 on hit). When code hooks the permission filter described below, or the caller is logged in, the response is sent with Cache-Control: private, no-store instead.
The response does not contain machine-translation API keys, provider tokens, user data, internal post or term IDs, or anything that visitors cannot already see on the site (hreflang tags, language switcher, URL prefixes). That is why the endpoint is public by default. If you add to the response with the perflocale/api/config filter, keep it that way. To restrict access (private staging sites, IP allowlists, Application-Password authentication, mTLS at a reverse proxy), hook the perflocale/edge_worker/config_permission_callback filter and return false or a WP_Error for requests you do not allow. Example: add_filter( 'perflocale/edge_worker/config_permission_callback', fn () => current_user_can( 'manage_options' ) ); PerfLocale has no token or header scheme of its own. Use WordPress' own methods (Application Passwords for server-to-server requests, cookie and nonce for browser sessions, or a JWT/OAuth plugin) and check them in this filter, so the endpoint uses the same authentication as the rest of your site's REST API.

Where do I report security bugs found in this plugin?

Please report security bugs found in the source code of the PerfLocale plugin through the Patchstack Vulnerability Disclosure Program. The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.

更新日志:

Full release notes for every version: perflocale.com/changelog 1.0.8.1 1.0.8.0.1 1.0.8 1.0.7.5 1.0.7.4 1.0.7.3.1 1.0.7.3 1.0.7.2 1.0.7.1.1 1.0.7.1 1.0.7 1.0.6