# extendify/3.1.5/src/QuickEdit/lib/translated.js

Extendify, version 3.1.5. 57 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.1.5/code/src/QuickEdit/lib/translated.js
- Raw: https://pluginprobe.com/plugins/extendify/3.1.5/raw/src/QuickEdit/lib/translated.js
- Modified: 2026-06-11T18:37:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.1.5/code/src/QuickEdit/lib/translated.js#L10-L20`.

```javascript
import { __, sprintf } from '@wordpress/i18n';

// Block types whose primary edited value is human-readable, translatable text.
// On a non-default-language render Quick Edit writes the source post_content
// while the screen shows the translation, so these are blocked and a notice is
// shown instead. Image, color, alignment, price, and link edits touch shared
// (untranslated) source and stay available — deliberately absent here.
const TEXT_BEARING_BLOCK_TYPES = new Set([
	'core/paragraph',
	'core/heading',
	'core/button',
	'core/site-title',
	'core/site-tagline',
	'core/navigation-link',
	'core/navigation-submenu',
	'product:name',
	'product:short_description',
	'product:description',
]);

export const isTextBearing = (blockType) =>
	TEXT_BEARING_BLOCK_TYPES.has(blockType);

const PLUGIN_LABELS = {
	translatepress: 'TranslatePress',
	wpml: 'WPML',
	polylang: 'Polylang',
};

export const translatedNoticeMessage = (plugin) => {
	const label = PLUGIN_LABELS[plugin];
	if (!label) {
		return __(
			"Quick Edit can't edit translated content on this page.",
			'extendify-local',
		);
	}
	return sprintf(
		// translators: %s is the multilingual plugin name, e.g. "TranslatePress".
		__(
			"Quick Edit can't edit translated content — manage translations in %s.",
			'extendify-local',
		),
		label,
	);
};

// Detected server-side at page render (Frontend::enqueue, where the request
// language is known) and shipped on the inline-script global. The REST save
// request isn't language-scoped, so the save guard reads the value the client
// forwards rather than re-detecting. Shape:
// { isTranslated: boolean, plugin: 'translatepress'|'wpml'|'polylang'|null }.
export const getTranslatedContext = () =>
	window.extQuickEditData?.translatedContext ?? null;

export const isTranslatedRender = () => !!getTranslatedContext()?.isTranslated;

```
