Skip to content

Commit

Permalink
#298 minimal locale validation
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Dec 20, 2022
1 parent 10bdc95 commit e2c0fae
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/geoflow_validator.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ geoflow_validator_cell <- R6Class("geoflow_validator_cell",
}
}
}
if("locale" %in% names(kvp)){
if(nchar(kvp$locale)!= 2){
report <- rbind(report, data.frame(type = "ERROR", message = sprintf("Locale value '%s' is invalid, it should be a locale ISO 2 code", kvp$locale)))
}
if(kvp$locale != toupper(kvp$locale)){
report <- rbind(report, data.frame(type = "ERROR", message = sprintf("Locale value '%s' is invalid, locale ISO 2 code should be uppercase", kvp$locale)))
}
}
}
}

Expand Down

0 comments on commit e2c0fae

Please sign in to comment.