feat(Translation): enhance product dialogs and update translation model

- Added new translation files for product dialogs to support additional languages.
- Refactored various components to utilize translation functions for error messages, labels, and placeholders, enhancing localization support.
This commit is contained in:
sebseb7
2025-11-22 09:43:51 +01:00
parent d63c385a97
commit 3389a9b66c
72 changed files with 1625 additions and 196 deletions

View File

@@ -98,7 +98,7 @@ class ArticleQuestionForm extends Component {
} else {
this.setState({
loading: false,
error: response.error || 'Ein Fehler ist aufgetreten'
error: response.error || this.props.t("productDialogs.errorGeneric")
});
}
@@ -110,7 +110,7 @@ class ArticleQuestionForm extends Component {
} catch {
this.setState({
loading: false,
error: 'Fehler beim Verarbeiten der Fotos'
error: this.props.t("productDialogs.errorPhotos")
});
}
@@ -140,20 +140,21 @@ class ArticleQuestionForm extends Component {
render() {
const { name, email, question, loading, success, error } = this.state;
const { t } = this.props;
return (
<Paper sx={{ p: 3, mt: 4, borderRadius: 2, boxShadow: "0 2px 8px rgba(0,0,0,0.08)" }}>
<Typography variant="h5" gutterBottom sx={{ fontWeight: 600, color: '#333' }}>
Frage zum Artikel
{t("productDialogs.questionTitle")}
</Typography>
<Typography variant="body2" color="text.secondary" sx={{ mb: 3 }}>
Haben Sie eine Frage zu diesem Artikel? Wir helfen Ihnen gerne weiter.
{t("productDialogs.questionSubtitle")}
</Typography>
{success && (
<Alert severity="success" sx={{ mb: 3 }}>
Vielen Dank für Ihre Frage! Wir werden uns schnellstmöglich bei Ihnen melden.
{t("productDialogs.questionSuccess")}
</Alert>
)}
@@ -165,28 +166,28 @@ class ArticleQuestionForm extends Component {
<Box component="form" onSubmit={this.handleSubmit} sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<TextField
label="Name"
label={t("productDialogs.nameLabel")}
value={name}
onChange={this.handleInputChange('name')}
required
fullWidth
disabled={loading}
placeholder="Ihr Name"
placeholder={t("productDialogs.namePlaceholder")}
/>
<TextField
label="E-Mail"
label={t("productDialogs.emailLabel")}
type="email"
value={email}
onChange={this.handleInputChange('email')}
required
fullWidth
disabled={loading}
placeholder="ihre.email@example.com"
placeholder={t("productDialogs.emailPlaceholder")}
/>
<TextField
label="Ihre Frage"
label={t("productDialogs.questionLabel")}
value={question}
onChange={this.handleInputChange('question')}
required
@@ -194,7 +195,7 @@ class ArticleQuestionForm extends Component {
multiline
rows={4}
disabled={loading}
placeholder="Beschreiben Sie Ihre Frage zu diesem Artikel..."
placeholder={t("productDialogs.questionPlaceholder")}
/>
<PhotoUpload
@@ -202,7 +203,7 @@ class ArticleQuestionForm extends Component {
onChange={this.handlePhotosChange}
disabled={loading}
maxFiles={3}
label="Fotos zur Frage anhängen (optional)"
label={t("productDialogs.photosLabelQuestion")}
/>
<Button
@@ -219,10 +220,10 @@ class ArticleQuestionForm extends Component {
{loading ? (
<>
<CircularProgress size={20} sx={{ mr: 1 }} />
Wird gesendet...
{t("productDialogs.sending")}
</>
) : (
'Frage senden'
t("productDialogs.submitQuestion")
)}
</Button>
</Box>