Skip to content

Commit ac42dba

Browse files
committed
ISO 19115/19110 use iso3 for locale codelist values
1 parent 7681446 commit ac42dba

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

inst/actions/geometa_create_iso_19110.R

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@ function(action, entity, config){
6868

6969
#locales (i18n/i10n support)
7070
if(length(entity$locales)>0){
71+
ref_locales = utils::read.csv(system.file("extdata/codelists", "ISO-639-2_utf-8.txt", package = "geometa"),sep="|", stringsAsFactors = FALSE)
7172
for(locale in entity$locales){
7273
a_locale <- ISOLocale$new()
7374
a_locale$setId(locale)
74-
a_locale$setLanguage(locale)
75+
language = ref_locales[ref_locales$alpha2 == tolower(locale),]$alpha3[1]
76+
a_locale$setLanguage(language)
7577
a_locale$setCharacterSet("utf8")
7678
fc$addLocale(a_locale)
7779
}

inst/actions/geometa_create_iso_19115.R

+3-1
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ function(action, entity, config){
138138

139139
#locales (i18n/i10n support)
140140
if(length(entity$locales)>0){
141+
ref_locales = utils::read.csv(system.file("extdata/codelists", "ISO-639-2_utf-8.txt", package = "geometa"),sep="|", stringsAsFactors = FALSE)
141142
for(locale in entity$locales){
142143
a_locale <- ISOLocale$new()
143144
a_locale$setId(locale)
144-
a_locale$setLanguage(locale)
145+
language = ref_locales[ref_locales$alpha2 == tolower(locale),]$alpha3[1]
146+
a_locale$setLanguage(language)
145147
a_locale$setCharacterSet("utf8")
146148
md$addLocale(a_locale)
147149
}

0 commit comments

Comments
 (0)