Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
4f6d4ba0
Commit
4f6d4ba0
authored
Mar 06, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup text domain binding, and do not do it twice.
More fixes to come
parent
e5bd9ad9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
18 deletions
+45
-18
src/libvlc-common.c
src/libvlc-common.c
+45
-18
No files found.
src/libvlc-common.c
View file @
4f6d4ba0
...
@@ -104,6 +104,7 @@ static volatile unsigned int i_instances = 0;
...
@@ -104,6 +104,7 @@ static volatile unsigned int i_instances = 0;
void
LocaleInit
(
vlc_object_t
*
);
void
LocaleInit
(
vlc_object_t
*
);
void
LocaleDeinit
(
void
);
void
LocaleDeinit
(
void
);
static
void
SetLanguage
(
char
const
*
);
static
void
SetLanguage
(
char
const
*
);
static
inline
int
LoadMessages
(
void
);
static
int
GetFilenames
(
libvlc_int_t
*
,
int
,
char
*
[]
);
static
int
GetFilenames
(
libvlc_int_t
*
,
int
,
char
*
[]
);
static
void
Help
(
libvlc_int_t
*
,
char
const
*
psz_help_name
);
static
void
Help
(
libvlc_int_t
*
,
char
const
*
psz_help_name
);
static
void
Usage
(
libvlc_int_t
*
,
char
const
*
psz_module_name
);
static
void
Usage
(
libvlc_int_t
*
,
char
const
*
psz_module_name
);
...
@@ -271,6 +272,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, char *ppsz_argv[] )
...
@@ -271,6 +272,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, char *ppsz_argv[] )
* Support for gettext
* Support for gettext
*/
*/
SetLanguage
(
""
);
SetLanguage
(
""
);
LoadMessages
();
/*
/*
* Global iconv, must be done after setlocale()
* Global iconv, must be done after setlocale()
...
@@ -1135,22 +1137,20 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc,
...
@@ -1135,22 +1137,20 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc,
*****************************************************************************/
*****************************************************************************/
static
void
SetLanguage
(
char
const
*
psz_lang
)
static
void
SetLanguage
(
char
const
*
psz_lang
)
{
{
if
(
psz_lang
==
NULL
)
return
;
#if defined( ENABLE_NLS ) \
#if defined( ENABLE_NLS ) \
&& ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
&& ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
const
char
*
psz_path
=
NULL
;
if
(
!*
psz_lang
)
#if defined( __APPLE__ ) || defined ( WIN32 ) || defined( SYS_BEOS )
char
psz_tmp
[
1024
];
#endif
if
(
psz_lang
&&
!*
psz_lang
)
{
{
# if defined( HAVE_LC_MESSAGES )
# if defined( HAVE_LC_MESSAGES )
setlocale
(
LC_MESSAGES
,
psz_lang
);
setlocale
(
LC_MESSAGES
,
""
);
# endif
# endif
setlocale
(
LC_CTYPE
,
psz_lang
);
setlocale
(
LC_CTYPE
,
""
);
}
}
else
if
(
psz_lang
)
else
{
{
#ifdef __APPLE__
#ifdef __APPLE__
/* I need that under Darwin, please check it doesn't disturb
/* I need that under Darwin, please check it doesn't disturb
...
@@ -1170,24 +1170,51 @@ static void SetLanguage ( char const *psz_lang )
...
@@ -1170,24 +1170,51 @@ static void SetLanguage ( char const *psz_lang )
setlocale
(
LC_ALL
,
psz_lang
);
setlocale
(
LC_ALL
,
psz_lang
);
}
}
#endif
}
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 */
/* Specify where to find the locales for current domain */
#if !defined( __APPLE__ ) && !defined( WIN32 ) && !defined( SYS_BEOS )
#if !defined( __APPLE__ ) && !defined( WIN32 ) && !defined( SYS_BEOS )
psz_path
=
LOCALEDIR
;
static
const
char
psz_path
[]
=
LOCALEDIR
;
#else
#else
snprintf
(
psz_tmp
,
sizeof
(
psz_tmp
),
"%s/%s"
,
libvlc_global
.
psz_vlcpath
,
char
buf
[
1024
];
"locale"
);
if
(
snprintf
(
buf
,
sizeof
(
buf
),
"%s/%s"
,
libvlc_global
.
psz_vlcpath
,
psz_path
=
psz_tmp
;
"locale"
))
>=
sizeof
(
buf
)
return
-
1
;
const
char
*
psz_path
=
psz_tmp
;
#endif
#endif
if
(
!
bindtextdomain
(
PACKAGE_NAME
,
psz_path
)
)
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(), strsignal()
* and other functions that are not part of our text domain.
*/
if
(
bind_textdomain_codeset
(
PACKAGE_NAME
,
"UTF-8"
)
==
NULL
)
{
{
fprintf
(
stderr
,
"warning: couldn't bind domain %s in directory %s
\n
"
,
fprintf
(
stderr
,
"Error: cannot set Unicode encoding for text domain "
PACKAGE_NAME
,
psz_path
);
PACKAGE_NAME
"
\n
"
);
// Unbinds the text domain to avoid broken encoding
bindtextdomain
(
PACKAGE_NAME
,
"DOES_NOT_EXIST"
);
return
-
1
;
}
}
/* Set the default domain */
/* LibVLC does NOT set the default textdomain, since it is a library.
bind_textdomain_codeset
(
PACKAGE_NAME
,
"UTF-8"
);
* This could otherwise break programs using LibVLC (other than VLC).
* textdomain (PACKAGE_NAME);
*/
#endif
#endif
return
0
;
}
}
/*****************************************************************************
/*****************************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment