Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
37bc4006
Commit
37bc4006
authored
Jan 06, 2010
by
Hugo Beauzee-Luyssen
Browse files
Generating translation list at runtime
parent
a5f1f960
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Gui/LanguagePreferences.cpp
View file @
37bc4006
...
...
@@ -26,19 +26,35 @@
#include
"LanguagePreferences.h"
#include
"ui_LanguagePreferences.h"
#include
<QDir>
QTranslator
*
LanguagePreferences
::
m_currentLang
=
NULL
;
LanguagePreferences
::
LanguagePreferences
(
QWidget
*
parent
)
:
PreferenceWidget
(
parent
)
{
m_ui
.
setupUi
(
this
);
m_ui
.
comboBoxLanguage
->
addItem
(
tr
(
"Czech"
),
"cs"
);
m_ui
.
comboBoxLanguage
->
addItem
(
tr
(
"English"
),
"en"
);
m_ui
.
comboBoxLanguage
->
addItem
(
tr
(
"French"
),
"fr"
);
m_ui
.
comboBoxLanguage
->
addItem
(
tr
(
"Japanese"
),
"jp"
);
m_ui
.
comboBoxLanguage
->
addItem
(
tr
(
"Spanish"
),
"es"
);
m_ui
.
comboBoxLanguage
->
addItem
(
tr
(
"Swedish"
),
"sv"
);
m_ui
.
comboBoxLanguage
->
addItem
(
tr
(
"Brazilian Portugese"
),
"pt_BR"
);
QDir
dir
(
"ts/"
,
"*.ts"
,
QDir
::
Name
|
QDir
::
IgnoreCase
,
QDir
::
Files
);
QStringList
tss
=
dir
.
entryList
();
foreach
(
const
QString
&
tsFileName
,
tss
)
{
QString
localeStr
;
int
localePos
=
tsFileName
.
lastIndexOf
(
"vlmc_"
);
int
dotPos
=
tsFileName
.
lastIndexOf
(
".ts"
);
if
(
localePos
<
0
||
dotPos
<
0
)
{
qWarning
()
<<
"Invalid translation file:"
<<
tsFileName
;
continue
;
}
localePos
+=
5
;
localeStr
=
tsFileName
.
mid
(
localePos
,
dotPos
-
localePos
);
QLocale
locale
(
localeStr
);
m_ui
.
comboBoxLanguage
->
addItem
(
QLocale
::
countryToString
(
locale
.
country
()
)
+
" / "
+
QLocale
::
languageToString
(
locale
.
language
()
),
localeStr
);
}
m_ui
.
comboBoxLanguage
->
addItem
(
"UnitedStates / English"
,
"en"
);
}
LanguagePreferences
::~
LanguagePreferences
()
{}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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