Merge pull request 'master' (#61) from YanTheKaller/libublsettings:master into master
Reviewed-on: #61master v1.56
commit
78885abfca
@ -0,0 +1,764 @@
|
||||
#: ./locales.csv:1
|
||||
msgid "Afar"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:1
|
||||
msgid "Abkhazian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:1
|
||||
msgid "Aguaruna"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:1
|
||||
msgid "Akan"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:1
|
||||
msgid "Amharic"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:1
|
||||
msgid "Aragonese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Angika"
|
||||
msgstr ""
|
||||
|
||||
msgid "Arabic"
|
||||
msgstr ""
|
||||
|
||||
msgid "Asturian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Aymara"
|
||||
msgstr ""
|
||||
|
||||
msgid "South Azerbaijani"
|
||||
msgstr ""
|
||||
|
||||
msgid "Bemba"
|
||||
msgstr ""
|
||||
|
||||
msgid "Berber"
|
||||
msgstr ""
|
||||
|
||||
msgid "Bhili"
|
||||
msgstr ""
|
||||
|
||||
msgid "Bhojpuri"
|
||||
msgstr ""
|
||||
|
||||
msgid "Bislama"
|
||||
msgstr ""
|
||||
|
||||
msgid "Bangla"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tibetan"
|
||||
msgstr ""
|
||||
|
||||
msgid "Breton"
|
||||
msgstr ""
|
||||
|
||||
msgid "Bodo"
|
||||
msgstr ""
|
||||
|
||||
msgid "Bosnain"
|
||||
msgstr ""
|
||||
|
||||
msgid "Blin"
|
||||
msgstr ""
|
||||
|
||||
msgid "Catalan"
|
||||
msgstr ""
|
||||
|
||||
msgid "Chechen"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cherokee"
|
||||
msgstr ""
|
||||
|
||||
msgid "Central Kurdish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Mandarin Chinese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Crimean Tatar"
|
||||
msgstr ""
|
||||
|
||||
msgid "Kashubian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Chuvash"
|
||||
msgstr ""
|
||||
|
||||
msgid "Welsh"
|
||||
msgstr ""
|
||||
|
||||
msgid "Austrian German"
|
||||
msgstr ""
|
||||
|
||||
msgid "Swiss High Gernam"
|
||||
msgstr ""
|
||||
|
||||
msgid "German"
|
||||
msgstr ""
|
||||
|
||||
msgid "Dogri"
|
||||
msgstr ""
|
||||
|
||||
msgid "Lower Sorbian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Divehi"
|
||||
msgstr ""
|
||||
|
||||
msgid "Dzongkha"
|
||||
msgstr ""
|
||||
|
||||
msgid "English"
|
||||
msgstr ""
|
||||
|
||||
msgid "Spanish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Basque"
|
||||
msgstr ""
|
||||
|
||||
msgid "Persian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Fulah"
|
||||
msgstr ""
|
||||
|
||||
msgid "Filipino"
|
||||
msgstr ""
|
||||
|
||||
msgid "Faroese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Swiss French"
|
||||
msgstr ""
|
||||
|
||||
msgid "Friulian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Western Frisian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Irish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Garhwali"
|
||||
msgstr ""
|
||||
|
||||
msgid "Scottish Gaelic"
|
||||
msgstr ""
|
||||
|
||||
msgid "Geez"
|
||||
msgstr ""
|
||||
|
||||
msgid "Galician"
|
||||
msgstr ""
|
||||
|
||||
msgid "Manx"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hausa"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hakka Chinese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Fiji Hindi"
|
||||
msgstr ""
|
||||
|
||||
msgid "Chhattisgarhi"
|
||||
msgstr ""
|
||||
|
||||
msgid "Upper Sorbian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Haitian Creole"
|
||||
msgstr ""
|
||||
|
||||
msgid "Interlingua"
|
||||
msgstr ""
|
||||
|
||||
msgid "Igbo"
|
||||
msgstr ""
|
||||
|
||||
msgid "Inupiaq"
|
||||
msgstr ""
|
||||
|
||||
msgid "Inalian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Inuktitut"
|
||||
msgstr ""
|
||||
|
||||
msgid "Kabyle"
|
||||
msgstr ""
|
||||
|
||||
msgid "Kalaallisut"
|
||||
msgstr ""
|
||||
|
||||
msgid "Khmer"
|
||||
msgstr ""
|
||||
|
||||
msgid "Korean"
|
||||
msgstr ""
|
||||
|
||||
msgid "Konkani"
|
||||
msgstr ""
|
||||
|
||||
msgid "Kurdish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Komi"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cornish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Kyrgyz"
|
||||
msgstr ""
|
||||
|
||||
msgid "Luxembourgish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Ganda"
|
||||
msgstr ""
|
||||
|
||||
msgid "Limburgish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Ligurian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Lingala"
|
||||
msgstr ""
|
||||
|
||||
msgid "Lao"
|
||||
msgstr ""
|
||||
|
||||
msgid "Literary Chinese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Magahi"
|
||||
msgstr ""
|
||||
|
||||
msgid "Maithili"
|
||||
msgstr ""
|
||||
|
||||
msgid "Morisyen"
|
||||
msgstr ""
|
||||
|
||||
msgid "Malagasy"
|
||||
msgstr ""
|
||||
|
||||
msgid "Meadow Mari"
|
||||
msgstr ""
|
||||
|
||||
msgid "Maori"
|
||||
msgstr ""
|
||||
|
||||
msgid "Miskito"
|
||||
msgstr ""
|
||||
|
||||
msgid "Karbi"
|
||||
msgstr ""
|
||||
|
||||
msgid "Mongolian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Manipuri"
|
||||
msgstr ""
|
||||
|
||||
msgid "Mon"
|
||||
msgstr ""
|
||||
|
||||
msgid "Maltese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Burmese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Min Nan Chinese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Norwegian Bokmål"
|
||||
msgstr ""
|
||||
|
||||
msgid "Low German"
|
||||
msgstr ""
|
||||
|
||||
msgid "Low Saxon"
|
||||
msgstr ""
|
||||
|
||||
msgid "Nepali"
|
||||
msgstr ""
|
||||
|
||||
msgid "Central Nahuatl"
|
||||
msgstr ""
|
||||
|
||||
msgid "Niuean"
|
||||
msgstr ""
|
||||
|
||||
msgid "Dutch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Flemish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Norwegian Nynorsk"
|
||||
msgstr ""
|
||||
|
||||
msgid "South Ndebele"
|
||||
msgstr ""
|
||||
|
||||
msgid "Northern Sotho"
|
||||
msgstr ""
|
||||
|
||||
msgid "Occitan"
|
||||
msgstr ""
|
||||
|
||||
msgid "Oromo"
|
||||
msgstr ""
|
||||
|
||||
msgid "Odia"
|
||||
msgstr ""
|
||||
|
||||
msgid "Ossetic"
|
||||
msgstr ""
|
||||
|
||||
msgid "Punjabi"
|
||||
msgstr ""
|
||||
|
||||
msgid "Papiamento"
|
||||
msgstr ""
|
||||
|
||||
msgid "Pashto"
|
||||
msgstr ""
|
||||
|
||||
msgid "Brazilian Portuguese"
|
||||
msgstr ""
|
||||
|
||||
msgid "European Portuguese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cusco Quechua"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rajasthani"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tarifit"
|
||||
msgstr ""
|
||||
|
||||
msgid "Kinyarwanda"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sakha"
|
||||
msgstr ""
|
||||
|
||||
msgid "Santali"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sardinian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sindhi"
|
||||
msgstr ""
|
||||
|
||||
msgid "Northern Sami"
|
||||
msgstr ""
|
||||
|
||||
msgid "Samogitian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Shan"
|
||||
msgstr ""
|
||||
|
||||
msgid "Shuswap"
|
||||
msgstr ""
|
||||
|
||||
msgid "Shinhala"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sidamo"
|
||||
msgstr ""
|
||||
|
||||
msgid "Samoan"
|
||||
msgstr ""
|
||||
|
||||
msgid "Somali"
|
||||
msgstr ""
|
||||
|
||||
msgid "Albanian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Swati"
|
||||
msgstr ""
|
||||
|
||||
msgid "Saho"
|
||||
msgstr ""
|
||||
|
||||
msgid "Southern Sotho"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sundanese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Swedish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Swahili"
|
||||
msgstr ""
|
||||
|
||||
msgid "Silesian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tamil"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tulu"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tajik"
|
||||
msgstr ""
|
||||
|
||||
msgid "Chitwania Tharu"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tigrinya"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tigre"
|
||||
msgstr ""
|
||||
|
||||
msgid "Turkmen"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tagalog"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tswana"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tongan"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tok Pisin"
|
||||
msgstr ""
|
||||
|
||||
msgid "Turkish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tsonga"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tatar"
|
||||
msgstr ""
|
||||
|
||||
msgid "Uyghur"
|
||||
msgstr ""
|
||||
|
||||
msgid "Unami Delaware"
|
||||
msgstr ""
|
||||
|
||||
msgid "Urdu"
|
||||
msgstr ""
|
||||
|
||||
msgid "Uzbek"
|
||||
msgstr ""
|
||||
|
||||
msgid "Venda"
|
||||
msgstr ""
|
||||
|
||||
msgid "Walloon"
|
||||
msgstr ""
|
||||
|
||||
msgid "Walser"
|
||||
msgstr ""
|
||||
|
||||
msgid "Wolaytta"
|
||||
msgstr ""
|
||||
|
||||
msgid "Wolof"
|
||||
msgstr ""
|
||||
|
||||
msgid "Xhosa"
|
||||
msgstr ""
|
||||
|
||||
msgid "Yiddish"
|
||||
msgstr ""
|
||||
|
||||
msgid "Yoruba"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cantonese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Yau"
|
||||
msgstr ""
|
||||
|
||||
msgid "Moroccan Tamazight"
|
||||
msgstr ""
|
||||
|
||||
msgid "Chinese"
|
||||
msgstr ""
|
||||
|
||||
msgid "Zulu"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:1
|
||||
msgid "Afrikaans"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:2
|
||||
msgid "Arabic"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:16
|
||||
msgid "Assamese"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:17
|
||||
msgid "Azerbaijani"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:18
|
||||
msgid "Belarusian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:19
|
||||
msgid "Bulgarian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:20
|
||||
msgid "Bengali"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:21
|
||||
msgid "Bosnian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:22
|
||||
msgid "Catalan"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:23
|
||||
msgid "Czech"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:24
|
||||
msgid "Danish"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:25
|
||||
msgid "German"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:31
|
||||
msgid "Greek"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:33
|
||||
msgid "English"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:46
|
||||
msgid "Spanish"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:66
|
||||
msgid "Estonian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:67
|
||||
msgid "Finnish"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:68
|
||||
msgid "French"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:73
|
||||
msgid "Gujarati"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:74
|
||||
msgid "Hebrew"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:75
|
||||
msgid "Hindi"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:76
|
||||
msgid "Croatian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:77
|
||||
msgid "Hungarian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:78
|
||||
msgid "Armenian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:79
|
||||
msgid "Indonesian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:80
|
||||
msgid "Icelandic"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:81
|
||||
msgid "Italian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:83
|
||||
msgid "Japanese"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:84
|
||||
msgid "Georgian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:85
|
||||
msgid "Kazakh"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:86
|
||||
msgid "Kannada"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:88
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:91
|
||||
msgid "Kirghiz"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:92
|
||||
msgid "Lithuanian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:93
|
||||
msgid "Latvian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:94
|
||||
msgid "Macedonian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:95
|
||||
msgid "Malayalam"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:96
|
||||
msgid "Marathi"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:97
|
||||
msgid "Malay"
|
||||
msgstr ""
|
||||
|
||||
|
||||
#: ./locales.csv:99
|
||||
msgid "Bokmal"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:102
|
||||
msgid "Nynorsk"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:103
|
||||
msgid "Oriya"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:104
|
||||
msgid "Punjabi"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:105
|
||||
msgid "Polish"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:106
|
||||
msgid "Portuguese"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:108
|
||||
msgid "Romanian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:109
|
||||
msgid "Russian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:111
|
||||
msgid "Sanskrit"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:112
|
||||
msgid "Slovak"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:113
|
||||
msgid "Slovenian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:114
|
||||
msgid "Albanian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:115
|
||||
msgid "Serbian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:119
|
||||
msgid "Swedish"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:120
|
||||
msgid "Tamil"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:121
|
||||
msgid "Telugu"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:122
|
||||
msgid "Thai"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:123
|
||||
msgid "Turkish"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:124
|
||||
msgid "Ukrainian"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:125
|
||||
msgid "Vietnamese"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:126
|
||||
msgid "Simplified Chinese"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:127
|
||||
msgid "Traditional Chinese"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:128
|
||||
msgid "Chinese"
|
||||
msgstr ""
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,101 @@
|
||||
#include "libublsettings.h"
|
||||
|
||||
unsigned int yon_str_hash(const char *str) {
|
||||
unsigned int hash = 5381;
|
||||
for (; *str != '\0'; str++) {
|
||||
hash = (hash << 5) + hash + (unsigned char)(*str);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
//\
|
||||
=====================================================================
|
||||
|
||||
yon_hash *yon_hash_new(int size, unsigned int(*hash_func)(const char *)){
|
||||
yon_hash *hash = malloc(sizeof(yon_hash));
|
||||
memset(hash,0,sizeof(yon_hash));
|
||||
hash->data = malloc(sizeof(yon_hash_element)*size);
|
||||
memset(hash->data,0,sizeof(yon_hash_element)*size);
|
||||
hash->size = size;
|
||||
hash->hash_func = hash_func;
|
||||
return hash;
|
||||
}
|
||||
|
||||
yon_hash_element *yon_hash_element_new(const char *key, void *data){
|
||||
yon_hash_element *element = malloc(sizeof(yon_hash_element));
|
||||
memset(element,0,sizeof(yon_hash_element));
|
||||
element->key = yon_char_new(key);
|
||||
element->data = data;
|
||||
element->first = (struct yon_hash_element*)element;
|
||||
return element;
|
||||
}
|
||||
|
||||
int yon_hash_insert(yon_hash *target, const char *key, void *data){
|
||||
if (target&&target->hash_func&&!yon_char_is_empty(key)&&data){
|
||||
unsigned int hash = target->hash_func(key)%target->size;
|
||||
if (target->data&&target->data[hash]){
|
||||
yon_hash_element *element = yon_hash_element_new(key,data);
|
||||
yon_hash_element *last = (yon_hash_element *)yon_dictionary_get_last((dictionary*)target->data[hash]);
|
||||
last->next=(struct yon_hash_element*)element;
|
||||
element->prev=(struct yon_hash_element*)last;
|
||||
element->first=(struct yon_hash_element*)last->first;
|
||||
return 1;
|
||||
} else {
|
||||
// target->data[hash] = malloc(sizeof(yon_hash_element*));
|
||||
target->data[hash] = yon_hash_element_new(key,data);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int yon_hash_remove(yon_hash *target, const char *key){
|
||||
if (target&&target->hash_func&&!yon_char_is_empty(key)){
|
||||
unsigned int hash = target->hash_func(key)%target->size;
|
||||
if (target->data[hash]){
|
||||
dictionary *dict = yon_dictionary_get((dictionary**)&target->data[hash],(char*)key);
|
||||
target->data[hash]=(yon_hash_element*)yon_dictionary_rip(dict);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *yon_hash_lookup(yon_hash *target, const char *key){
|
||||
if (target&&target->size>0&&!yon_char_is_empty(key)){
|
||||
unsigned int hash = target->hash_func(key)%target->size;
|
||||
if (target->data[hash]){
|
||||
dictionary *dict = yon_dictionary_get((dictionary**)&target->data[hash],(char*)key);
|
||||
return yon_dictionary_get_data(dict,void*);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int yon_hash_contains(yon_hash *target, const char *key){
|
||||
if (target&&!yon_char_is_empty(key)){
|
||||
unsigned int hash = target->hash_func(key)%target->size;
|
||||
if (target->data[hash]){
|
||||
if (yon_dictionary_get((dictionary**)&target->data[hash],(char*)key)) return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int yon_hash_add(yon_hash *target,const char *key){
|
||||
if (target&&target->size>0&&!yon_char_is_empty(key)){
|
||||
unsigned int hash = target->hash_func(key)%target->size;
|
||||
|
||||
if (target->data[hash]){
|
||||
yon_hash_element *element = yon_hash_element_new(key,NULL);
|
||||
yon_hash_element *last = (yon_hash_element *)yon_dictionary_get_last((dictionary*)target->data[hash]);
|
||||
last->next=(struct yon_hash_element*)element;
|
||||
element->prev=(struct yon_hash_element*)last;
|
||||
element->first=(struct yon_hash_element*)last->first;
|
||||
return 1;
|
||||
} else {
|
||||
target->data = malloc(sizeof(yon_hash_element*));
|
||||
target->data[0] = yon_hash_element_new(key,NULL);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
#include "libublsettings.h"
|
||||
|
||||
#define locales_path "/usr/share/i18n/locales/"
|
||||
|
||||
yon_hash *locales_hash_table = NULL;
|
||||
|
||||
struct yon_locale {
|
||||
char *code;
|
||||
char *lang_ab;
|
||||
char *territory;
|
||||
char *language;
|
||||
char *lang_name;
|
||||
char *title;
|
||||
};
|
||||
|
||||
struct yon_locale *yon_lang_new(){
|
||||
struct yon_locale *cur_locale = malloc(sizeof(struct yon_locale));
|
||||
memset(cur_locale,0,sizeof(struct yon_locale));
|
||||
return cur_locale;
|
||||
}
|
||||
|
||||
char *yon_locale_unwrap(char *parameter){
|
||||
char *final = yon_char_new(parameter);
|
||||
free(yon_char_divide_search(final,"\"",-1));
|
||||
char *temp = yon_char_divide_search(final,"\"",-1);
|
||||
free(final);
|
||||
final = yon_char_return_if_exist(temp,NULL);
|
||||
return final;
|
||||
}
|
||||
|
||||
void yon_locale_set(struct yon_locale *target,char *locale_name){
|
||||
int size;
|
||||
char *path = yon_char_unite(locales_path,locale_name,NULL);
|
||||
config_str locale_string = yon_file_open(path,&size);
|
||||
target->code = yon_char_new(locale_name);
|
||||
target->lang_ab = yon_char_new(locale_name);
|
||||
target->territory = yon_char_parsed_check_exist_begins_with(locale_string,size,"territory");
|
||||
target->language = yon_char_parsed_check_exist_begins_with(locale_string,size,"language");
|
||||
target->lang_name = yon_char_parsed_check_exist_begins_with(locale_string,size,"lang_name");
|
||||
target->title = yon_char_parsed_check_exist_begins_with(locale_string,size,"title");
|
||||
if (!yon_char_is_empty(target->lang_ab)){
|
||||
char *temp = strstr(target->lang_ab,"_");
|
||||
if (!yon_char_is_empty(temp)) temp[0]='\0';
|
||||
}
|
||||
if (!yon_char_is_empty(target->territory)){
|
||||
char *temp = yon_locale_unwrap(target->territory);
|
||||
free(target->territory);
|
||||
target->territory = yon_char_new(temp);
|
||||
}
|
||||
if (!yon_char_is_empty(target->language)){
|
||||
char *temp = yon_locale_unwrap(target->language);
|
||||
free(target->language);
|
||||
target->language = yon_char_new(temp);
|
||||
}
|
||||
if (!yon_char_is_empty(target->lang_name)){
|
||||
char *temp = yon_locale_unwrap(target->lang_name);
|
||||
free(target->lang_name);
|
||||
target->lang_name = yon_char_new(temp);
|
||||
}
|
||||
if (!yon_char_is_empty(target->title)){
|
||||
char *temp = yon_locale_unwrap(target->title);
|
||||
free(target->title);
|
||||
target->title = yon_char_new(temp);
|
||||
}
|
||||
// yon_char_parsed_free(locale_string,size);
|
||||
free(path);
|
||||
}
|
||||
|
||||
void yon_locale_init(){
|
||||
int size;
|
||||
config_str locales_list = yon_dir_get_contents(locales_path,&size);
|
||||
locales_hash_table = yon_hash_new(size*2,yon_str_hash);
|
||||
for (int i=0;i<size;i++){
|
||||
if (!strcmp(locales_list[i],".")||!strcmp(locales_list[i],"..")) continue;
|
||||
struct yon_locale *cur_locale = yon_lang_new();
|
||||
yon_locale_set(cur_locale,locales_list[i]);
|
||||
yon_hash_insert(locales_hash_table,yon_char_new(locales_list[i]),cur_locale);
|
||||
}
|
||||
yon_char_parsed_free(locales_list,size);
|
||||
}
|
||||
|
||||
config_str yon_locale_get_all_codes(int *size){
|
||||
(*size)=0;
|
||||
config_str final = NULL;
|
||||
for (int i=0;i<locales_hash_table->size;i++){
|
||||
if (locales_hash_table->data[i]){
|
||||
yon_hash_element *dict = NULL;
|
||||
for_dictionaries(dict,locales_hash_table->data[i]){
|
||||
yon_char_parsed_add_or_create_if_exists(final,size,dict->key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return final;
|
||||
}
|
||||
|
||||
char *yon_locale_get_parameter(char *code,enum YON_LOCALE_PARAMETER type){
|
||||
unsigned int hash = locales_hash_table->hash_func(code)%locales_hash_table->size;
|
||||
yon_hash_element *data = (yon_hash_element*)yon_dictionary_get((dictionary**)&locales_hash_table->data[hash],code);
|
||||
struct yon_locale *cur_locale = yon_dictionary_get_data(data,struct yon_locale*);
|
||||
switch(type){
|
||||
case YON_LOCALE_LANGUAGE:{
|
||||
return cur_locale->language;
|
||||
}break;
|
||||
case YON_LOCALE_LANG_NAME:{
|
||||
return cur_locale->lang_name;
|
||||
}break;
|
||||
case YON_LOCALE_TERRITORY:{
|
||||
return cur_locale->territory;
|
||||
}break;
|
||||
case YON_LOCALE_LANG_AB:{
|
||||
return cur_locale->lang_ab;
|
||||
}break;
|
||||
case YON_LOCALE_TITLE:{
|
||||
return cur_locale->title;
|
||||
}break;
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue