provide file with locales and corresponding encodings

This commit is contained in:
Andrzej Rybczak
2009-03-20 20:33:35 +01:00
parent 23567ed4f1
commit b2317df843
7 changed files with 429 additions and 14 deletions

View File

@@ -20,7 +20,7 @@
#include "charset.h"
#if defined(SUPPORTED_LOCALES) && defined(HAVE_ICONV_H)
#ifdef HAVE_ICONV_H
#include <iconv.h>
#include <cstdlib>
@@ -96,10 +96,10 @@ void init_current_locale()
std::string envlocale = setlocale(LC_CTYPE, "");
if (envlocale.empty() || envlocale == "C")
return;
std::ifstream f(SUPPORTED_LOCALES);
std::ifstream f(ENCODINGS);
if (!f.is_open())
{
std::cerr << "ncmpcpp: cannot open file "SUPPORTED_LOCALES"!\n";
std::cerr << "ncmpcpp: cannot open file "ENCODINGS"!\n";
return;
}
envlocale += " ";
@@ -180,5 +180,5 @@ void str_pool_locale_to_utf(char *&s)
charset_convert(locale_charset, "utf8", s);
}
#endif // SUPPORTED_LOCALES && HAVE_ICONV_H
#endif // HAVE_ICONV_H

View File

@@ -25,7 +25,7 @@
#include <config.h>
#endif
#if defined(SUPPORTED_LOCALES) && defined(HAVE_ICONV_H)
#ifdef HAVE_ICONV_H
#include <string>
@@ -53,7 +53,7 @@ void str_pool_locale_to_utf(char *&);
#define str_pool_utf_to_locale(x);
#define str_pool_locale_to_utf(x);
#endif // SUPPORTED_LOCALES && HAVE_ICONV_H
#endif // HAVE_ICONV_H
#endif

View File

@@ -84,7 +84,7 @@ string Song::GetLength() const
void Song::Localize()
{
# if defined(SUPPORTED_LOCALES) && defined(HAVE_ICONV_H)
# ifdef HAVE_ICONV_H
if (isLocalised)
return;
str_pool_utf_to_locale(itsSong->file);
@@ -101,7 +101,7 @@ void Song::Localize()
str_pool_utf_to_locale(itsSong->disc);
str_pool_utf_to_locale(itsSong->comment);
isLocalised = 1;
# endif // SUPPORTED_LOCALES && HAVE_ICONV_H
# endif // HAVE_ICONV_H
}
void Song::Clear()