소스 검색

implements internationalization for forms

Olivier Massot 4 년 전
부모
커밋
94dc3d791c

+ 12 - 0
ot_templating/Configuration/Form/CustomFormSetup.yaml

@@ -7,3 +7,15 @@ TYPO3:
         allowDeleteFromExtensionPaths: false
         allowedExtensionPaths:
           20: EXT:ot_templating/Resources/Private/Forms/
+      prototypes:
+        standard:
+          formElementsDefinition:
+            Form:
+              renderingOptions:
+                translation:
+                  # <!!!> 'translationFile' becomes 'translationFiles' in typo10+
+                  translationFile:
+                    # Default translation file of EXT:form (always needed, but can be remove in typo10+)
+                    10: 'EXT:form/Resources/Private/Language/locallang.xlf'
+                    # Load custom translation file(s)
+                    20: 'EXT:ot_templating/Resources/Private/Language/Form/locallang.xlf'

+ 26 - 26
ot_templating/Resources/Private/Forms/Contact.form.yaml

@@ -12,10 +12,10 @@ finishers:
   -
     identifier: EmailToReceiver
     options:
-      subject: 'Demande d''information'
+      subject: 'Informations request'
       recipientAddress:
       recipientName: ''
-      senderAddress: ne_pas_repondre@opentalent.fr
+      senderAddress: ne-pas-repondre@opentalent.fr
       senderName: ''
       replyToAddress: ''
       carbonCopyAddress: ''
@@ -27,9 +27,9 @@ finishers:
   -
     identifier: EmailToSender
     options:
-      subject: 'Votre demande de contact a bien été prise en compte.'
-      recipientAddress: '{mail}'
-      recipientName: '{first-name} {last-name}'
+      subject: 'Your message has been posted'
+      recipientAddress: '{email}'
+      recipientName: '{firstname} {lastname}'
       senderAddress: ne_pas_repondre@opentalent.fr
       senderName: ''
       replyToAddress: ''
@@ -41,25 +41,25 @@ finishers:
   -
     identifier: Confirmation
     options:
-      message: 'Votre message a bien été envoyé'
+      message: 'Your message has been posted'
       contentElementUid: ''
 
 renderables:
   -
-    identifier: page-1
-    label: 'Écrivez-nous:'
+    identifier: page
+    label: 'Mail Us'
     type: Page
 
     renderingOptions:
-      previousButtonLabel: 'Précédent'
-      nextButtonLabel: 'Suivant'
+      previousButtonLabel: 'LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:form.previous'
+      nextButtonLabel: 'LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:form.next'
 
     renderables:
       -
         type: StaticText
-        identifier: notice
+        identifier: mandatory-fields-notice
         properties:
-          text: 'Note: Les champs marqués d''une astérisque (*) sont obligatoires'
+          text: 'Note: Fields marked with a star (*) are mandatory'
           elementClassAttribute: 'contact-form-info'
         label: ''
       -
@@ -68,8 +68,8 @@ renderables:
         label: ''
         renderables:
           -
-            identifier: last-name
-            label: 'Nom'
+            identifier: lastname
+            label: 'Name'
             type: Text
             defaultValue: ''
             properties:
@@ -79,8 +79,8 @@ renderables:
               - identifier: NotEmpty
 
           -
-            identifier: first-name
-            label: 'Prénom'
+            identifier: firstname
+            label: 'First name'
             type: Text
             defaultValue: ''
             properties:
@@ -91,8 +91,8 @@ renderables:
                 identifier: NotEmpty
 
       -
-        identifier: mail
-        label: 'Adresse email'
+        identifier: email
+        label: 'Email address'
         type: Text
         defaultValue: ''
         properties:
@@ -111,8 +111,8 @@ renderables:
         renderables:
 
           -
-            identifier: postal-code
-            label: 'Code postal'
+            identifier: zipcode
+            label: 'Zip code'
             type: Text
             defaultValue: ''
             validators:
@@ -121,18 +121,18 @@ renderables:
 
           -
             identifier: city
-            label: 'Ville'
+            label: 'City'
             type: Text
             defaultValue: ''
 
           -
             identifier: phone
-            label: 'Téléphone'
+            label: 'Phone'
             type: Text
             defaultValue: ''
       -
         identifier: subject
-        label: 'Objet'
+        label: 'Subject'
         type: Text
         defaultValue: ''
         properties:
@@ -148,15 +148,15 @@ renderables:
         defaultValue: ''
         properties:
           fluidAdditionalAttributes:
-            placeholder: 'Votre message ici...'
+            placeholder: 'Your message here...'
             required: required
         validators:
           -
             identifier: NotEmpty
       -
         type: StaticText
-        identifier: rgpd
+        identifier: rgpd-notice
         properties:
-          text: 'En soumettant ce formulaire, j’accepte que les informations saisies soient utilisées pour permettre de me recontacter et de répondre à ma demande.'
+          text: 'By submitting this form, you agree that theses informations can be processed in order to contact you back and answer your demand'
           elementClassAttribute: 'contact-form-info'
         label: ''

