feat(09-02): wrap form-facing strings and localize JS validation
- Wrap all room names and 90+ furniture item names in __() - Wrap all additional work section labels and field names in __() - Wrap all form renderer UI strings (headers, labels, buttons) in gettext - Pass translated address field labels to render methods - Wrap validation error messages in class-form-handler - Force German locale for email generation via switch_to_locale() - Restore locale after email with restore_previous_locale() - Add wp_localize_script() for JS validation messages - Update form.js to use umzugslisteL10n for translated strings - Email generator remains untouched (hardcoded German as required) - Email subject stays hardcoded German (not wrapped in gettext) - All PHP files pass syntax check - 163 gettext calls in furniture-data, 26 in form-renderer
This commit is contained in:
@@ -9,6 +9,14 @@
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
// Localized strings with fallbacks
|
||||
var l10n = typeof umzugslisteL10n !== 'undefined' ? umzugslisteL10n : {
|
||||
fieldRequired: 'This field is required',
|
||||
invalidEmail: 'Please enter a valid email address',
|
||||
selectMovingDate: 'Please select a complete moving date',
|
||||
enterFurnitureItem: 'Please enter at least one furniture item'
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse German decimal format to float
|
||||
* Converts "0,40" or "0.40" to 0.40
|
||||
@@ -224,14 +232,14 @@
|
||||
|
||||
// Check required fields
|
||||
if (isRequired && !validateRequired(value)) {
|
||||
showFieldError($field, 'Dieses Feld ist erforderlich');
|
||||
showFieldError($field, l10n.fieldRequired);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check email format
|
||||
if (fieldName === 'info[eE-Mail]' && value) {
|
||||
if (!validateEmail(value)) {
|
||||
showFieldError($field, 'Bitte geben Sie eine gültige E-Mail-Adresse ein');
|
||||
showFieldError($field, l10n.invalidEmail);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -282,7 +290,7 @@
|
||||
|
||||
// Validate date
|
||||
if (!validateDate()) {
|
||||
errors.push('Bitte wählen Sie ein vollständiges Umzugsdatum');
|
||||
errors.push(l10n.selectMovingDate);
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
@@ -295,7 +303,7 @@
|
||||
|
||||
// Validate furniture items
|
||||
if (!validateFurnitureItems()) {
|
||||
errors.push('Bitte geben Sie mindestens ein Möbelstück ein');
|
||||
errors.push(l10n.enterFurnitureItem);
|
||||
isValid = false;
|
||||
|
||||
// Scroll to first room table
|
||||
|
||||
Reference in New Issue
Block a user