Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

233 auto translation flag #109

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ To convert a Yaml file to XML, run:

eg:

`python -m metadata_xml -f sample_records/record.yaml`
`python -m metadata_xml -f sample_records/record.yml`

## Importing into other Python projects

Expand Down
8 changes: 7 additions & 1 deletion metadata_xml/iso19115-cioos-template/bilingual.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@
<gco:CharacterString>{{- value[lang]|e -}}</gco:CharacterString>
{% endif %}
<lan:PT_FreeText>
{% set translations = value.get("translations", {})%}
{% for secondary_lang,val in value.items() %}
{% if secondary_lang != lang %}
{% if secondary_lang != lang and secondary_lang != 'translations'%}
{% set translationMessage = translations.get(secondary_lang,{}).get("message")%}
{% if translationMessage %}
<lan:textGroup xlink:href="https://cioos.ca/translation_method" xlink:role="translation" xlink:title="{{translationMessage}}">
{% else %}
<lan:textGroup>
{% endif %}
<lan:LocalisedCharacterString locale="#{{secondary_lang}}">{{- val|e -}}</lan:LocalisedCharacterString>
</lan:textGroup>
{% endif %}
Expand Down
24 changes: 22 additions & 2 deletions sample_records/record.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ metadata:
language: en
maintenance_note: maintenance_note
use_constraints:
limitations: limitations
limitations:
en: limitations in english
fr: limitations in french
translations:
fr:
validated: false
message: Auto-translated using AWS
licence:
title: Creative Commons Attribution 4.0
code: CC-BY-4.0
Expand All @@ -38,11 +44,19 @@ identification:
title:
en: title in english
fr: title in french
translations:
fr:
validated: false
message: Auto-translated using AWS
identifier: http://dx.doi.org/10.1093/ajae/aaq063

abstract:
en: abstract in english
fr: abstract in french
translations:
fr:
validated: false
message: Auto-translated using AWS
associated_resources:
- title:
en: associated resource title in english
Expand Down Expand Up @@ -123,7 +137,13 @@ platform:
name: platform_name
authority: platform_authority
id: platform id
description: platform_description
description:
en: platformDescription in English
fr: platformDescription in French
translations:
fr:
validated: true
message: Auto-translated using AWS
instruments:
- id: 123
manufacturer: manufacturer en 1
Expand Down
Loading