[PATCH 1 of 8 seda] [vocab] Add french translation for code keyword type vocabulary

Sylvain Thenault sylvain.thenault at logilab.fr
Thu Mar 16 13:37:38 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1489660310 -3600
#      Thu Mar 16 11:31:50 2017 +0100
# Node ID 481d024275a9ce6169550d73ba78f8336bda4620
# Parent  64ffda562109fad0734d462ae47093569aa600e1
[vocab] Add french translation for code keyword type vocabulary

Also update its title and concept's language because it's not a SEDA 2 specific vocabulary.

diff --git a/cubicweb_seda/dataimport.py b/cubicweb_seda/dataimport.py
--- a/cubicweb_seda/dataimport.py
+++ b/cubicweb_seda/dataimport.py
@@ -40,11 +40,11 @@ LCSV_FILES = (
                    'SEDADiameter', 'SEDALength', 'SEDAThickness'),
      'measurement_units_type.csv'),
     (u'SEDA 2 : Unités de poids',
      'seda_unit', 'SEDAWeight',
      'measurement_weight_units_type.csv'),
-    (u'SEDA 2 : Types de mot-clé',
+    (u'SEDA : Types de mot-clé',
      'seda_keyword_type_to', (),
      'code_keyword_type.csv'),
     (u'SEDA 2 : Status légaux',
      'seda_legal_status_to', (),
      'legal_status.csv'),
diff --git a/cubicweb_seda/migration/0.9.0_Any.py b/cubicweb_seda/migration/0.9.0_Any.py
--- a/cubicweb_seda/migration/0.9.0_Any.py
+++ b/cubicweb_seda/migration/0.9.0_Any.py
@@ -1,5 +1,6 @@
+# coding: utf-8
 from cubicweb_seda import iter_all_rdefs
 
 for rdef, role in iter_all_rdefs(schema, 'SEDAArchiveTransfer'):
     if role == 'subject':
         target_etype = rdef.subject
@@ -7,5 +8,32 @@ for rdef, role in iter_all_rdefs(schema,
         target_etype = rdef.object
     if target_etype == 'SEDAArchiveUnit':
         sync_schema_props_perms((rdef.subject, rdef.rtype, rdef.object))
 
 sync_schema_props_perms('clone_of')
+
+scheme = cnx.find('ConceptScheme', title=u'SEDA 2 : Types de mot-clé').one()
+with cnx.deny_all_hooks_but():
+    scheme.cw_set(title=u'SEDA : Types de mot-clé')
+    cnx.commit()
+    cnx.execute('SET L language_code "seda" WHERE L label_of C, C in_scheme CS, CS eid %(cs)s',
+                {'cs': scheme.eid})
+    cnx.commit()
+
+for concept in scheme.reverse_in_scheme:
+    label = {
+        'corpname': u'Collectivité',
+        'famname': u'Nom de famille',
+        'geogname': u'Nom géographique',
+        'name': u'Nom',
+        'occupation': u'Fonction',
+        'persname': u'Nom de personne',
+        'subject': u'Mot-matière',
+        'genreform': u'Typologie documentaire',
+        'function': u'Activité',
+    }[concept.label('seda')]
+    cnx.create_entity('Label', label_of=concept, label=label,
+                      kind=u'preferred', language_code=u'fr')
+
+cnx.commit()
+
+
diff --git a/cubicweb_seda/migration/data/code_keyword_type.csv b/cubicweb_seda/migration/data/code_keyword_type.csv
--- a/cubicweb_seda/migration/data/code_keyword_type.csv
+++ b/cubicweb_seda/migration/data/code_keyword_type.csv
@@ -1,13 +1,13 @@
 #;$id;label
-type;url;string
-lang;;seda-2
-url;skos:Concept;skos:prefLabel
-;;corpname
-;;famname
-;;geogname
-;;name
-;;occupation
-;;persname
-;;subject
-;;genreform
-;;function
+type;url;string;string
+lang;;seda;fr
+url;skos:Concept;skos:prefLabel;skos:prefLabel
+;;corpname;Collectivité
+;;famname;Nom de famille
+;;geogname;Nom géographique
+;;name;Nom
+;;occupation;Fonction
+;;persname;Nom de personne
+;;subject;Mot-matière
+;;genreform;Typologie documentaire
+;;function;Activité


More information about the saem-devel mailing list