⚙️ Accès aux cibles de traduction par clé
parent
a6018a9c8f
commit
3e9f6dd809
|
@ -3,22 +3,25 @@ var fs = require('fs')
|
|||
|
||||
rules = yaml.safeLoad(fs.readFileSync('source/règles/base.yaml','utf-8'))
|
||||
|
||||
externalized = rules.map(
|
||||
externalized = {}
|
||||
|
||||
rules.map(
|
||||
rule => {
|
||||
let externalizeProp = (rule, prop, result) => {
|
||||
if (rule[prop]) {
|
||||
result[prop+".fr"] = result[prop+".en"] = rule[prop]
|
||||
result[prop+".en"] = result[prop+".en"].toUpperCase()
|
||||
}
|
||||
}
|
||||
|
||||
// Toujours traduire le nom via titre
|
||||
if (!rule["titre"]) rule["titre"] = rule["nom"]
|
||||
|
||||
var result = {
|
||||
"cible": rule.espace ?
|
||||
var externKey = rule.espace ?
|
||||
rule.espace + " . " + rule.nom :
|
||||
rule.nom
|
||||
}
|
||||
var result = externalized[externKey] = {}
|
||||
|
||||
externalizeProp(rule,"titre",result)
|
||||
externalizeProp(rule,"description",result)
|
||||
externalizeProp(rule,"question",result)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue