Browse Source

Partially revert fb7ba92f6 and split the Chinese locales into 3.

Chinese Simplified, Chinese Traditional(Taiwan), Chinese Traditional(Hong Kong).
Closes #3262.
adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
61705fdd42
  1. 13
      src/app/application.cpp
  2. 5
      src/core/unicodestrings.h
  3. 26
      src/gui/options_imp.cpp
  4. 5
      src/lang.qrc
  5. 2
      src/lang/qbittorrent_zh.ts
  6. 2
      src/lang/qbittorrent_zh_HK.ts
  7. 6512
      src/lang/qbittorrent_zh_TW.ts
  8. 5
      src/src.pro
  9. 5
      src/webui/www/public/preferences_content.html

13
src/app/application.cpp

@ -339,18 +339,7 @@ void Application::initializeTranslation() @@ -339,18 +339,7 @@ void Application::initializeTranslation()
QString locale = pref->getLocale();
if (locale.isEmpty()) {
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();
}
locale = QLocale::system().name();
pref->setLocale(locale);
}

5
src/core/unicodestrings.h

@ -77,6 +77,7 @@ const char C_LOCALE_GEORGIAN[] = "ქართული"; @@ -77,6 +77,7 @@ const char C_LOCALE_GEORGIAN[] = "ქართული";
const char C_LOCALE_BYELORUSSIAN[] = "Беларуская";
const char C_LOCALE_BASQUE[] = "Euskara";
const char C_LOCALE_VIETNAMESE[] = "tiếng Việt";
const char C_LOCALE_CHINESE_TRADITIONAL[] = "中文 (繁體)";
const char C_LOCALE_CHINESE_SIMPLIFIED[] = "中文 (简体)";
const char C_LOCALE_CHINESE_TRADITIONAL_TW[] = "正體中文 (臺灣)";
const char C_LOCALE_CHINESE_TRADITIONAL_HK[] = "繁體中文 (香港)";
const char C_LOCALE_CHINESE_SIMPLIFIED[] = "简体中文";
const char C_LOCALE_KOREAN[] = "한글";

26
src/gui/options_imp.cpp

@ -1077,19 +1077,7 @@ QString options_imp::getLocale() const { @@ -1077,19 +1077,7 @@ QString options_imp::getLocale() const {
void options_imp::setLocale(const QString &localeStr) {
QLocale locale(localeStr);
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();
}
QString name = locale.name();
// Attempt to find exact match
int index = comboI18n->findData(name, Qt::UserRole);
if (index < 0 ) {
@ -1374,9 +1362,15 @@ QString options_imp::languageToLocalizedString(const QLocale &locale) @@ -1374,9 +1362,15 @@ QString options_imp::languageToLocalizedString(const QLocale &locale)
case QLocale::Basque: return QString::fromUtf8(C_LOCALE_BASQUE);
case QLocale::Vietnamese: return QString::fromUtf8(C_LOCALE_VIETNAMESE);
case QLocale::Chinese: {
if (locale.script() == QLocale::SimplifiedHanScript)
return QString::fromUtf8(C_LOCALE_CHINESE_SIMPLIFIED);
return QString::fromUtf8(C_LOCALE_CHINESE_TRADITIONAL);
switch(locale.country()) {
case QLocale::China:
return QString::fromUtf8(C_LOCALE_CHINESE_SIMPLIFIED);
case QLocale::HongKong:
return QString::fromUtf8(C_LOCALE_CHINESE_TRADITIONAL_HK);
default:
return QString::fromUtf8(C_LOCALE_CHINESE_TRADITIONAL_TW);
}
}
case QLocale::Korean: return QString::fromUtf8(C_LOCALE_KOREAN);
default: {

5
src/lang.qrc

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

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

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

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

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

6512
src/lang/qbittorrent_zh_TW.ts

File diff suppressed because it is too large Load Diff

5
src/src.pro

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

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

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

Loading…
Cancel
Save