Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
1dbc30f6
Commit
1dbc30f6
authored
Jan 17, 2010
by
Ludovic Fauvet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load the translations from the resources.
parent
ea7d408e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
src/Gui/LanguagePreferences.cpp
src/Gui/LanguagePreferences.cpp
+7
-8
src/Gui/LanguagePreferences.h
src/Gui/LanguagePreferences.h
+2
-0
No files found.
src/Gui/LanguagePreferences.cpp
View file @
1dbc30f6
...
...
@@ -35,14 +35,14 @@ LanguagePreferences::LanguagePreferences( QWidget *parent )
{
m_ui
.
setupUi
(
this
);
QDir
dir
(
TS_DIR
,
"*.qm"
,
QDir
::
Name
|
QDir
::
IgnoreCase
,
QDir
::
Files
);
QDir
dir
(
":/ts/"
,
"*.qm"
,
QDir
::
Name
|
QDir
::
IgnoreCase
,
QDir
::
Files
);
QStringList
tss
=
dir
.
entryList
();
m_ui
.
comboBoxLanguage
->
setInsertPolicy
(
QComboBox
::
InsertAlphabetically
);
foreach
(
const
QString
&
tsFileName
,
tss
)
{
QString
localeStr
;
int
localePos
=
tsFileName
.
lastIndexOf
(
"vlmc_"
);
int
localePos
=
tsFileName
.
lastIndexOf
(
TS_PREFIX
);
int
dotPos
=
tsFileName
.
lastIndexOf
(
".qm"
);
if
(
localePos
<
0
||
dotPos
<
0
)
{
...
...
@@ -52,12 +52,11 @@ LanguagePreferences::LanguagePreferences( QWidget *parent )
localePos
+=
5
;
localeStr
=
tsFileName
.
mid
(
localePos
,
dotPos
-
localePos
);
QLocale
locale
(
localeStr
);
qDebug
()
<<
"Adding new language:"
<<
QLocale
::
countryToString
(
locale
.
country
()
)
<<
'/'
<<
QLocale
::
languageToString
(
locale
.
language
()
)
<<
"with locale"
<<
localeStr
;
m_ui
.
comboBoxLanguage
->
addItem
(
QLocale
::
countryToString
(
locale
.
country
()
)
+
" / "
+
QLocale
::
languageToString
(
locale
.
language
()
),
localeStr
);
m_ui
.
comboBoxLanguage
->
addItem
(
QString
(
"%1 (%2)"
).
arg
(
QLocale
::
languageToString
(
locale
.
language
()
),
QLocale
::
countryToString
(
locale
.
country
()
)
),
localeStr
);
}
m_ui
.
comboBoxLanguage
->
addItem
(
"UnitedStates
/ English
"
,
"en_US"
);
m_ui
.
comboBoxLanguage
->
addItem
(
"
English (
UnitedStates
)
"
,
"en_US"
);
}
LanguagePreferences
::~
LanguagePreferences
()
{}
...
...
@@ -94,7 +93,7 @@ void LanguagePreferences::changeLang( QString langValue )
if
(
!
langValue
.
isEmpty
()
)
{
m_currentLang
=
new
QTranslator
();
m_currentLang
->
load
(
langValue
,
":/
Lang
/"
);
m_currentLang
->
load
(
TS_PREFIX
+
langValue
,
":/
ts
/"
);
qApp
->
installTranslator
(
m_currentLang
);
}
}
...
...
src/Gui/LanguagePreferences.h
View file @
1dbc30f6
...
...
@@ -29,6 +29,8 @@
#include "PreferenceWidget.h"
#include "ui_LanguagePreferences.h"
#define TS_PREFIX "vlmc_"
class
LanguagePreferences
:
public
PreferenceWidget
{
Q_OBJECT
...
...
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