Skip to content

Commit

Permalink
Merge dev into master (#108)
Browse files Browse the repository at this point in the history
**Domain**

* 22 new attributes (required for Horizon Europe)

**Conditions**

* Four new conditions

**Options**

* Additional options: `infrastructure_resources/262` "Fast read and write of data is required (high performance storage)", `preservation_repository_options/138` "Another partner institution"
* Removed option: `dataset_size_options/253` "not yet defined"
* Localisation in French and Italian; minor language adjustments in English and German

**Catalogs**

* New questions: `topic-research_field/name`, `long-term-preservation-datasets/responsible_person_name` , `long-term-preservation-datasets/responsible_person_email`
* Broken attribute reference in catalogs rdmo.xml, bielefeld.xml, snf.xml repaired
* DFG and CC links updated 
* Orthography corrections (spaces, newlines, lists, quotes, special characters) in catalogs rdmo.xml, dcc.xml, fhpshort.xml, catalog_VW_SE.xml
* Localisation of catalog rdmo.xml in French and Italian
* Minor language adjustments in English and German question text
* Additional help text where necessary

**Community contributions**

* Tabular overview of community catalogs
* New catalog for Science Europe / VW Stiftung
* FoDaKo documentation updated

**Internationalisation**

* New folder "localisation" containing R script and tables for the localisation of RDMO catalogues and optionsets
  • Loading branch information
Zack-83 authored Dec 1, 2021
1 parent 8cc58d6 commit a1372da
Show file tree
Hide file tree
Showing 13 changed files with 1,987 additions and 598 deletions.
16 changes: 16 additions & 0 deletions localisation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# R script and tables for the localisation of RDMO catalogues and optionsets

This folder contains tools which allow adding new languages to the RDMO XML files (presently catalogues and optionsets).

The code is still "work in progress".

Suggested procedure:

1. Open the R script. If necessary, adjust the file names and paths.
2. Add the new language to all relevant positions in the script (in particular after each occurrence of `Liste_it`, `Übersetzung_it`, `IT`).
3. Run the first part of the script. This will extract all text chunks (titles, question texts, help texts, verbose names) as well as their XML path into a TSV file.
4. Open the TSV file with a spreadsheet software or an advanced text editor. Add a new column with the new language.
5. Translate the text into the new language. You may sort the table, provided you sort it back at the end. Don't delete the empty rows.
6. Run the second part of the script. This will add the nodes in the new language as siblings to the existing ones in the XML file.
7. Check the resulting XML file for consistency using an XML editor.
8. Upload the resulting XML file to your RDMO instance (and possibly as a pull reqest here on GitHub).
52 changes: 52 additions & 0 deletions localisation/rdmo-translation.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
library(xml2); library(stringr); library(magrittr); library(tidyverse)
# setwd("C:/Users/MYPATH") # enter path

rm(list=ls())
Dateiname <- "PRONTO/rdmo-questions.xml"
# Dateiname <- "rdmo-catalog-master/rdmorganiser/options/rdmo.xml"

# Liste_fr <- Liste_it <- xml_find_all(read_xml(Dateiname),'.//*[@lang="de"]')
Dokument <- read_xml(Dateiname)
Liste_de <- xml_find_all(Dokument,'.//*[@lang="de"]')
Liste_en <- xml_find_all(Dokument,'.//*[@lang="en"]')
Liste_fr <- xml_find_all(Dokument,'.//*[@lang="fr"]')
Liste_it <- xml_find_all(Dokument,'.//*[@lang="it"]')

##########################
# nuova tabella traduzione

# Etiketten <- c(); for(x in Liste_de) Etiketten %<>% append(.,xml_text(xml_child(xml_parent(x),"key")))
DE <- data.frame( Pfad = str_replace(xml_path(Liste_de),"\\[\\d*\\]\\Z","") , de = xml_text(Liste_de) )
EN <- data.frame( Pfad = str_replace(xml_path(Liste_en),"\\[\\d*\\]\\Z","") , en = xml_text(Liste_en) )
FR <- data.frame( Pfad = str_replace(xml_path(Liste_fr),"\\[\\d*\\]\\Z","") , fr = xml_text(Liste_fr) )
IT <- data.frame( Pfad = str_replace(xml_path(Liste_it),"\\[\\d*\\]\\Z","") , it = xml_text(Liste_it) )

Übersetzung <- DE %>%
full_join(EN,"Pfad") %>%
full_join(FR,"Pfad") %>%
full_join(IT,"Pfad")

fix(Übersetzung)
write_tsv(Übersetzung,"Traduzione00.tsv",na="", quote_escape="none")

##########################
# aggiornamento traduzione

Übersetzung <- read_tsv("PRONTO/rdmo-questions-localisation.tsv")
Übersetzung %<>% .[match(.$Pfad,DE$Pfad),]

xml_set_attr(Liste_de,"lang","de")
xml_set_attr(Liste_en,"lang","en")
xml_set_attr(Liste_fr,"lang","fr")
xml_set_attr(Liste_it,"lang","it")
xml_set_text(Liste_debersetzung$de)
xml_set_text(Liste_enbersetzung$en)
xml_set_text(Liste_frbersetzung$fr)
xml_set_text(Liste_itbersetzung$it)

xml_remove(xml_find_all(Dokument,'.//*[@lang="fr"]'))
xml_remove(xml_find_all(Dokument,'.//*[@lang="it"]'))
for(.k in seq_along(Liste_de)) xml_add_sibling( Liste_de[[.k]],Liste_it[[.k]] )
for(.k in seq_along(Liste_de)) xml_add_sibling( Liste_de[[.k]],Liste_fr[[.k]] )

write_xml(Dokument,"rdmo-questions.xml")
38 changes: 37 additions & 1 deletion rdmorganiser/conditions/rdmo.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<rdmo xmlns:dc="http://purl.org/dc/elements/1.1/">
<condition dc:uri="https://rdmorganiser.github.io/terms/conditions/embargo">
<uri_prefix>https://rdmorganiser.github.io/terms</uri_prefix>
<key>embargo</key>
<dc:comment/>
<source dc:uri="https://rdmorganiser.github.io/terms/domain/project/dataset/preservation/embargo_period"/>
<relation>gt</relation>
<target_text>0</target_text>
<target_option/>
</condition>
<condition dc:uri="https://rdmorganiser.github.io/terms/conditions/existing_data">
<uri_prefix>https://rdmorganiser.github.io/terms</uri_prefix>
<key>existing_data</key>
<dc:comment/>
<source dc:uri="https://rdmorganiser.github.io/terms/domain/project/dataset/existing_yesno"/>
<relation>eq</relation>
<target_text>1</target_text>
<target_option/>
</condition>
<condition dc:uri="https://rdmorganiser.github.io/terms/conditions/repository_extern">
<uri_prefix>https://rdmorganiser.github.io/terms</uri_prefix>
<key>repository_extern</key>
<dc:comment/>
<source dc:uri="https://rdmorganiser.github.io/terms/domain/project/dataset/preservation/repository"/>
<relation>neq</relation>
<target_text/>
<target_option dc:uri="https://rdmorganiser.github.io/terms/options/preservation_repository_options/138"/>
</condition>
<condition dc:uri="https://rdmorganiser.github.io/terms/conditions/software_generated">
<uri_prefix>https://rdmorganiser.github.io/terms</uri_prefix>
<key>software_generated</key>
<dc:comment/>
<source dc:uri="https://rdmorganiser.github.io/terms/domain/project/dataset/usage_software"/>
<relation>eq</relation>
<target_text/>
<target_option dc:uri="https://rdmorganiser.github.io/terms/options/usage_software/selfgenerated"/>
</condition>
<condition dc:uri="https://rdmorganiser.github.io/terms/conditions/additional_rdm_policy">
<uri_prefix>https://rdmorganiser.github.io/terms</uri_prefix>
<key>additional_rdm_policy</key>
Expand Down Expand Up @@ -117,4 +153,4 @@
<target_text/>
<target_option dc:uri="https://rdmorganiser.github.io/terms/options/software_versioning_technology_options/164"/>
</condition>
</rdmo>
</rdmo>
Loading

0 comments on commit a1372da

Please sign in to comment.