[web/views] Stop mishandling the fieldset name in the default form renderer
authorRémi Cardona <remi.cardona@logilab.fr>
Fri, 30 Jan 2015 15:53:32 +0100
changeset 10163 4001cfe2f44d
parent 10162 1f68574c3d0b
child 10164 2094262d6553
[web/views] Stop mishandling the fieldset name in the default form renderer While not really documented, it is generally assumed that: * the fieldset is a user-visible string (much like a title), * it will be translated by whichever piece of code uses it. So: * fix AutomaticEntityForm to generate untranslated fieldset names, * fix FormRenderer to properly translate the fieldset name before rendering it, * stop using the field set (which may contain whitespace) as a CSS class name (the feature was unusable, so just drop it), * properly handle the colon as part of the translated fieldset name Closes #4881298
devtools/devctl.py
devtools/test/data/cubes/i18ntestcube/i18n/en.po.ref
i18n/de.po
i18n/en.po
i18n/es.po
i18n/fr.po
web/views/autoform.py
web/views/formrenderers.py
--- a/devtools/devctl.py	Thu Jan 22 18:08:05 2015 +0100
+++ b/devtools/devctl.py	Fri Jan 30 15:53:32 2015 +0100
@@ -165,7 +165,7 @@
             add_msg(w, etype)
             add_msg(w, '%s_plural' % etype)
             if not eschema.final:
-                add_msg(w, 'This %s' % etype)
+                add_msg(w, 'This %s:' % etype)
                 add_msg(w, 'New %s' % etype)
             if eschema.description and not eschema.description in done:
                 done.add(eschema.description)
--- a/devtools/test/data/cubes/i18ntestcube/i18n/en.po.ref	Thu Jan 22 18:08:05 2015 +0100
+++ b/devtools/test/data/cubes/i18ntestcube/i18n/en.po.ref	Fri Jan 30 15:53:32 2015 +0100
@@ -21,7 +21,7 @@
 msgid "Forum_plural"
 msgstr ""
 
-msgid "This Forum"
+msgid "This Forum:"
 msgstr ""
 
 msgid "New Forum"
@@ -47,7 +47,7 @@
 msgid "ForumThread_plural"
 msgstr ""
 
-msgid "This ForumThread"
+msgid "This ForumThread:"
 msgstr ""
 
 msgid "New ForumThread"
--- a/i18n/de.po	Thu Jan 22 18:08:05 2015 +0100
+++ b/i18n/de.po	Fri Jan 30 15:53:32 2015 +0100
@@ -780,86 +780,86 @@
 msgid "There is no default workflow"
 msgstr "Dieser Entitätstyp hat standardmäßig keinen Workflow."
 
