Browse Source

Rename Chinese translation files. Closes #2936.

adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
fb7ba92f69
  1. 14
      src/app/application.cpp
  2. 16
      src/gui/options_imp.cpp
  3. 4
      src/lang.qrc
  4. 2
      src/lang/qbittorrent_zh_Hans.ts
  5. 2
      src/lang/qbittorrent_zh_Hant.ts
  6. 4
      src/src.pro
  7. 4
      src/webui/www/public/preferences_content.html

14
src/app/application.cpp

@ -337,8 +337,20 @@ void Application::initializeTranslation() @@ -337,8 +337,20 @@ void Application::initializeTranslation()
Preferences* const pref = Preferences::instance();
// Load translation
QString locale = pref->getLocale();
if (locale.isEmpty()) {
locale = QLocale::system().name();
QLocale systemLocale = QLocale::system();
// Check if Chinese and act according to script instead of country
if (systemLocale.language() == QLocale::Chinese) {
if (systemLocale.script() == QLocale::SimplifiedHanScript)
locale = "zh_Hans";
else
locale = "zh_Hant";
}
else {
locale = systemLocale.name();
}
pref->setLocale(locale);
}

16
src/gui/options_imp.cpp

@ -1075,7 +1075,19 @@ QString options_imp::getLocale() const { @@ -1075,7 +1075,19 @@ QString options_imp::getLocale() const {
void options_imp::setLocale(const QString &localeStr) {
QLocale locale(localeStr);
QString name = locale.name();
QString name;
// Check if Chinese and act according to script instead of country
if (locale.language() == QLocale::Chinese) {
if (locale.script() == QLocale::SimplifiedHanScript)
name = "zh_Hans";
else
name = "zh_Hant";
}
else {
name = locale.name();
}
// Attempt to find exact match
int index = comboI18n->findData(name, Qt::UserRole);
if (index < 0 ) {
@ -1360,7 +1372,7 @@ QString options_imp::languageToLocalizedString(const QLocale &locale) @@ -1360,7 +1372,7 @@ QString options_imp::languageToLocalizedString(const QLocale &locale)
case QLocale::Basque: return QString::fromUtf8("Euskara");
case QLocale::Vietnamese: return QString::fromUtf8("tiếng Việt");
case QLocale::Chinese: {
if (locale.country() == QLocale::China)
if (locale.script() == QLocale::SimplifiedHanScript)
return QString::fromUtf8("中文 (简体)");
return QString::fromUtf8("中文 (繁體)");
}

4
src/lang.qrc

@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
<file>lang/qbittorrent_tr.qm</file>
<file>lang/qbittorrent_uk.qm</file>
<file>lang/qbittorrent_vi.qm</file>
<file>lang/qbittorrent_zh.qm</file>
<file>lang/qbittorrent_zh_TW.qm</file>
<file>lang/qbittorrent_zh_Hans.qm</file>
<file>lang/qbittorrent_zh_Hant.qm</file>
</qresource>
</RCC>

2
src/lang/qbittorrent_zh.ts → src/lang/qbittorrent_zh_Hans.ts

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="zh">
<TS version="2.0" language="zh-Hans">
<context>
<name>AboutDlg</name>
<message>

2
src/lang/qbittorrent_zh_TW.ts → src/lang/qbittorrent_zh_Hant.ts

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="zh_TW">
<TS version="2.0" language="zh-Hant">
<context>
<name>AboutDlg</name>
<message>

4
src/src.pro

@ -75,8 +75,8 @@ RESOURCES += \ @@ -75,8 +75,8 @@ RESOURCES += \
# Translations
TRANSLATIONS = \
$$LANG_PATH/qbittorrent_fr.ts \
$$LANG_PATH/qbittorrent_zh.ts \
$$LANG_PATH/qbittorrent_zh_TW.ts \
$$LANG_PATH/qbittorrent_zh_Hans.ts \
$$LANG_PATH/qbittorrent_zh_Hant.ts \
$$LANG_PATH/qbittorrent_en.ts \
$$LANG_PATH/qbittorrent_en_AU.ts \
$$LANG_PATH/qbittorrent_en_GB.ts \

4
src/webui/www/public/preferences_content.html

@ -316,8 +316,8 @@ @@ -316,8 +316,8 @@
<option value="be_BY">Беларуская</option>
<option value="eu_ES">Euskara</option>
<option value="vi_VN">tiếng Việt</option>
<option value="zh_CN">中文 (简体)</option>
<option value="zh_TW">中文 (繁體)</option>
<option value="zh_Hans">中文 (简体)</option>
<option value="zh_Hant">中文 (繁體)</option>
<option value="ko_KR">한글</option>
</select>
</fieldset>

Loading…
Cancel
Save