summaryrefslogtreecommitdiffstats
path: root/ui/rccnames.c
blob: 2e11165d164a6581dbd1a2648bf56f388a33089d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>

#include "internal.h"

const char *rccUiGetLanguageName(rcc_ui_context ctx, const char *lang) {
    const char *res;
    unsigned int i;
    rcc_language_name *names;
    
    if ((!ctx)||(!lang)) return NULL;
    
    names = ctx->language_names;
    
    if (names) {
	for (i=0;names[i].sn;i++)
	    if (!strcmp(lang, names[i].sn)) return names[i].name;
    }


    res = rccGetLanguageFullName(lang);
    if (res) return res;
    
    return lang;
}

const char *rccUiGetOptionName(rcc_ui_context ctx, rcc_option option) {
    const char *res;
    unsigned int i;
    rcc_option_name *names;
    
    if ((!ctx)||(option<0)||(option>RCC_MAX_OPTIONS)) return NULL;

    names = ctx->option_names;

    if (names) {
	for (i=0;((i<RCC_MAX_OPTIONS)&&(names[i].option!=RCC_MAX_OPTIONS));i++)
	    if (names[i].option == option) return names[i].name;
    }

    res = rccGetOptionFullName(option);
    if (res) return res;
    
    return "";
}