| @@ -89,8 +89,17 @@ | ||
| 89 | 89 | 'srfm_valid_url' => __( 'Enter a valid URL.', 'sureforms' ), |
| 90 | 90 | 'srfm_confirm_email_same' => __( 'Confirmation email does not match.', 'sureforms' ), |
| 91 | 91 | 'srfm_valid_email' => __( 'Enter a valid email address.', 'sureforms' ), |
| 92 | 92 | |
| 93 | + /* translators: %s represents the minimum number of characters required */ | |
| 94 | + 'srfm_textarea_min_chars' => __( 'Please enter at least %s characters.', 'sureforms' ), | |
| 95 | + | |
| 96 | + /* translators: %s: maximum characters allowed before the @ symbol. */ | |
| 97 | + 'srfm_email_local_max_length' => __( 'The part before @ may not exceed %s characters.', 'sureforms' ), | |
| 98 | + | |
| 99 | + /* translators: %s: maximum characters allowed after the @ symbol. */ | |
| 100 | + 'srfm_email_domain_max_length' => __( 'The part after @ may not exceed %s characters.', 'sureforms' ), | |
| 101 | + | |
| 93 | 102 | /* translators: %s represents the minimum acceptable value */ |
| 94 | 103 | 'srfm_input_min_value' => __( 'Minimum value is %s.', 'sureforms' ), |
| 95 | 104 | |
| 96 | 105 | /* translators: %s represents the maximum acceptable value */ |
| @@ -106,8 +115,38 @@ | ||
| 106 | 115 | 'srfm_multi_choice_min_selections' => __( 'Select at least %s options.', 'sureforms' ), |
| 107 | 116 | |
| 108 | 117 | /* translators: %s represents the maximum number of options that can be selected */ |
| 109 | 118 | 'srfm_multi_choice_max_selections' => __( 'You can select up to %s options.', 'sureforms' ), |
| 119 | + ]; | |
| 120 | + } | |
| 121 | + | |
| 122 | + /** | |
| 123 | + * Source (untranslated) versions of every dynamic validation message. | |
| 124 | + * | |
| 125 | + * Used by the multilingual integration to register a stable English key with | |
| 126 | + * the active provider (e.g., WPML String Translation) regardless of the | |
| 127 | + * site's current WP locale. The keys match {@see dynamic_messages()}; the | |
| 128 | + * values are the raw English source strings without any `__()` wrapping, | |
| 129 | + * so they don't shift when the site locale changes. | |
| 130 | + * | |
| 131 | + * @since 2.11.0 | |
| 132 | + * @return array<string, string> | |
| 133 | + */ | |
| 134 | + public static function dynamic_messages_source() { | |
| 135 | + return [ | |
| 136 | + 'srfm_valid_phone_number' => 'Enter a valid phone number.', | |
| 137 | + 'srfm_valid_url' => 'Enter a valid URL.', | |
| 138 | + 'srfm_confirm_email_same' => 'Confirmation email does not match.', | |
| 139 | + 'srfm_valid_email' => 'Enter a valid email address.', | |
| 140 | + 'srfm_textarea_min_chars' => 'Please enter at least %s characters.', | |
| 141 | + 'srfm_email_local_max_length' => 'The part before @ may not exceed %s characters.', | |
| 142 | + 'srfm_email_domain_max_length' => 'The part after @ may not exceed %s characters.', | |
| 143 | + 'srfm_input_min_value' => 'Minimum value is %s.', | |
| 144 | + 'srfm_input_max_value' => 'Maximum value is %s.', | |
| 145 | + 'srfm_dropdown_min_selections' => 'Select at least %s options.', | |
| 146 | + 'srfm_dropdown_max_selections' => 'You can select up to %s options.', | |
| 147 | + 'srfm_multi_choice_min_selections' => 'Select at least %s options.', | |
| 148 | + 'srfm_multi_choice_max_selections' => 'You can select up to %s options.', | |
| 110 | 149 | ]; |
| 111 | 150 | } |
| 112 | 151 | |
| 113 | 152 | /** |