-
-static inline int LoadMessages (libvlc_int_t *p_libvlc)
-{
-#if defined( ENABLE_NLS ) \
- && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
- /* Specify where to find the locales for current domain */
-#if !defined( __APPLE__ ) && !defined( WIN32 ) && !defined( SYS_BEOS )
- static const char psz_path[] = LOCALEDIR;
-#else
- char *psz_datapath = config_GetDataDir (p_libvlc);
- char psz_path[1024];
- if (snprintf (psz_path, sizeof (psz_path), "%s" DIR_SEP "%s",
- psz_datapath, "locale")
- >= (int)sizeof (psz_path))
- {
- free (psz_datapath);
- return -1;
- }
- free (psz_datapath);
-
-#endif
- if (bindtextdomain (PACKAGE_NAME, psz_path) == NULL)
- {
- fprintf (stderr, "Warning: cannot bind text domain "PACKAGE_NAME
- " to directory %s\n", psz_path);
- return -1;
- }
-
- /* LibVLC wants all messages in UTF-8.
- * Unfortunately, we cannot ask UTF-8 for strerror_r(), strsignal_r()
- * and other functions that are not part of our text domain.
- */
- if (bind_textdomain_codeset (PACKAGE_NAME, "UTF-8") == NULL)
- {
- fprintf (stderr, "Error: cannot set Unicode encoding for text domain "
- PACKAGE_NAME"\n");
- // Unbinds the text domain to avoid broken encoding
- bindtextdomain (PACKAGE_NAME, "DOES_NOT_EXIST");
- return -1;
- }
-
- /* LibVLC does NOT set the default textdomain, since it is a library.
- * This could otherwise break programs using LibVLC (other than VLC).
- * textdomain (PACKAGE_NAME);
- */
-#endif
- return 0;
-}
-