diff --git a/metadata_xml/iso19115-cioos-template/main.j2 b/metadata_xml/iso19115-cioos-template/main.j2 index 3b3d1d1..0a16983 100644 --- a/metadata_xml/iso19115-cioos-template/main.j2 +++ b/metadata_xml/iso19115-cioos-template/main.j2 @@ -1,15 +1,14 @@ {% set lang = record['metadata']['language'] %} -{% set lang_alt = record['metadata']['language_alternate'] %} {% set language_codes = {"en":"eng", "fr":"fra", } %} {% set lang_code = language_codes[lang] %} - -{% set lang_alt_code = language_codes[lang_alt] %} {% set languages_used = list_all_languages_in_record(record) %} +{% set resource_lang_code = language_codes[record['identification']['language']] %} +{% set resource_lang_alt_code = language_codes[record['identification']['language_alternate']] %} {% import 'bilingual.j2' as bl with context %} {% import 'contact.j2' as contact with context %} @@ -621,6 +620,59 @@ {% endfor %} + {% if record['identification']['language'] and resource_lang_code %} + {# defaultLocale: mandatory #} + + + {# language: mandatory #} + + + {# CIOOS core mandatory element #} + {# MI_Metadata/defaultLocale/PT_Locale/language/LanguageCode (ISO639-2) #} + + + {# country: mandatory #} + + + {# CIOOS core mandatory element #} + {# MI_Metadata/defaultLocale/PT_Locale/country/CountryCode (ISO3166-1) #} + + + {# characterEncoding: mandatory #} + + + {# CIOOS core mandatory element #} + {# MI_Metadata/defaultLocale/PT_Locale/characterEncoding/MD_CharacterSetCode (UTF-8) #} + + + + {% endif %} + {% if record['identification']['language_alternate'] and resource_lang_alt_code %} + + + {# language: mandatory #} + + + {# CIOOS core mandatory element #} + {# MI_Metadata/otherLocale/PT_Locale/language/LanguageCode (ISO639-2) #} + + + {# country: mandatory #} + + + {# CIOOS core mandatory element #} + {# MI_Metadata/otherLocale/PT_Locale/country/CountryCode (ISO3166-1) #} + + + + + {# CIOOS core mandatory element #} + {# MI_Metadata/otherLocale/PT_Locale/characterEncoding/MD_CharacterSetCode (UTF-8) #} + + + + {% endif %} + {{- bl.bilingual('mri:supplementalInformation', 'comment', record['metadata']) -}} diff --git a/sample_records/record.yml b/sample_records/record.yml index 13fcd98..0c12dda 100644 --- a/sample_records/record.yml +++ b/sample_records/record.yml @@ -11,6 +11,7 @@ metadata: naming_authority: ca.cioos identifier: 3f342f64-9348-11df-ba6a-0014c2c00eab language: en + language_alternate: fr maintenance_note: maintenance_note use_constraints: limitations: limitations @@ -35,6 +36,9 @@ spatial: vertical: [0, 10] vertical_positive: down identification: + language: en + language_alternate: fr + title: en: title in english fr: title in french