diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:40:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:40:05 +0000 |
commit | 4038ab95a094b363f1748f3dcb51511a1217475d (patch) | |
tree | 7f393d66a783f91ddd263c78d681e485cf4f45ca /librdfa/language.c | |
parent | Initial commit. (diff) | |
download | raptor2-upstream.tar.xz raptor2-upstream.zip |
Adding upstream version 2.0.16.upstream/2.0.16upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'librdfa/language.c')
-rw-r--r-- | librdfa/language.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/librdfa/language.c b/librdfa/language.c new file mode 100644 index 0000000..daa2daf --- /dev/null +++ b/librdfa/language.c @@ -0,0 +1,55 @@ +/** + * Copyright 2008 Digital Bazaar, Inc. + * + * This file is part of librdfa. + * + * librdfa is Free Software, and can be licensed under any of the + * following three licenses: + * + * 1. GNU Lesser General Public License (LGPL) V2.1 or any + * newer version + * 2. GNU General Public License (GPL) V2 or any newer version + * 3. Apache License, V2.0 or any newer version + * + * You may not use this file except in compliance with at least one of + * the above three licenses. + * + * See LICENSE-* at the top of this software distribution for more + * information regarding the details of each license. + * + * The language module is used to determine and set the current language. + */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "rdfa_utils.h" +#include "rdfa.h" + +/** + * Updates the language given the value of the xml:lang attribute. + * + * @param lang the new value of the lang attribute. + */ +void rdfa_update_language(rdfacontext* context, const char* lang) +{ + /* the [current element] is parsed for any language information, + * and [language] is set in the [current evaluation context]; */ + if(lang != NULL) + { + if(strlen(lang) > 0) + { + /* if a language was specified, set it */ + context->language = rdfa_replace_string(context->language, lang); + } + else + { + /* if a blank language was specified, clear the language context */ + free(context->language); + context->language = NULL; + } + } +} |