*/ public static function translated(): array { return [ __('Close', 'wconvert'), /* translators: A popup's accessible name, used when its design has no heading. */ _x('Campaign', 'accessible name of a popup with no heading', 'wconvert'), /* translators: The accessible name of a countdown timer. */ __('Time remaining', 'wconvert'), _x('Days', 'countdown unit', 'wconvert'), _x('Hours', 'countdown unit', 'wconvert'), /* translators: Minutes, abbreviated to fit under a countdown digit. */ _x('Mins', 'countdown unit, abbreviated', 'wconvert'), /* translators: Seconds, abbreviated to fit under a countdown digit. */ _x('Secs', 'countdown unit, abbreviated', 'wconvert'), __('Email address', 'wconvert'), __('Phone number', 'wconvert'), _x('Name', 'a form field asking for a person\'s name', 'wconvert'), __('Interested in', 'wconvert'), __('Choose an option', 'wconvert'), __('Copy code', 'wconvert'), /* translators: Confirms a discount code was copied to the clipboard. */ _x('Copied', 'a code was copied', 'wconvert'), __('Copy failed. Select the code.', 'wconvert'), __('Apply code', 'wconvert'), __('Submission not confirmed. Please try again.', 'wconvert'), /* translators: The button that moves a visitor on to the next screen of a quiz or form. */ _x('Continue', 'go to the next screen', 'wconvert'), __('Contact details are required before you see your result.', 'wconvert'), __('Already saved. You can review these details, but cannot change them.', 'wconvert'), __('Review your answers', 'wconvert'), /* translators: The accessible name of the button that hides a reopen reminder. */ __('Dismiss reminder', 'wconvert'), __('Submission received — View details', 'wconvert'), __('Content unlocked.', 'wconvert'), __('Continue to content', 'wconvert'), __('Your submission could not be confirmed. The content is available below.', 'wconvert'), ]; } /** * The words that differ from English, by position — free's, and Pro's * from position 100 through `wconvert_page_labels`. * * Only the differing ones, so an untranslated site prints nothing at all * and a translated one prints only what changes. * * @return array */ public static function differing(): array { $labels = []; foreach (self::translated() as $index => $label) { if ($label !== self::ENGLISH[$index]) { $labels[$index] = $label; } } /** * Filters the visitor-facing words the loader reads off the page. * * Pro adds its loader's words at positions from 100, and only where * they differ from English. * * @param array $labels Position => translated word. */ $filtered = apply_filters('wconvert_page_labels', $labels); return is_array($filtered) ? array_filter($filtered, 'is_string') : $labels; } /** The `data-labels` value, or null where every word is English. */ public static function attribute(): ?string { $labels = self::differing(); if ($labels === []) { return null; } $json = wp_json_encode($labels, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE); return $json === false ? null : $json; } }