handling admin language from cookies
This commit is contained in:
parent
3854f07a4f
commit
90ff908fc8
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '6d996a67717d11da59bc');
|
||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '9351c7eea85fb0780aa2');
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__);
|
||||
/* harmony import */ var _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./img/chevron_down.svg */ "./src/img/chevron_down.svg");
|
||||
/* harmony import */ var _utils_getAdminLanguageFromCookies_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../utils/getAdminLanguageFromCookies.js */ "../../utils/getAdminLanguageFromCookies.js");
|
||||
|
||||
|
||||
|
||||
|
|
@ -195,6 +196,8 @@ function Edit({
|
|||
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
||||
passIndexToChildren();
|
||||
}, [currentBlockDatas]);
|
||||
const currentLang = (0,_utils_getAdminLanguageFromCookies_js__WEBPACK_IMPORTED_MODULE_10__["default"])("wp-wpml_current_language");
|
||||
const localVersionTextDescription = currentLang === "nl" ? "Tekstversie van de illustratie" : "Version texte des indications de l'illustration";
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.PanelBody, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, {
|
||||
variant: "primary",
|
||||
onClick: () => {
|
||||
|
|
@ -212,7 +215,7 @@ function Edit({
|
|||
}), renderedFocusPointBullets), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("button", {
|
||||
className: "homegrade-blocks-focused-thematique__figcaption-toggle",
|
||||
"aria-expanded": "false"
|
||||
}, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)("Version texte des indications de l'illustration", "homegrade-blocks__texte-fonctionnel"), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||
}, localVersionTextDescription, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||
src: _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_9__["default"],
|
||||
alt: ""
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", {
|
||||
|
|
@ -475,6 +478,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./img/chevron_down.svg */ "./src/img/chevron_down.svg");
|
||||
/* harmony import */ var _utils_getAdminLanguageFromCookies_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../utils/getAdminLanguageFromCookies.js */ "../../utils/getAdminLanguageFromCookies.js");
|
||||
|
||||
|
||||
|
||||
|
|
@ -504,6 +508,8 @@ function save({
|
|||
className: "homegrade-blocks-focus-point-bullet__index"
|
||||
}, index + 1));
|
||||
});
|
||||
const currentLang = (0,_utils_getAdminLanguageFromCookies_js__WEBPACK_IMPORTED_MODULE_4__["default"])("wp-wpml_current_language");
|
||||
const localVersionTextDescription = currentLang === "nl" ? "Tekstversie van de illustratie" : "Version texte des indications de l'illustration";
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||
className: `homegrade-blocks-focused-thematique`
|
||||
|
|
@ -517,7 +523,7 @@ function save({
|
|||
}), renderedFocusPointBullets), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("button", {
|
||||
className: "homegrade-blocks-focused-thematique__figcaption-toggle",
|
||||
"aria-expanded": "false"
|
||||
}, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("Version texte des indications de l'illustration", "homegrade-blocks__texte-fonctionnel"), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||
}, localVersionTextDescription, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||
src: _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_3__["default"],
|
||||
alt: ""
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", {
|
||||
|
|
@ -527,6 +533,35 @@ function save({
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ "../../utils/getAdminLanguageFromCookies.js":
|
||||
/*!**************************************************!*\
|
||||
!*** ../../utils/getAdminLanguageFromCookies.js ***!
|
||||
\**************************************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ getAdminLanguageFromCookies)
|
||||
/* harmony export */ });
|
||||
function getAdminLanguageFromCookies(c_name) {
|
||||
var c_value = document.cookie,
|
||||
c_start = c_value.indexOf(" " + c_name + "=");
|
||||
if (c_start == -1) c_start = c_value.indexOf(c_name + "=");
|
||||
if (c_start == -1) {
|
||||
c_value = null;
|
||||
} else {
|
||||
c_start = c_value.indexOf("=", c_start) + 1;
|
||||
var c_end = c_value.indexOf(";", c_start);
|
||||
if (c_end == -1) {
|
||||
c_end = c_value.length;
|
||||
}
|
||||
c_value = unescape(c_value.substring(c_start, c_end));
|
||||
}
|
||||
return c_value;
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/editor.scss":
|
||||
/*!*************************!*\
|
||||
!*** ./src/editor.scss ***!
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -11,8 +11,9 @@ import { useBlockProps, InspectorControls } from "@wordpress/block-editor";
|
|||
import { withNotices, Button, PanelBody } from "@wordpress/components";
|
||||
import { InnerBlocks } from "@wordpress/block-editor";
|
||||
|
||||
import { ChevronDown } from "lucide-react";
|
||||
import chevronDown from "./img/chevron_down.svg";
|
||||
import getAdminLanguageFromCookies from "../../../utils/getAdminLanguageFromCookies.js";
|
||||
|
||||
function Edit({
|
||||
attributes,
|
||||
setAttributes,
|
||||
|
|
@ -175,6 +176,12 @@ function Edit({
|
|||
passIndexToChildren();
|
||||
}, [currentBlockDatas]);
|
||||
|
||||
const currentLang = getAdminLanguageFromCookies("wp-wpml_current_language");
|
||||
const localVersionTextDescription =
|
||||
currentLang === "nl"
|
||||
? "Tekstversie van de illustratie"
|
||||
: "Version texte des indications de l'illustration";
|
||||
|
||||
return (
|
||||
<>
|
||||
<InspectorControls>
|
||||
|
|
@ -206,10 +213,7 @@ function Edit({
|
|||
className="homegrade-blocks-focused-thematique__figcaption-toggle"
|
||||
aria-expanded="false"
|
||||
>
|
||||
{__(
|
||||
"Version texte des indications de l'illustration",
|
||||
"homegrade-blocks"
|
||||
)}
|
||||
{localVersionTextDescription}
|
||||
{/* <ChevronDown /> */}
|
||||
<img src={chevronDown} alt="" />
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
import {
|
||||
useBlockProps,
|
||||
MediaPlaceholder,
|
||||
RichText,
|
||||
BlockControls,
|
||||
MediaReplaceFlow,
|
||||
} from "@wordpress/block-editor";
|
||||
import { useBlockProps } from "@wordpress/block-editor";
|
||||
import { __ } from "@wordpress/i18n";
|
||||
|
||||
import chevronDown from "./img/chevron_down.svg";
|
||||
import { Camera } from "lucide-react";
|
||||
|
||||
import { InnerBlocks } from "@wordpress/block-editor";
|
||||
import getAdminLanguageFromCookies from "../../../utils/getAdminLanguageFromCookies.js";
|
||||
|
||||
export default function save({ attributes }) {
|
||||
const { coverUrl, coverId, coverAlt, focusBullets } = attributes;
|
||||
|
|
@ -32,6 +26,11 @@ export default function save({ attributes }) {
|
|||
</div>
|
||||
);
|
||||
});
|
||||
const currentLang = getAdminLanguageFromCookies("wp-wpml_current_language");
|
||||
const localVersionTextDescription =
|
||||
currentLang === "nl"
|
||||
? "Tekstversie van de illustratie"
|
||||
: "Version texte des indications de l'illustration";
|
||||
return (
|
||||
<section
|
||||
{...useBlockProps.save({
|
||||
|
|
@ -52,10 +51,7 @@ export default function save({ attributes }) {
|
|||
className="homegrade-blocks-focused-thematique__figcaption-toggle"
|
||||
aria-expanded="false"
|
||||
>
|
||||
{__(
|
||||
"Version texte des indications de l'illustration",
|
||||
"homegrade-blocks__texte-fonctionnel"
|
||||
)}
|
||||
{localVersionTextDescription}
|
||||
{/* <ChevronDown /> */}
|
||||
<img src={chevronDown} alt="" />
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user