[Scummvm-git-logs] scummvm master -> 7851cabc19306c8b749e7200c1369a013fe60a0b

sev- sev at scummvm.org
Wed Sep 2 10:08:55 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9fcc83c09d COMMON: Add comparison operators to U32String
927127abd5 I18N: Support having unicode characters in language names
7851cabc19 I18N: Update language names


Commit: 9fcc83c09d0ae08cc29ea024575ce78f44fda0f5
    https://github.com/scummvm/scummvm/commit/9fcc83c09d0ae08cc29ea024575ce78f44fda0f5
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-09-02T12:08:49+02:00

Commit Message:
COMMON: Add comparison operators to U32String

Those operators just compare the numerical value of each character
one by one. This is not idea, but this is better than nothing.

Changed paths:
    common/ustr.cpp
    common/ustr.h


diff --git a/common/ustr.cpp b/common/ustr.cpp
index 4427239d5d..18e3957520 100644
--- a/common/ustr.cpp
+++ b/common/ustr.cpp
@@ -198,6 +198,34 @@ bool U32String::operator!=(const char *x) const {
 	return !equals(x);
 }
 
+bool U32String::operator<(const String &x) const {
+	for (int i = 0 ; i < _size && i < x.size() ; ++i) {
+		if (_str[i] < x[i])
+			return true;
+		else if (_str[i] > x[i])
+			return false;
+	}
+	return (_size < x.size());
+}
+
+bool U32String::operator<=(const String &x) const {
+	return !operator>(x);
+}
+
+bool U32String::operator>(const String &x) const {
+	for (int i = 0 ; i < _size && i < x.size() ; ++i) {
+		if (_str[i] > x[i])
+			return true;
+		else if (_str[i] < x[i])
+			return false;
+	}
+	return (_size > x.size());
+}
+
+bool U32String::operator>=(const String &x) const {
+	return !operator<(x);
+}
+
 bool U32String::equals(const U32String &x) const {
 	if (this == &x || _str == x._str) {
 		return true;
diff --git a/common/ustr.h b/common/ustr.h
index 9fc3cb1da1..3e544f0c44 100644
--- a/common/ustr.h
+++ b/common/ustr.h
@@ -136,6 +136,11 @@ public:
 	bool operator!=(const value_type *x) const;
 	bool operator!=(const char *x) const;
 
+	bool operator<(const String &x) const;
+	bool operator<=(const String &x) const;
+	bool operator>(const String &x) const;
+	bool operator>=(const String &x) const;
+
 	/**
 	 * Compares whether two U32String are the same based on memory comparison.
 	 * This does *not* do comparison based on canonical equivalence.


Commit: 927127abd525fce1c97806682e0427f298afb83e
    https://github.com/scummvm/scummvm/commit/927127abd525fce1c97806682e0427f298afb83e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-09-02T12:08:49+02:00

Commit Message:
I18N: Support having unicode characters in language names

Changed paths:
    common/translation.cpp
    common/translation.h


diff --git a/common/translation.cpp b/common/translation.cpp
index 43692c9ab0..f4496739da 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -42,7 +42,7 @@ namespace Common {
 DECLARE_SINGLETON(TranslationManager);
 
 bool operator<(const TLanguage &l, const TLanguage &r) {
-	return strcmp(l.name, r.name) < 0;
+	return l.name < r.name;
 }
 
 TranslationManager::TranslationManager() : _currentLang(-1) {
@@ -188,7 +188,7 @@ const TLangArray TranslationManager::getSupportedLanguageNames() const {
 	TLangArray languages;
 
 	for (unsigned int i = 0; i < _langNames.size(); i++) {
-		TLanguage lng(_langNames[i].c_str(), i + 1);
+		TLanguage lng(_langNames[i], i + 1);
 		languages.push_back(lng);
 	}
 
@@ -306,7 +306,7 @@ void TranslationManager::loadTranslationsInfoDat() {
 		_langs[i] = String(buf, len - 1);
 		len = in.readUint16BE();
 		in.read(buf, len);
-		_langNames[i] = String(buf, len - 1);
+		_langNames[i] = String(buf, len - 1).decode();
 	}
 
 	// Read messages
diff --git a/common/translation.h b/common/translation.h
index 059567abda..e910b36ac0 100644
--- a/common/translation.h
+++ b/common/translation.h
@@ -42,11 +42,11 @@ enum TranslationIDs {
 };
 
 struct TLanguage {
-	const char *name;
+	U32String name;
 	int id;
 
-	TLanguage() : name(nullptr), id(0) {}
-	TLanguage(const char *n, int i) : name(n), id(i) {}
+	TLanguage() : id(0) {}
+	TLanguage(const U32String &n, int i) : name(n), id(i) {}
 };
 
 bool operator<(const TLanguage &l, const TLanguage &r);
@@ -209,7 +209,7 @@ private:
 	bool checkHeader(File &in);
 
 	StringArray _langs;
-	StringArray _langNames;
+	U32StringArray _langNames;
 
 	StringArray _messageIds;
 	Array<PoMessageEntry> _currentTranslationMessages;


Commit: 7851cabc19306c8b749e7200c1369a013fe60a0b
    https://github.com/scummvm/scummvm/commit/7851cabc19306c8b749e7200c1369a013fe60a0b
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-09-02T12:08:49+02:00

Commit Message:
I18N: Update language names

We can now use non-ASCII characters in language names, so add
missing acccent and use native alphabet.

Changed paths:
    po/be_BY.po
    po/ca_ES.po
    po/cs_CZ.po
    po/el.po
    po/es_ES.po
    po/fr_FR.po
    po/he.po
    po/nb_NO.po
    po/pt_BR.po
    po/pt_PT.po
    po/ru_RU.po
    po/uk_UA.po


diff --git a/po/be_BY.po b/po/be_BY.po
index e0e81ca672..68d0f7a03b 100644
--- a/po/be_BY.po
+++ b/po/be_BY.po
@@ -18,7 +18,7 @@ msgstr ""
 "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
 "X-Generator: Weblate 4.0.4\n"
-"X-Language-name: Belarusian\n"
+"X-Language-name: Беларуская\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/ca_ES.po b/po/ca_ES.po
index 96bd040de1..403dbdb1e6 100644
--- a/po/ca_ES.po
+++ b/po/ca_ES.po
@@ -18,7 +18,7 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 "X-Generator: Weblate 4.0.4\n"
-"X-Language-name: Catalan\n"
+"X-Language-name: Català\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/cs_CZ.po b/po/cs_CZ.po
index 7613edbffd..c64b1b00bf 100644
--- a/po/cs_CZ.po
+++ b/po/cs_CZ.po
@@ -20,7 +20,7 @@ msgstr ""
 "X-Generator: Weblate 4.0.4\n"
 "X-Poedit-SourceCharset: iso-8859-2\n"
 "X-Poedit-Basepath: ..\n"
-"X-Language-name: Cesky\n"
+"X-Language-name: Český\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/el.po b/po/el.po
index 910fcfb868..3b0d9f50b3 100644
--- a/po/el.po
+++ b/po/el.po
@@ -17,7 +17,7 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 "X-Generator: Weblate 4.0.4\n"
-"X-Language-name: Greek\n"
+"X-Language-name: Ελληνικά\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/es_ES.po b/po/es_ES.po
index a9c70c9312..72e2b516c0 100644
--- a/po/es_ES.po
+++ b/po/es_ES.po
@@ -18,7 +18,7 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 "X-Generator: Weblate 4.0.4\n"
-"X-Language-name: Espanol\n"
+"X-Language-name: Español\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/fr_FR.po b/po/fr_FR.po
index a7de00953e..0bd4d6620e 100644
--- a/po/fr_FR.po
+++ b/po/fr_FR.po
@@ -18,7 +18,7 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n > 1;\n"
 "X-Generator: Weblate 4.0.4\n"
-"X-Language-name: Francais\n"
+"X-Language-name: Français\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/he.po b/po/he.po
index 1ac780377f..c38742ac3b 100644
--- a/po/he.po
+++ b/po/he.po
@@ -19,7 +19,7 @@ msgstr ""
 "Plural-Forms: nplurals=4; plural=(n == 1) ? 0 : ((n == 2) ? 1 : ((n > 10 && "
 "n % 10 == 0) ? 2 : 3));\n"
 "X-Generator: Weblate 4.0.4\n"
-"X-Language-name: Hebrew\n"
+"X-Language-name: תירבע\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/nb_NO.po b/po/nb_NO.po
index 6e20a4efb2..c42fbe2e66 100644
--- a/po/nb_NO.po
+++ b/po/nb_NO.po
@@ -19,7 +19,7 @@ msgstr ""
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 "X-Generator: Weblate 4.0.4\n"
 "X-Poedit-SourceCharset: iso-8859-1\n"
-"X-Language-name: Norsk (bokmaal)\n"
+"X-Language-name: Norsk (bokmål)\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 9d75acb768..842e42726c 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgstr ""
 "X-Poedit-Language: Portuguese\n"
 "X-Poedit-Country: BRAZIL\n"
 "X-Poedit-SourceCharset: iso-8859-1\n"
-"X-Language-name: Portugues (Brasil)\n"
+"X-Language-name: Português (Brasil)\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/pt_PT.po b/po/pt_PT.po
index 7ab83b4c32..6e9ba929be 100644
--- a/po/pt_PT.po
+++ b/po/pt_PT.po
@@ -18,7 +18,7 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 "X-Generator: Weblate 4.0.4\n"
-"X-Language-name: Portugues (Portugal)\n"
+"X-Language-name: Português (Portugal)\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/ru_RU.po b/po/ru_RU.po
index f3e48badea..b8226dcd92 100644
--- a/po/ru_RU.po
+++ b/po/ru_RU.po
@@ -18,7 +18,7 @@ msgstr ""
 "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
 "X-Generator: Weblate 4.0.4\n"
-"X-Language-name: Russian\n"
+"X-Language-name: Русский\n"
 
 #: gui/about.cpp:102
 #, c-format
diff --git a/po/uk_UA.po b/po/uk_UA.po
index fb01c0f133..ad6fe6f3a7 100644
--- a/po/uk_UA.po
+++ b/po/uk_UA.po
@@ -20,7 +20,7 @@ msgstr ""
 "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
 "X-Generator: Weblate 4.0.4\n"
-"X-Language-name: Ukrainian\n"
+"X-Language-name: Українська\n"
 
 #: gui/about.cpp:102
 #, c-format




More information about the Scummvm-git-logs mailing list