-msgid "This BaseTransition"
-msgstr "Diese abstracte Transition"
-
-msgid "This Bookmark"
-msgstr "Dieses Lesezeichen"
-
-msgid "This CWAttribute"
-msgstr "diese finale Relationsdefinition"
-
-msgid "This CWCache"
-msgstr "Dieser Anwendungs-Cache"
-
-msgid "This CWComputedRType"
-msgstr ""
-
-msgid "This CWConstraint"
-msgstr "diese Einschränkung"
-
-msgid "This CWConstraintType"
-msgstr "Dieser Einschränkungstyp"
-
-msgid "This CWDataImport"
-msgstr ""
-
-msgid "This CWEType"
-msgstr "Dieser Entitätstyp"
-
-msgid "This CWGroup"
-msgstr "Diese Gruppe"
-
-msgid "This CWProperty"
-msgstr "Diese Eigenschaft"
-
-msgid "This CWRType"
-msgstr "Dieser Relationstyp"
-
-msgid "This CWRelation"
-msgstr "Diese Relation"
-
-msgid "This CWSource"
-msgstr ""
-
-msgid "This CWSourceHostConfig"
-msgstr ""
-
-msgid "This CWSourceSchemaConfig"
-msgstr ""
-
-msgid "This CWUniqueTogetherConstraint"
-msgstr "Diese unique-together-Einschränkung"
-
-msgid "This CWUser"
-msgstr "Dieser Nutzer"
-
-msgid "This EmailAddress"
-msgstr "Diese E-Mail-Adresse"
-
-msgid "This ExternalUri"
-msgstr "dieser externe URI"
-
-msgid "This RQLExpression"
-msgstr "Dieser RQL-Ausdruck"
-
-msgid "This State"
-msgstr "Dieser Zustand"
-
-msgid "This SubWorkflowExitPoint"
-msgstr "Dieser Subworkflow Endpunkt"
-
-msgid "This TrInfo"
-msgstr "Diese Übergangs-Information"
-
-msgid "This Transition"
-msgstr "Dieser Übergang"
-
-msgid "This Workflow"
-msgstr "Dieser Workflow"
-
-msgid "This WorkflowTransition"
-msgstr "Dieser Workflow-Übergang"
+msgid "This BaseTransition:"
+msgstr "Diese abstracte Transition:"
+
+msgid "This Bookmark:"
+msgstr "Dieses Lesezeichen:"
+
+msgid "This CWAttribute:"
+msgstr "diese finale Relationsdefinition:"
+
+msgid "This CWCache:"
+msgstr "Dieser Anwendungs-Cache:"
+
+msgid "This CWComputedRType:"
+msgstr ""
+
+msgid "This CWConstraint:"
+msgstr "diese Einschränkung:"
+
+msgid "This CWConstraintType:"
+msgstr "Dieser Einschränkungstyp:"
+
+msgid "This CWDataImport:"
+msgstr ""
+
+msgid "This CWEType:"
+msgstr "Dieser Entitätstyp:"
+
+msgid "This CWGroup:"
+msgstr "Diese Gruppe:"
+
+msgid "This CWProperty:"
+msgstr "Diese Eigenschaft:"
+
+msgid "This CWRType:"
+msgstr "Dieser Relationstyp:"
+
+msgid "This CWRelation:"
+msgstr "Diese Relation:"
+
+msgid "This CWSource:"
+msgstr ""
+
+msgid "This CWSourceHostConfig:"
+msgstr ""
+
+msgid "This CWSourceSchemaConfig:"
+msgstr ""
+
+msgid "This CWUniqueTogetherConstraint:"
+msgstr "Diese unique-together-Einschränkung:"
+
+msgid "This CWUser:"
+msgstr "Dieser Nutzer:"
+
+msgid "This EmailAddress:"
+msgstr "Diese E-Mail-Adresse:"
+
+msgid "This ExternalUri:"
+msgstr "dieser externe URI:"
+
+msgid "This RQLExpression:"
+msgstr "Dieser RQL-Ausdruck:"
+
+msgid "This State:"
+msgstr "Dieser Zustand:"
+
+msgid "This SubWorkflowExitPoint:"
+msgstr "Dieser Subworkflow Endpunkt:"
+
+msgid "This TrInfo:"
+msgstr "Diese Übergangs-Information:"
+
+msgid "This Transition:"
+msgstr "Dieser Übergang:"
+
+msgid "This Workflow:"
+msgstr "Dieser Workflow:"
+
+msgid "This WorkflowTransition:"
+msgstr "Dieser Workflow-Übergang:"
 
 msgid ""
 "This action is forbidden. If you think it should be allowed, please contact "
--- a/i18n/en.po	Thu Jan 22 18:08:05 2015 +0100
+++ b/i18n/en.po	Fri Jan 30 15:53:32 2015 +0100
@@ -756,86 +756,86 @@
 msgid "There is no default workflow"
 msgstr ""
 
-msgid "This BaseTransition"
-msgstr "This abstract transition"
-
-msgid "This Bookmark"
-msgstr "This bookmark"
-
-msgid "This CWAttribute"
-msgstr "This attribute"
-
-msgid "This CWCache"
-msgstr "This cache"
-
-msgid "This CWComputedRType"
-msgstr "This virtual relation"
-
-msgid "This CWConstraint"
-msgstr "This constraint"
-
-msgid "This CWConstraintType"
-msgstr "This constraint type"
-
-msgid "This CWDataImport"
-msgstr "This data import"
-
-msgid "This CWEType"
-msgstr "This entity type"
-
-msgid "This CWGroup"
-msgstr "This group"
-
-msgid "This CWProperty"
-msgstr "This property"
-
-msgid "This CWRType"
-msgstr "This relation type"
-
-msgid "This CWRelation"
-msgstr "This relation"
-
-msgid "This CWSource"
-msgstr "This data source"
-
-msgid "This CWSourceHostConfig"
-msgstr "This source host configuration"
-
-msgid "This CWSourceSchemaConfig"
-msgstr "This source schema configuration"
-
-msgid "This CWUniqueTogetherConstraint"
-msgstr "This unicity constraint"
-
-msgid "This CWUser"
-msgstr "This user"
-
-msgid "This EmailAddress"
-msgstr "This email address"
-
-msgid "This ExternalUri"
-msgstr "This external URI"
-
-msgid "This RQLExpression"
-msgstr "This RQL expression"
-
-msgid "This State"
-msgstr "This state"
-
-msgid "This SubWorkflowExitPoint"
-msgstr "This subworkflow exit-point"
-
-msgid "This TrInfo"
-msgstr "This transition information"
-
-msgid "This Transition"
-msgstr "This transition"
-
-msgid "This Workflow"
-msgstr "This workflow"
-
-msgid "This WorkflowTransition"
-msgstr "This workflow-transition"
+msgid "This BaseTransition:"
+msgstr "This abstract transition:"
+
+msgid "This Bookmark:"
+msgstr "This bookmark:"
+
+msgid "This CWAttribute:"
+msgstr "This attribute:"
+
+msgid "This CWCache:"
+msgstr "This cache:"
+
+msgid "This CWComputedRType:"
+msgstr "This virtual relation:"
+
+msgid "This CWConstraint:"
+msgstr "This constraint:"
+
+msgid "This CWConstraintType:"
+msgstr "This constraint type:"
+
+msgid "This CWDataImport:"
+msgstr "This data import:"
+
+msgid "This CWEType:"
+msgstr "This entity type:"
+
+msgid "This CWGroup:"
+msgstr "This group:"
+
+msgid "This CWProperty:"
+msgstr "This property:"
+
+msgid "This CWRType:"
+msgstr "This relation type:"
+
+msgid "This CWRelation:"
+msgstr "This relation:"
+
+msgid "This CWSource:"
+msgstr "This data source:"
+
+msgid "This CWSourceHostConfig:"
+msgstr "This source host configuration:"
+
+msgid "This CWSourceSchemaConfig:"
+msgstr "This source schema configuration:"
+
+msgid "This CWUniqueTogetherConstraint:"
+msgstr "This unicity constraint:"
+
+msgid "This CWUser:"
+msgstr "This user:"
+
+msgid "This EmailAddress:"
+msgstr "This email address:"
+
+msgid "This ExternalUri:"
+msgstr "This external URI:"
+
+msgid "This RQLExpression:"
+msgstr "This RQL expression:"
+
+msgid "This State:"
+msgstr "This state:"
+
+msgid "This SubWorkflowExitPoint:"
+msgstr "This subworkflow exit-point:"
+
+msgid "This TrInfo:"
+msgstr "This transition information:"
+
+msgid "This Transition:"
+msgstr "This transition:"
+
+msgid "This Workflow:"
+msgstr "This workflow:"
+
+msgid "This WorkflowTransition:"
+msgstr "This workflow-transition:"
 
 msgid ""
 "This action is forbidden. If you think it should be allowed, please contact "
--- a/i18n/es.po	Thu Jan 22 18:08:05 2015 +0100
+++ b/i18n/es.po	Fri Jan 30 15:53:32 2015 +0100
@@ -790,86 +790,86 @@
 msgid "There is no default workflow"
 msgstr "Esta entidad no posee workflow por defecto"
 
-msgid "This BaseTransition"
-msgstr "Esta transición abstracta"
-
-msgid "This Bookmark"
-msgstr "Este favorito"
-
-msgid "This CWAttribute"
-msgstr "Esta definición de relación final"
-
-msgid "This CWCache"
-msgstr "Este Caché"
-
-msgid "This CWComputedRType"
+msgid "This BaseTransition:"
+msgstr "Esta transición abstracta:"
+
+msgid "This Bookmark:"
+msgstr "Este favorito:"
+
+msgid "This CWAttribute:"
+msgstr "Esta definición de relación final:"
+
+msgid "This CWCache:"
+msgstr "Este Caché:"
+
+msgid "This CWComputedRType:"
 msgstr ""
 
