Skip to content

Commit

Permalink
fix #149
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Mar 18, 2024
1 parent 2a9ed4b commit c3ac84e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
19 changes: 17 additions & 2 deletions R/ZenodoRecord.R
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,25 @@ ZenodoRecord <- R6Class("ZenodoRecord",
self$metadata$version <- version
},

#' @description Set the language.
#' @description Adds a language.
#' @param language ISO 639-2 or 639-3 code
addLanguage = function(language){
zenodo = ZenodoManager$new()
zen_language = zenodo$getLanguageById(language)
if(is.null(zen_language)){
errorMsg <- sprintf("Language with id '%s' doesn't exist in Zenodo", language)
self$ERROR(errorMsg)
stop(errorMsg)
}
self$metadata$languages[[length(self$metadata$languages)+1]] <- list(id = language)
},

#' @description Set the language
#' @param language ISO 639-2 or 639-3 code
setLanguage = function(language){
self$metadata$language <- language
warnMsg = "Method 'setLanguage' is deprecated, please use 'addLanguage'"
self$WARN(warnMsg)
self$addLanguage(language)
},

#' @description Adds a related identifier with a given relation.
Expand Down
20 changes: 19 additions & 1 deletion man/ZenodoRecord.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c3ac84e

Please sign in to comment.