Updated templates for translations
authorThierry Florac <tflorac@ulthar.net>
Mon, 23 Sep 2019 10:21:53 +0200
changeset 188 a85a46a42e72
parent 187 cc168a57df8d
child 189 8decb05718fe
Updated templates for translations
src/pyams_form/widget/templates/checkbox-display.pt
src/pyams_form/widget/templates/checkbox-input.pt
src/pyams_form/widget/templates/radio-display.pt
src/pyams_form/widget/templates/radio-input.pt
--- a/src/pyams_form/widget/templates/checkbox-display.pt	Tue Sep 17 11:58:12 2019 +0200
+++ b/src/pyams_form/widget/templates/checkbox-display.pt	Mon Sep 23 10:21:53 2019 +0200
@@ -1,9 +1,7 @@
-<i18n:var i18n:domain="pyams_form"
-		  tal:define="translate python:request.localizer.translate">
+<div>
 	<input name="field-empty-marker" type="hidden" value="1"
 			tal:attributes="name string:${view/name}-empty-marker" />
-	<tal:loop define="items view/items"
-			  repeat="item items">
+	<tal:loop repeat="item view/items">
 		<label class="checkbox">
 			<input type="checkbox" disabled
 				tal:attributes="id item/id;
@@ -32,7 +30,7 @@
 								accesskey view/accesskey;
 								onselect view/onselect;
 								data-ams-data tales:object_data(view);" />
-			<i></i><span tal:replace="python:translate(item['label'])">Label</span>
+			<i></i><span tal:replace="python:request.localizer.translate(item['label'])">Label</span>
 		</label>
 	</tal:loop>
-</i18n:var>
\ No newline at end of file
+</div>
\ No newline at end of file
--- a/src/pyams_form/widget/templates/checkbox-input.pt	Tue Sep 17 11:58:12 2019 +0200
+++ b/src/pyams_form/widget/templates/checkbox-input.pt	Mon Sep 23 10:21:53 2019 +0200
@@ -1,9 +1,7 @@
-<i18n:var i18n:domain="pyams_form"
-		  tal:define="translate python:request.localizer.translate">
+<div>
 	<input name="field-empty-marker" type="hidden" value="1"
 			tal:attributes="name string:${view/name}-empty-marker" />
-	<tal:loop define="items view/items"
-			  repeat="item items">
+	<tal:loop repeat="item view/items">
 		<label class="checkbox">
 			<input type="checkbox"
 				tal:attributes="id item/id;
@@ -32,7 +30,7 @@
 								accesskey view/accesskey;
 								onselect view/onselect;
 								data-ams-data tales:object_data(view);" />
-			<i></i><span tal:replace="python:translate(item['label'])">Label</span>
+			<i></i><span tal:replace="python:request.localizer.translate(item['label'])">Label</span>
 		</label>
 	</tal:loop>
-</i18n:var>
\ No newline at end of file
+</div>
\ No newline at end of file
--- a/src/pyams_form/widget/templates/radio-display.pt	Tue Sep 17 11:58:12 2019 +0200
+++ b/src/pyams_form/widget/templates/radio-display.pt	Mon Sep 23 10:21:53 2019 +0200
@@ -1,5 +1,4 @@
-<div class="inline-group" i18n:domain="pyams_form"
-	 tal:define="translate python:request.localizer.translate">
+<div class="inline-group">
 	<label class="radio"
 		   tal:repeat="item view/items">
 		<input type="radio" disabled
@@ -29,6 +28,6 @@
 								accesskey view/accesskey;
 								onselect view/onselect;
 								checked python:'checked' if item['checked'] else None;" />
-		<i></i><span tal:replace="item/label" i18n:translate="">Label</span>
+		<i></i><span tal:replace="python:request.localizer.translate(item['label'])">Label</span>
 	</label>
 </div>
\ No newline at end of file
--- a/src/pyams_form/widget/templates/radio-input.pt	Tue Sep 17 11:58:12 2019 +0200
+++ b/src/pyams_form/widget/templates/radio-input.pt	Mon Sep 23 10:21:53 2019 +0200
@@ -1,9 +1,7 @@
-<div class="inline-group" i18n:domain="pyams_form"
-	 tal:define="translate python:request.localizer.translate">
+<div class="inline-group">
 	<label class="radio"
 		   tal:repeat="item view/items">
 		<input type="radio"
-			   tal:define="checked item/checked"
 			   tal:attributes="id item/id;
 								name item/name;
 								class view/klass;
@@ -30,8 +28,8 @@
 								alt view/alt;
 								accesskey view/accesskey;
 								onselect view/onselect;
-								checked python: checked and 'checked' or None;
+								checked python:'checked' if item['checked'] else None;
 								data-ams-data tales:object_data(view);" />
-		<i></i><span tal:replace="item/label" i18n:translate="">Label</span>
+		<i></i><span tal:replace="python:request.localizer.translate(item['label'])">Label</span>
 	</label>
 </div>
\ No newline at end of file