-msgid "This CWConstraint"
-msgstr "Esta Restricción"
-
-msgid "This CWConstraintType"
-msgstr "Este tipo de Restricción"
-
-msgid "This CWDataImport"
-msgstr "Esta importación de datos"
-
-msgid "This CWEType"
-msgstr "Este tipo de Entidad"
-
-msgid "This CWGroup"
-msgstr "Este grupo"
-
-msgid "This CWProperty"
-msgstr "Esta propiedad"
-
-msgid "This CWRType"
-msgstr "Este tipo de relación"
-
-msgid "This CWRelation"
-msgstr "Esta definición de relación no final"
-
-msgid "This CWSource"
-msgstr "Esta fuente"
-
-msgid "This CWSourceHostConfig"
-msgstr "Esta configuración de fuente"
-
-msgid "This CWSourceSchemaConfig"
-msgstr "Esta parte de mapeo de fuente"
-
-msgid "This CWUniqueTogetherConstraint"
-msgstr "Esta restricción de singularidad"
-
-msgid "This CWUser"
-msgstr "Este usuario"
-
-msgid "This EmailAddress"
-msgstr "Esta dirección electrónica"
-
-msgid "This ExternalUri"
-msgstr "Este Uri externo"
-
-msgid "This RQLExpression"
-msgstr "Esta expresión RQL"
-
-msgid "This State"
-msgstr "Este estado"
-
-msgid "This SubWorkflowExitPoint"
-msgstr "Esta Salida de sub-workflow"
-
-msgid "This TrInfo"
-msgstr "Esta información de transición"
-
-msgid "This Transition"
-msgstr "Esta transición"
-
-msgid "This Workflow"
-msgstr "Este Workflow"
-
-msgid "This WorkflowTransition"
-msgstr "Esta transición de Workflow"
+msgid "This CWConstraint:"
+msgstr "Esta Restricción:"
+
+msgid "This CWConstraintType:"
+msgstr "Este tipo de Restricción:"
+
+msgid "This CWDataImport:"
+msgstr "Esta importación de datos:"
+
+msgid "This CWEType:"
+msgstr "Este tipo de Entidad:"
+
+msgid "This CWGroup:"
+msgstr "Este grupo:"
+
+msgid "This CWProperty:"
+msgstr "Esta propiedad:"
+
+msgid "This CWRType:"
+msgstr "Este tipo de relación:"
+
+msgid "This CWRelation:"
+msgstr "Esta definición de relación no final:"
+
+msgid "This CWSource:"
+msgstr "Esta fuente:"
+
+msgid "This CWSourceHostConfig:"
+msgstr "Esta configuración de fuente:"
+
+msgid "This CWSourceSchemaConfig:"
+msgstr "Esta parte de mapeo de fuente:"
+
+msgid "This CWUniqueTogetherConstraint:"
+msgstr "Esta restricción de singularidad:"
+
+msgid "This CWUser:"
+msgstr "Este usuario:"
+
+msgid "This EmailAddress:"
+msgstr "Esta dirección electrónica:"
+
+msgid "This ExternalUri:"
+msgstr "Este Uri externo:"
+
+msgid "This RQLExpression:"
+msgstr "Esta expresión RQL:"
+
+msgid "This State:"
+msgstr "Este estado:"
+
+msgid "This SubWorkflowExitPoint:"
+msgstr "Esta Salida de sub-workflow:"
+
+msgid "This TrInfo:"
+msgstr "Esta información de transición:"
+
+msgid "This Transition:"
+msgstr "Esta transición:"
+
+msgid "This Workflow:"
+msgstr "Este Workflow:"
+
+msgid "This WorkflowTransition:"
+msgstr "Esta transición de Workflow:"
 
 msgid ""
 "This action is forbidden. If you think it should be allowed, please contact "
--- a/i18n/fr.po	Thu Jan 22 18:08:05 2015 +0100
+++ b/i18n/fr.po	Fri Jan 30 15:53:32 2015 +0100
@@ -786,86 +786,86 @@
 msgid "There is no default workflow"
 msgstr "Ce type d'entité n'a pas de workflow par défault"
 
