Skip to content

Commit

Permalink
update sample yml and jinja templates for translation message
Browse files Browse the repository at this point in the history
  • Loading branch information
sorochak committed Jan 11, 2024
1 parent d2e2e30 commit 9b96ccc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ __pycache__
*.egg-info

venv/
env/
.vscode
.mypy*
notforrepo
*.xml
cioos-schema
build
build
6 changes: 5 additions & 1 deletion metadata_xml/iso19115-cioos-template/bilingual.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro bilingual(element,key,record_section) -%}
{% macro bilingual(element,key,record_section, translationKey) -%}
{% set value = record_section[key] %}

{% if (value is not mapping) or (value.items()|length==1 and lang in value) %}
Expand All @@ -19,7 +19,11 @@
<lan:PT_FreeText>
{% for secondary_lang,val in value.items() %}
{% if secondary_lang != lang %}
{% if translationKey %}
<lan:textGroup xlink:href="https://cioos.ca/translation_method" xlink:role="translation" xlink:title="{{record_section[translationKey]}}">
{% else %}
<lan:textGroup>
{% endif %}
<lan:LocalisedCharacterString locale="#{{secondary_lang}}">{{- val|e -}}</lan:LocalisedCharacterString>
</lan:textGroup>
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions metadata_xml/iso19115-cioos-template/main.j2
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
<mri:citation>
<cit:CI_Citation>
{# title: mandatory #}
{{- bl.bilingual('cit:title','title', record['identification']) -}}
{{- bl.bilingual('cit:title','title', record['identification'], 'titleTranslationMethod') -}}

{# date pubished/revised isnt required #}
{% if 'dates' in record['identification'] %}
Expand Down Expand Up @@ -283,7 +283,7 @@
{# abstract: mandatory #}
{# CIOOS core mandatory element #}
{# MI_Metadata/identificationInfo/MD_DataIdentification/abstract/CharacterString #}
{{- bl.bilingual('mri:abstract', 'abstract', record['identification']) -}}
{{- bl.bilingual('mri:abstract', 'abstract', record['identification'], 'abstractTranslationMethod') -}}
{{- bl.bilingual('mri:credit', 'acknowledgement', record['identification']) -}}
<mri:status>
<mcc:MD_ProgressCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#MD_ProgressCode" codeListValue="{{- record['identification']['progress_code'] or 'onGoing' -}}">
Expand Down Expand Up @@ -586,7 +586,7 @@
{# MD_Constraints: CIOOS core mandatory #}
<mco:MD_Constraints>
{# useLimitation: CIOOS core mandatory #}
{{- bl.bilingual('mco:useLimitation', 'limitations', record['metadata']['use_constraints']) -}}
{{- bl.bilingual('mco:useLimitation', 'limitations', record['metadata']['use_constraints'], 'limitationsTranslationMethod') -}}
</mco:MD_Constraints>
</mri:resourceConstraints>
{% endif %}
Expand Down Expand Up @@ -757,7 +757,7 @@
{# description: mandatory #}
{# CIOOS core mandatory element #}
{# MI_Metadata/acquisitionInformation/MI_AcquisitionInformation/platform/MI_Platform/description/CharacterString #}
{{- bl.bilingual('mac:description', 'description', record['platform']) -}}
{{- bl.bilingual('mac:description', 'description', record['platform'], 'platformDescriptionTranslationMethod') -}}

{% for instrument in record['platform']['instruments'] %}
{# instrument: Recommended, if platform not used then this should be under mac:MI_AcquisitionInformation #}
Expand Down
12 changes: 10 additions & 2 deletions sample_records/record.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ metadata:
language: en
maintenance_note: maintenance_note
use_constraints:
limitations: limitations
limitations:
en: limitations in english
fr: limitations in french
limitationsTranslationMethod: Auto-translated using AWS
licence:
title: Creative Commons Attribution 4.0
code: CC-BY-4.0
Expand All @@ -38,11 +41,13 @@ identification:
title:
en: title in english
fr: title in french
titleTranslationMethod: Auto-translated using AWS
identifier: http://dx.doi.org/10.1093/ajae/aaq063

abstract:
en: abstract in english
fr: abstract in french
abstractTranslationMethod: Auto-translated using AWS
associated_resources:
- title:
en: associated resource title in english
Expand Down Expand Up @@ -123,7 +128,10 @@ platform:
name: platform_name
authority: platform_authority
id: platform id
description: platform_description
description:
en: platformDescription in English
fr: platformDescription in French
platformDescriptionTranslationMethod: Auto-translated using AWS
instruments:
- id: 123
manufacturer: manufacturer en 1
Expand Down

0 comments on commit 9b96ccc

Please sign in to comment.