166 lines
6.2 KiB
Diff
166 lines
6.2 KiB
Diff
|
|
From 0d9fb9f2b3efbd5d4ba0c4d9640bdfdb2896c999 Mon Sep 17 00:00:00 2001
|
||
|
|
From: cui-gaoleng <562344211@qq.com>
|
||
|
|
Date: Fri, 8 Nov 2024 01:14:31 +0800
|
||
|
|
Subject: [PATCH 2/4] =?UTF-8?q?libcalamares=E6=96=87=E4=BB=B6=E5=A4=B9?=
|
||
|
|
MIME-Version: 1.0
|
||
|
|
Content-Type: text/plain; charset=UTF-8
|
||
|
|
Content-Transfer-Encoding: 8bit
|
||
|
|
|
||
|
|
---
|
||
|
|
src/libcalamares/CalamaresAbout.cpp | 15 ++++++-----
|
||
|
|
src/libcalamares/locale/TimeZone.cpp | 33 ++++++++++++++++++++++++-
|
||
|
|
src/libcalamares/locale/Translation.cpp | 14 ++++++++---
|
||
|
|
3 files changed, 49 insertions(+), 13 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/libcalamares/CalamaresAbout.cpp b/src/libcalamares/CalamaresAbout.cpp
|
||
|
|
index 4ff4435..65a1b9d 100644
|
||
|
|
--- a/src/libcalamares/CalamaresAbout.cpp
|
||
|
|
+++ b/src/libcalamares/CalamaresAbout.cpp
|
||
|
|
@@ -14,13 +14,11 @@
|
||
|
|
#include <QCoreApplication>
|
||
|
|
|
||
|
|
static const char s_header[]
|
||
|
|
- = QT_TRANSLATE_NOOP( "AboutData", "<h1>%1</h1><br/><strong>%2<br/> for %3</strong><br/><br/>" );
|
||
|
|
+ = QT_TRANSLATE_NOOP( "AboutData", "<br/><h2>Release:%1</h2><br/>" );
|
||
|
|
|
||
|
|
static const char s_footer[]
|
||
|
|
= QT_TRANSLATE_NOOP( "AboutData",
|
||
|
|
- "Thanks to <a href=\"https://calamares.io/team/\">the Calamares team</a> "
|
||
|
|
- "and the <a href=\"https://app.transifex.com/calamares/calamares/\">Calamares "
|
||
|
|
- "translators team</a>." );
|
||
|
|
+ "<strong>Thanks to the openEuler team.</strong>");
|
||
|
|
|
||
|
|
struct Maintainer
|
||
|
|
{
|
||
|
|
@@ -40,9 +38,9 @@ struct Maintainer
|
||
|
|
};
|
||
|
|
|
||
|
|
static constexpr const Maintainer maintainers[] = {
|
||
|
|
- { 2014, 2017, "Teo Mrnjavac", "teo@kde.org" },
|
||
|
|
- { 2017, 2022, "Adriaan de Groot", "groot@kde.org" },
|
||
|
|
- { 2022, 2024, "Adriaan de Groot (community)", "groot@kde.org" },
|
||
|
|
+ // { 2014, 2017, "Teo Mrnjavac", "teo@kde.org" },
|
||
|
|
+ // { 2017, 2022, "Adriaan de Groot", "groot@kde.org" },
|
||
|
|
+ // { 2022, 2024, "Adriaan de Groot (community)", "groot@kde.org" },
|
||
|
|
};
|
||
|
|
|
||
|
|
static QString
|
||
|
|
@@ -59,7 +57,7 @@ aboutMaintainers()
|
||
|
|
static QString
|
||
|
|
substituteVersions( const QString& s )
|
||
|
|
{
|
||
|
|
- return s.arg( CALAMARES_APPLICATION_NAME ).arg( CALAMARES_VERSION );
|
||
|
|
+ return s.arg( "openEuler-24.09" ).arg("");
|
||
|
|
}
|
||
|
|
|
||
|
|
const QString
|
||
|
|
@@ -67,6 +65,7 @@ Calamares::aboutString()
|
||
|
|
{
|
||
|
|
return substituteVersions( QCoreApplication::translate( "AboutData", s_header ) ) + aboutMaintainers()
|
||
|
|
+ QCoreApplication::translate( "AboutData", s_footer );
|
||
|
|
+ // return aboutMaintainers()+ QCoreApplication::translate( "AboutData", s_footer );
|
||
|
|
}
|
||
|
|
|
||
|
|
const QString
|
||
|
|
diff --git a/src/libcalamares/locale/TimeZone.cpp b/src/libcalamares/locale/TimeZone.cpp
|
||
|
|
index 0115618..8ad2525 100644
|
||
|
|
--- a/src/libcalamares/locale/TimeZone.cpp
|
||
|
|
+++ b/src/libcalamares/locale/TimeZone.cpp
|
||
|
|
@@ -20,6 +20,17 @@
|
||
|
|
|
||
|
|
static const char TZ_DATA_FILE[] = "/usr/share/zoneinfo/zone.tab";
|
||
|
|
|
||
|
|
+static const QVector<QString> ASIA_ZONE_FILER = {
|
||
|
|
+ "Beijing",
|
||
|
|
+ "Shanghai",
|
||
|
|
+ "Urumqi",
|
||
|
|
+ "Hong_Kong",
|
||
|
|
+ "Taipei",
|
||
|
|
+ "Singapore",
|
||
|
|
+ "Vientiane",
|
||
|
|
+ "Tokyo"
|
||
|
|
+};
|
||
|
|
+
|
||
|
|
namespace Calamares
|
||
|
|
{
|
||
|
|
namespace Locale
|
||
|
|
@@ -96,6 +107,15 @@ RegionData::translated() const
|
||
|
|
return QObject::tr( m_human, "tz_regions" );
|
||
|
|
}
|
||
|
|
|
||
|
|
+bool containsQString(const QVector<QString>& vec, const QString& str) {
|
||
|
|
+ for (const QString& item : vec) {
|
||
|
|
+ if (item == str) {
|
||
|
|
+ return true;
|
||
|
|
+ }
|
||
|
|
+ }
|
||
|
|
+ return false;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
static void
|
||
|
|
loadTZData( RegionVector& regions, ZoneVector& zones, QTextStream& in )
|
||
|
|
{
|
||
|
|
@@ -137,6 +157,12 @@ loadTZData( RegionVector& regions, ZoneVector& zones, QTextStream& in )
|
||
|
|
{
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
+ // NOTE: Taking into account ease of use, filtering zone in Asia.
|
||
|
|
+ if (region == "Asia") {
|
||
|
|
+ if (!containsQString(ASIA_ZONE_FILER, zone)) {
|
||
|
|
+ continue;
|
||
|
|
+ }
|
||
|
|
+ }
|
||
|
|
|
||
|
|
QString position = list.at( 1 );
|
||
|
|
int cooSplitPos = position.indexOf( QRegularExpression( "[-+]" ), 1 );
|
||
|
|
@@ -166,7 +192,12 @@ loadTZData( RegionVector& regions, ZoneVector& zones, QTextStream& in )
|
||
|
|
{
|
||
|
|
regions.append( new RegionData( region ) );
|
||
|
|
}
|
||
|
|
- zones.append( new TimeZoneData( region, zone, countryCode, latitude, longitude ) );
|
||
|
|
+ QString adjustedZone = zone;
|
||
|
|
+ if(zone == "Hong_Kong" || zone == "Taipei" || zone == "Macau")
|
||
|
|
+ {
|
||
|
|
+ adjustedZone += "(China)";
|
||
|
|
+ }
|
||
|
|
+ zones.append( new TimeZoneData( region, adjustedZone, countryCode, latitude, longitude ) );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
diff --git a/src/libcalamares/locale/Translation.cpp b/src/libcalamares/locale/Translation.cpp
|
||
|
|
index 49e4c05..e5b3402 100644
|
||
|
|
--- a/src/libcalamares/locale/Translation.cpp
|
||
|
|
+++ b/src/libcalamares/locale/Translation.cpp
|
||
|
|
@@ -167,8 +167,8 @@ Translation::Translation( const Id& localeId, LabelFormat format, QObject* paren
|
||
|
|
[ &localeId ]( const TranslationSpecialCase& s ) { return localeId.name == s.id; } );
|
||
|
|
const char* name = ( it != std::cend( special_cases ) ) ? it->name : nullptr;
|
||
|
|
|
||
|
|
- QString longFormat = QObject::tr( "%1 (%2)" );
|
||
|
|
-
|
||
|
|
+ // QString longFormat = QObject::tr( "%1 (%2)" );
|
||
|
|
+ QString longFormat = QObject::tr( "%1" );
|
||
|
|
QString languageName = name ? QString::fromUtf8( name ) : m_locale.nativeLanguageName();
|
||
|
|
QString englishName = m_locale.languageToString( m_locale.language() );
|
||
|
|
|
||
|
|
@@ -181,9 +181,15 @@ Translation::Translation( const Id& localeId, LabelFormat format, QObject* paren
|
||
|
|
|| ( !name && localeId.name.contains( '_' )
|
||
|
|
&& QLocale::countriesForLanguage( m_locale.language() ).count() > 1 );
|
||
|
|
QString countryName = needsCountryName ? m_locale.nativeCountryName() : QString();
|
||
|
|
+ if (countryName == "台灣") {
|
||
|
|
+ countryName = "中國台灣";
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
+ // m_label = needsCountryName ? longFormat.arg( languageName, countryName ) : languageName;
|
||
|
|
m_label = needsCountryName ? longFormat.arg( languageName, countryName ) : languageName;
|
||
|
|
- m_englishLabel = needsCountryName ? longFormat.arg( englishName, QLocale::countryToString( m_locale.country() ) )
|
||
|
|
- : englishName;
|
||
|
|
+ // m_englishLabel = needsCountryName ? longFormat.arg( englishName, QLocale::countryToString( m_locale.country() ) )
|
||
|
|
+ // : englishName;
|
||
|
|
+ m_englishLabel = englishName;
|
||
|
|
}
|
||
|
|
|
||
|
|
QLocale
|
||
|
|
--
|
||
|
|
2.43.0
|
||
|
|
|