-
-static inline int LoadMessages (void)
-{
-#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_path[1024];
- char *datadir = config_GetDataDirDefault();
- int ret;
-
- if (unlikely(datadir == NULL))
- return -1;
- ret = snprintf (psz_path, sizeof (psz_path), "%s" DIR_SEP "locale",
- datadir);
- free (datadir);
- if (ret >= (int)sizeof (psz_path))
- return -1;
-#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;
-}
-