[vocab] Add french translation for code keyword type vocabulary
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 16 Mar 2017 11:31:50 +0100
changeset 2494 62882aa59ac9
parent 2482 de2afb160604
child 2495 e8fdad3ee7cb
[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.
cubicweb_seda/dataimport.py
cubicweb_seda/migration/0.9.0_Any.py
cubicweb_seda/migration/data/code_keyword_type.csv
--- a/cubicweb_seda/dataimport.py	Wed Mar 08 06:30:52 2017 +0100
+++ b/cubicweb_seda/dataimport.py	Thu Mar 16 11:31:50 2017 +0100
@@ -42,7 +42,7 @@
     (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',
--- a/cubicweb_seda/migration/0.9.0_Any.py	Wed Mar 08 06:30:52 2017 +0100
+++ b/cubicweb_seda/migration/0.9.0_Any.py	Thu Mar 16 11:31:50 2017 +0100
@@ -1,3 +1,4 @@
+# coding: utf-8
 from cubicweb_seda import iter_all_rdefs
 
 for rdef, role in iter_all_rdefs(schema, 'SEDAArchiveTransfer'):
@@ -9,3 +10,30 @@
         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()
+
+
--- a/cubicweb_seda/migration/data/code_keyword_type.csv	Wed Mar 08 06:30:52 2017 +0100
+++ b/cubicweb_seda/migration/data/code_keyword_type.csv	Thu Mar 16 11:31:50 2017 +0100
@@ -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é