+ 59 - 0
ot_templating/Resources/Private/Language/Form/locallang.xlf

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<xliff version="1.0">
+	<file source-language="fr" datatype="plaintext" original="messages" date="2020-04-03T15:44:11Z" product-name="ot_templating">
+		<header/>
+		<body>
+			<trans-unit id="ContactForm.element.page.properties.label">
+				<source>Écrivez-nous:</source>
+			</trans-unit>
+			<trans-unit id="element.mandatory-fields-notice.properties.text">
+				<source>Note: Les champs marqués d'une astérisque (*) sont obligatoires</source>
+			</trans-unit>
+			<trans-unit id="element.lastname.properties.label">
+				<source>Nom</source>
+			</trans-unit>
+			<trans-unit id="element.firstname.properties.label">
+				<source>Prénom</source>
+			</trans-unit>
+			<trans-unit id="element.firstname.properties.label">
+				<source>Prénom</source>
+			</trans-unit>
+			<trans-unit id="element.email.properties.label">
+				<source>Adresse Email</source>
+			</trans-unit>
+			<trans-unit id="element.zipcode.properties.label">
+				<source>Code Postal</source>
+			</trans-unit>
+			<trans-unit id="element.city.properties.label">
+				<source>Commune</source>
+			</trans-unit>
+			<trans-unit id="element.phone.properties.label">
+				<source>Téléphone</source>
+			</trans-unit>
+			<trans-unit id="element.subject.properties.label">
+				<source>Objet</source>
+			</trans-unit>
+			<trans-unit id="element.message.properties.label">
+				<source>Message</source>
+			</trans-unit>
+			<trans-unit id="element.message.properties.placeholder">
+				<source>Votre message...</source>
+			</trans-unit>
+			<trans-unit id="ContactForm.element.rgpd-notice.properties.text">
+				<source>En soumettant ce formulaire, j’accepte que les informations saisies
+					soient utilisées pour permettre de me recontacter et de répondre à ma demande.</source>
+			</trans-unit>
+
+			<trans-unit id="ContactForm.finisher.EmailToReceiver.subject">
+				<source>Demande d'information</source>
+			</trans-unit>
+			<trans-unit id="ContactForm.finisher.EmailToSender.subject">
+				<source>Votre demande de contact a bien été prise en compte.</source>
+			</trans-unit>
+			<trans-unit id="ContactForm.finisher.Confirmation.message">
+				<source>Votre message a bien été envoyé.</source>
+			</trans-unit>
+
+		</body>
+	</file>
+</xliff>

+ 27 - 0
ot_templating/Resources/Private/Language/locallang.xlf

@@ -347,6 +347,33 @@
 				<source>Page introuvable</source>
 			</trans-unit>
 
+			<!-- Email template -->
+			<trans-unit id="hello">
+				<source>Bonjour,</source>
+			</trans-unit>
+			<trans-unit id="your-contact-demand-has-been-sent">
+				<source>Votre demande de contact a bien été prise en compte.</source>
+			</trans-unit>
+			<trans-unit id="your-contact-demand-has-been-sent">
+				<source>Votre demande de contact a bien été prise en compte.</source>
+			</trans-unit>
+			<trans-unit id="here-is-a-summary-of-your-demand">
+				<source>Vous pouvez trouver ci-dessous un récapitulatif de cette demande :</source>
+			</trans-unit>
+			<trans-unit id="we-ll-contact-you-back-as-soon-as-possible">
+				<source>Nous vous recontacterons dans les plus brefs délais afin de vous apporter une réponse.</source>
+			</trans-unit>
+			<trans-unit id="regards">
+				<source>Bien cordialement,</source>
+			</trans-unit>
+			<trans-unit id="direction">
+				<source>La direction</source>
+			</trans-unit>
+			<trans-unit id="this-is-an-automatic-email-do-not-answser">
+				<source>Cet e-mail a été envoyé automatiquement, merci de ne pas y répondre.</source>
+			</trans-unit>
+
+			<!-- API Values -->
 			<trans-unit id="PRESIDENT" xml:space="preserve">
 			    <source>Président.e</source>
 			</trans-unit>

+ 9 - 7
ot_templating/Resources/Private/Templates/Forms/EmailToSender.html

@@ -36,10 +36,12 @@
 </head>
 <body>
 
-    <p>Bonjour,</p>
+    <p><f:translate key="hello"/></p>
 
-    <p>Votre demande de contact a bien été prise en compte.
-       Vous pouvez trouver ci-dessous un récapitulatif de cette demande :</p>
+    <p>
+        <f:translate key="your-contact-demand-has-been-sent"/>
+        <f:translate key="here-is-a-summary-of-your-demand"/>
+    </p>
 
     <table id="recap">
         <formvh:renderAllFormValues renderable="{form.formDefinition}" as="formValue">
@@ -76,13 +78,13 @@
         </formvh:renderAllFormValues>
     </table>
 
-    <p>Nous vous recontacterons dans les plus brefs délais afin de vous apporter une réponse.</p>
+    <p><f:translate key="we-ll-contact-you-back-as-soon-as-possible"/></p>
 
-    <p>Bien cordialement.</p>
-    <p>La direction</p>
+    <p><f:translate key="regards"/></p>
+    <p><f:translate key="direction"/></p>
 
     <hr/>
-    <p><i>Cet e-mail a été envoyé automatiquement, merci de ne pas y répondre.</i></p>
+    <p><i><f:translate key="this-is-an-automatic-email-do-not-answser"/></i></p>
 
 </body>
 </html>