文件操作 - translated.js
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/extendify/src/QuickEdit/lib/translated.js
编辑文件内容
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;
修改文件时间
将文件时间修改为当前时间的前一年
删除文件