1 /*  Copyright 2008-2010 Guillaume Duhamel
2 
3     This file is part of mini18n.
4 
5     mini18n is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9 
10     mini18n is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with mini18n; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18 */
19 
20 #include "mini18n.h"
21 #include "mini18n-multi.h"
22 
23 static mini18n_t currentlang = (mini18n_t) 0;
24 
mini18n_set_domain(const char * folder)25 int mini18n_set_domain(const char * folder) {
26 	if (currentlang == (mini18n_t) 0)
27 		currentlang = mini18n_create();
28 	return mini18n_load_system(currentlang, folder);
29 }
30 
mini18n_set_locale(const char * locale)31 int mini18n_set_locale(const char * locale) {
32 	if (currentlang == (mini18n_t) 0)
33 		currentlang = mini18n_create();
34 	return mini18n_load(currentlang, locale);
35 }
36 
mini18n_set_log(const char * filename)37 int mini18n_set_log(const char * filename) {
38 	return mini18n_set_log_filename(currentlang, filename);
39 }
40 
mini18n(const char * source)41 const char * mini18n(const char * source) {
42 	return mini18n_get(currentlang, source);
43 }
44 
mini18n_with_conversion(const char * source,unsigned int format)45 const void * mini18n_with_conversion(const char * source, unsigned int format) {
46 	return mini18n_get_with_conversion(currentlang, source, format);
47 }
48 
mini18n_close(void)49 void mini18n_close(void) {
50 	mini18n_destroy(currentlang);
51 	currentlang = (mini18n_t) 0;
52 }
53