-msgid "This BaseTransition"
-msgstr "Cette transition abstraite"
-
-msgid "This Bookmark"
-msgstr "Ce signet"
-
-msgid "This CWAttribute"
-msgstr "Cette définition de relation finale"
-
-msgid "This CWCache"
-msgstr "Ce cache applicatif"
-
-msgid "This CWComputedRType"
-msgstr "Cette relation virtuelle"
-
-msgid "This CWConstraint"
-msgstr "Cette contrainte"
-
-msgid "This CWConstraintType"
-msgstr "Ce type de contrainte"
-
-msgid "This CWDataImport"
-msgstr "Cet import de données"
-
-msgid "This CWEType"
-msgstr "Ce type d'entité"
-
-msgid "This CWGroup"
-msgstr "Ce groupe"
-
-msgid "This CWProperty"
-msgstr "Cette propriété"
-
-msgid "This CWRType"
-msgstr "Ce type de relation"
-
-msgid "This CWRelation"
-msgstr "Cette définition de relation"
-
-msgid "This CWSource"
-msgstr "Cette source"
-
-msgid "This CWSourceHostConfig"
-msgstr "Cette configuration de source"
-
-msgid "This CWSourceSchemaConfig"
-msgstr "Cette partie de mapping de source"
-
-msgid "This CWUniqueTogetherConstraint"
-msgstr "Cette contrainte unique_together"
-
-msgid "This CWUser"
-msgstr "Cet utilisateur"
-
-msgid "This EmailAddress"
-msgstr "Cette adresse électronique"
-
-msgid "This ExternalUri"
-msgstr "Cette Uri externe"
-
-msgid "This RQLExpression"
-msgstr "Cette expression RQL"
-
-msgid "This State"
-msgstr "Cet état"
-
-msgid "This SubWorkflowExitPoint"
-msgstr "Cette sortie de sous-workflow"
-
-msgid "This TrInfo"
-msgstr "Cette information de transition"
-
-msgid "This Transition"
-msgstr "Cette transition"
-
-msgid "This Workflow"
-msgstr "Ce workflow"
-
-msgid "This WorkflowTransition"
-msgstr "Cette transition workflow"
+msgid "This BaseTransition:"
+msgstr "Cette transition abstraite :"
+
+msgid "This Bookmark:"
+msgstr "Ce signet :"
+
+msgid "This CWAttribute:"
+msgstr "Cette définition de relation finale :"
+
+msgid "This CWCache:"
+msgstr "Ce cache applicatif :"
+
+msgid "This CWComputedRType:"
+msgstr "Cette relation virtuelle :"
+
+msgid "This CWConstraint:"
+msgstr "Cette contrainte :"
+
+msgid "This CWConstraintType:"
+msgstr "Ce type de contrainte :"
+
+msgid "This CWDataImport:"
+msgstr "Cet import de données :"
+
+msgid "This CWEType:"
+msgstr "Ce type d'entité :"
+
+msgid "This CWGroup:"
+msgstr "Ce groupe :"
+
+msgid "This CWProperty:"
+msgstr "Cette propriété :"
+
+msgid "This CWRType:"
+msgstr "Ce type de relation :"
+
+msgid "This CWRelation:"
+msgstr "Cette définition de relation :"
+
+msgid "This CWSource:"
+msgstr "Cette source :"
+
+msgid "This CWSourceHostConfig:"
+msgstr "Cette configuration de source :"
+
+msgid "This CWSourceSchemaConfig:"
+msgstr "Cette partie de mapping de source :"
+
+msgid "This CWUniqueTogetherConstraint:"
+msgstr "Cette contrainte unique_together :"
+
+msgid "This CWUser:"
+msgstr "Cet utilisateur :"
+
+msgid "This EmailAddress:"
+msgstr "Cette adresse électronique :"
+
+msgid "This ExternalUri:"
+msgstr "Cette Uri externe :"
+
+msgid "This RQLExpression:"
+msgstr "Cette expression RQL :"
+
+msgid "This State:"
+msgstr "Cet état :"
+
+msgid "This SubWorkflowExitPoint:"
+msgstr "Cette sortie de sous-workflow :"
+
+msgid "This TrInfo:"
+msgstr "Cette information de transition :"
+
+msgid "This Transition:"
+msgstr "Cette transition :"
+
+msgid "This Workflow:"
+msgstr "Ce workflow :"
+
+msgid "This WorkflowTransition:"
+msgstr "Cette transition workflow :"
 
 msgid ""
 "This action is forbidden. If you think it should be allowed, please contact "
--- a/web/views/autoform.py	Thu Jan 22 18:08:05 2015 +0100
+++ b/web/views/autoform.py	Fri Jan 30 15:53:32 2015 +0100
@@ -815,8 +815,7 @@
         srels_by_cat = self.editable_relations()
         if not srels_by_cat:
             raise f.FieldNotFound('_cw_generic_field')
-        fieldset = u'%s :' % self._cw.__('This %s' % self.edited_entity.e_schema)
-        fieldset = fieldset.capitalize()
+        fieldset = 'This %s:' % self.edited_entity.e_schema
         return GenericRelationsField(self.editable_relations(),
                                      fieldset=fieldset, label=None)
 
--- a/web/views/formrenderers.py	Thu Jan 22 18:08:05 2015 +0100
+++ b/web/views/formrenderers.py	Fri Jan 30 15:53:32 2015 +0100
@@ -242,9 +242,9 @@
             except KeyError:
                 self.warning('no such fieldset: %s (%s)', fieldset, form)
                 continue
-            w(u'<fieldset class="%s">\n' % (fieldset or u'default'))
+            w(u'<fieldset>\n')
             if fieldset:
-                w(u'<legend>%s</legend>' % self._cw._(fieldset))
+                w(u'<legend>%s</legend>' % self._cw.__(fieldset))
             w(u'<table class="%s">\n' % self.table_class)
             for field in fields:
                 w(u'<tr class="%s_%s_row">\n' % (field.name, field.role))