PerfLocale 1.0.4
— Site title and tagline, synced patterns, block-theme menus, and a PHP translation API
- The site title and tagline are now translatable. They appear on the Strings screen as “Site Title” and “Tagline” rather than as raw option names, and there is nothing to switch on and no scan to run — they are registered when the plugin is activated or updated. Your stored title is never modified: the translation is served on the front end only, and a write-side guard refuses any attempt to save a translated value back over the original.
- Synced patterns are translatable. A synced pattern is stored once and referenced by every page that uses it, so translating the page could never reach its text. Enable “Patterns” under Advanced content types at Settings → Translation and each pattern becomes translatable like any other post, including patterns nested inside a Group or Columns. Per-instance overrides live in the page rather than the pattern, so they survive translation untouched.
- Block-theme navigation menu labels are translatable. Link addresses were already localised with no setting; enabling “Navigation Menus” in the same place translates the visible labels too.
- Missing or draft translations fall back to the original. WordPress renders nothing at all for a pattern or menu reference it will not accept — a missing record, an unpublished one, a password-protected one — so every one of those conditions is checked before substituting anything. A blank space where your content used to be is worse than untranslated text.
- Fixed: a translated site title could overwrite the original. WordPress sanitises an option value before the filter that guards the write, so a title containing an apostrophe or ampersand reached the guard in a different form than the one it compared against — “Alex’s Bakery” as “Alex's Bakery” — and the round trip was allowed through. The comparison now happens at WordPress’s own sanitisation boundary.
- Fixed: the site-title strings were not registered when updating from wp-admin. The class loaded only on front-end requests, so an operator whose first request after updating was a wp-admin page — the normal case, since that is where you click update — never got the strings registered, on that request or any later one.
- Fixed: on multisite, get_site() and get_blog_details() could return the calling blog’s title for a different blog during a translated request. The site-details filter now checks which blog it was handed.
- Fixed: imposed rendering windows resolved the wrong language. Order emails and similar internal windows impose a language for part of a request, but string translations, the site title and the helper’s own accessors kept answering with the language the request arrived in — so an email could carry the wrong site title, and a right-to-left order could render left-to-right.
- Fixed: deleting a string through the plugin’s own delete path left its translation links behind, producing exactly the orphaned rows the health checks look for.
- Fixed: a site installed below a directory named test, build or dist was skipped entirely by the string scanner, which reported nothing found and gave no reason. Exclusions are now measured from the directory being scanned, so a vendor folder inside that tree is still skipped while the installation itself is not.
- Fixed: exchange-rate sync errors are recorded once per condition instead of on every scheduled run. A site that has not wired a rate source cannot resolve that from the admin, so the repeated write recorded a condition that never changed.
- Fixed: an open Export or Import panel on the Strings screen no longer sits behind the navigation tabs.
- For developers: perflocale()->with_language( $language, $callback ) runs a callback with another language imposed and restores it afterwards, even if the callback throws. It is the general primitive for rendering part of a request in another language — a custom template, a page-builder code block, a notification built outside its recipient’s request.
- For developers: perflocale()->translate( $text, $language, $args ) translates one registered string into a named language without touching request state, so it is safe in a loop. perflocale_t() gained an optional third $language argument.
- New filters: perflocale/settings/non_public_post_types controls which non-public post types are offered under Advanced content types, and perflocale/strings/context_label sets the friendly label shown for a string’s context on the Strings screen.
- Translation of block template and template part content (full site editing) is not included in this release. Customised templates keep working, and translatable content embedded in them still translates, but the template’s own text does not.