diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-06-19 16:29:42 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-06-21 23:27:22 +0100 |
commit | 67ded2a02a4f3f4d2a0ab156f3343dc93f4ba04c (patch) | |
tree | 3110af1e6d0bea57725b74db6efeb3a821628890 /utils | |
parent | 335bbe4f52b9fdb74e377b83906eaab4456666cf (diff) | |
download | netsurf-67ded2a02a4f3f4d2a0ab156f3343dc93f4ba04c.tar.gz netsurf-67ded2a02a4f3f4d2a0ab156f3343dc93f4ba04c.tar.bz2 |
This moves message loading out of netsurf_init into each frontend
The translated message loading is dependant on configuration of
resource location in each frontend, additionally they should have the
ability to deal with errors in this loading in a implementation
specific manner.
This also extends the message loading API to be capable of loading
from an inline memory buffer instead of from a file.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/messages.c | 8 | ||||
-rw-r--r-- | utils/messages.h | 19 |
2 files changed, 23 insertions, 4 deletions
diff --git a/utils/messages.c b/utils/messages.c index 78b9a79f0..91b41cbc8 100644 --- a/utils/messages.c +++ b/utils/messages.c @@ -142,7 +142,7 @@ messages_get_ctx(const char *key, struct hash_table *ctx) } /* exported interface documented in messages.h */ -nserror messages_load(const char *path) +nserror messages_add_from_file(const char *path) { nserror err; @@ -158,6 +158,12 @@ nserror messages_load(const char *path) } /* exported interface documented in messages.h */ +nserror messages_add_from_inline(const char *data) +{ + return NSERROR_OK; +} + +/* exported interface documented in messages.h */ char *messages_get_buff(const char *key, ...) { const char *msg_fmt; diff --git a/utils/messages.h b/utils/messages.h index c9946e6a9..4d04cd52b 100644 --- a/utils/messages.h +++ b/utils/messages.h @@ -38,13 +38,26 @@ /** * Read keys and values from messages file into the standard Messages hash. * - * The messages are merged with any previously loaded messages. Any keys which - * are present already are replaced with the new value. + * The messages are merged with any previously loaded messages. Any + * keys which are present already are replaced with the new value. The + * file may be gzip compressed. * * \param path pathname of messages file. * \return NSERROR_OK on success or error code on faliure. */ -nserror messages_load(const char *path); +nserror messages_add_from_file(const char *path); + +/** + * Read keys and values from inline message data into the standard Messages hash. + * + * The messages are merged with any previously loaded messages. Any + * keys which are present already are replaced with the new value. The + * data may be gzip compressed. + * + * \param data The inline message data. + * \return NSERROR_OK on success or error code on faliure. + */ +nserror messages_add_from_inline(const char *data); /** * Fast lookup of a message by key from the standard Messages hash. |