diff --git a/Makefile b/Makefile index 4b944b8..6b1c3ca 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,13 @@ install: check @if [ -z ${DESTDIR} ]; then \ ldconfig -n ${DESTDIR}${PREFIX}/lib; \ fi + @for LANG in $$(find ./locale -iname "*.po" -print | sed -En "s/.+_([[:alpha:]]+)\.po/\1/p" | sort -u); do \ + install -dm755 "${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES"; \ +# PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/${PKGNAME}.mo"; \ + PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/${PKGNAME}.mo"; \ + PKGNAME_PO="./locale/${PKGNAME}_$${LANG}.po"; [[ -f "$${PKGNAME_PO}" ]] || PKGNAME_PO= ; \ + msgfmt --verbose --use-fuzzy --output-file "$${PATH_FILE_MO}" - < <(msgcat --use-first --no-wrap $${PKGNAME_PO} ./locale/*_$${LANG}.po); \ + done @echo "Install: OK" clean: diff --git a/source/libublsettings-locale.c b/source/libublsettings-locale.c index 22404a8..befb2d2 100644 --- a/source/libublsettings-locale.c +++ b/source/libublsettings-locale.c @@ -39,7 +39,7 @@ void yon_locale_set(struct yon_locale *target,char *locale_name){ 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)){ - yon_char_divide_search_self(target->code,"_",-1); + yon_char_divide_search_self(target->lang_ab,"_",-1); } if (!yon_char_is_empty(target->territory)){ char *temp = yon_locale_unwrap(target->territory); diff --git a/source/libublsettings.h b/source/libublsettings.h index b5205be..1fc96a4 100644 --- a/source/libublsettings.h +++ b/source/libublsettings.h @@ -1098,6 +1098,8 @@ void yon_launch(char *command); // void *yon_malloc(int size, char *group_key); +#define LOCALES_DOMAIN_NAME "libublsettings" + enum YON_LOCALE_PARAMETER{ YON_LOCALE_LANGUAGE, YON_LOCALE_LANG_NAME,