[vlc-commits] Win32: take LANG value from --language and the HKCU value
Jean-Baptiste Kempf
git at videolan.org
Sat Sep 7 12:53:57 CEST 2013
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Sep 6 19:49:36 2013 +0200| [7439ce1970cbba613dddce797b75a383b448da2d] | committer: Jean-Baptiste Kempf
Win32: take LANG value from --language and the HKCU value
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7439ce1970cbba613dddce797b75a383b448da2d
---
bin/winvlc.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/bin/winvlc.c b/bin/winvlc.c
index 26c6386..22258b0 100644
--- a/bin/winvlc.c
+++ b/bin/winvlc.c
@@ -108,6 +108,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
char *argv[argc + 3];
BOOL crash_handling = TRUE;
int j = 0;
+ char *lang = NULL;
argv[j++] = FromWide( L"--media-library" );
argv[j++] = FromWide( L"--no-ignore-config" );
@@ -118,6 +119,12 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
crash_handling = FALSE;
continue; /* don't give argument to libvlc */
}
+ if (!wcsncmp(wargv[i], L"--language", 10) )
+ {
+ if (i < argc - 1 && wcsncmp( wargv[i + 1], L"--", 2 ))
+ lang = FromWide (wargv[++i]);
+ continue;
+ }
argv[j++] = FromWide (wargv[i]);
}
@@ -141,6 +148,30 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
_setmode( STDIN_FILENO, _O_BINARY ); /* Needed for pipes */
+ /* */
+ if (!lang)
+ {
+ HKEY h_key;
+ if( RegOpenKeyEx( HKEY_CURRENT_USER, TEXT("Software\\VideoLAN\\VLC\\"), 0, KEY_READ, &h_key )
+ == ERROR_SUCCESS )
+ {
+ TCHAR szData[256];
+ DWORD len = 256;
+ if( RegQueryValueEx( h_key, TEXT("Lang"), NULL, NULL, (LPBYTE) &szData, &len ) == ERROR_SUCCESS )
+ lang = FromWide( szData );
+ }
+ }
+
+ if (lang && strncmp( lang, "auto", 4 ) )
+ {
+ char *tmp;
+ if (asprintf(&tmp, "LANG=%s", lang) != -1 ) {
+ putenv(tmp);
+ free(tmp);
+ }
+ }
+ free(lang);
+
/* Initialize libvlc */
libvlc_instance_t *vlc;
vlc = libvlc_new (argc, (const char **)argv);
More information about the vlc-commits
mailing list