properly capitalize set types like Duel Deck and From the Vault (#3770)
* properly capitalize set types like Duel Deck and From the Vault * add more tiny words * update macos for travis (slower build times)
This commit is contained in:
parent
965a6cdde7
commit
f10f9ada3a
2 changed files with 15 additions and 1 deletions
|
@ -96,6 +96,7 @@ matrix:
|
||||||
- protobuf
|
- protobuf
|
||||||
- qt
|
- qt
|
||||||
- xz
|
- xz
|
||||||
|
update: true
|
||||||
script: bash ./.ci/travis-compile.sh --server --install --debug
|
script: bash ./.ci/travis-compile.sh --server --install --debug
|
||||||
|
|
||||||
- name: macOS (Release)
|
- name: macOS (Release)
|
||||||
|
|
|
@ -47,7 +47,20 @@ bool OracleImporter::readSetsFromByteArray(const QByteArray &data)
|
||||||
setType = map.value("type").toString();
|
setType = map.value("type").toString();
|
||||||
// capitalize set type
|
// capitalize set type
|
||||||
if (setType.length() > 0) {
|
if (setType.length() > 0) {
|
||||||
setType[0] = setType[0].toUpper();
|
// basic grammar for words that aren't capitalized, like in "From the Vault"
|
||||||
|
const QStringList noCapitalize = {"the", "a", "an", "on", "to", "for", "of", "in", "and", "with", "or"};
|
||||||
|
QStringList words = setType.split("_");
|
||||||
|
setType.clear();
|
||||||
|
bool first = false;
|
||||||
|
for (auto &item : words) {
|
||||||
|
if (first && noCapitalize.contains(item)) {
|
||||||
|
setType += item + QString(" ");
|
||||||
|
} else {
|
||||||
|
setType += item[0].toUpper() + item.mid(1, -1) + QString(" ");
|
||||||
|
first = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setType = setType.trimmed();
|
||||||
}
|
}
|
||||||
if (!nonEnglishSets.contains(shortName)) {
|
if (!nonEnglishSets.contains(shortName)) {
|
||||||
releaseDate = map.value("releaseDate").toDate();
|
releaseDate = map.value("releaseDate").toDate();
|
||||||
|
|
Loading…
Reference in a new issue