mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-06-01 07:41:37 +02:00
Update Ghostgram features
This commit is contained in:
@@ -132,15 +132,19 @@ func getLocalization(_ transaction: AccountManagerModifier<TelegramAccountManage
|
||||
|
||||
private func parseLangPackDifference(_ difference: Api.LangPackDifference) -> (code: String, fromVersion: Int32, version: Int32, entries: [LocalizationEntry]) {
|
||||
switch difference {
|
||||
case let .langPackDifference(code, fromVersion, version, strings):
|
||||
case let .langPackDifference(langPackDifferenceData):
|
||||
let (code, fromVersion, version, strings) = (langPackDifferenceData.langCode, langPackDifferenceData.fromVersion, langPackDifferenceData.version, langPackDifferenceData.strings)
|
||||
var entries: [LocalizationEntry] = []
|
||||
for string in strings {
|
||||
switch string {
|
||||
case let .langPackString(key, value):
|
||||
case let .langPackString(langPackStringData):
|
||||
let (key, value) = (langPackStringData.key, langPackStringData.value)
|
||||
entries.append(.string(key: key, value: value))
|
||||
case let .langPackStringPluralized(_, key, zeroValue, oneValue, twoValue, fewValue, manyValue, otherValue):
|
||||
case let .langPackStringPluralized(langPackStringPluralizedData):
|
||||
let (key, zeroValue, oneValue, twoValue, fewValue, manyValue, otherValue) = (langPackStringPluralizedData.key, langPackStringPluralizedData.zeroValue, langPackStringPluralizedData.oneValue, langPackStringPluralizedData.twoValue, langPackStringPluralizedData.fewValue, langPackStringPluralizedData.manyValue, langPackStringPluralizedData.otherValue)
|
||||
entries.append(.pluralizedString(key: key, zero: zeroValue, one: oneValue, two: twoValue, few: fewValue, many: manyValue, other: otherValue))
|
||||
case let .langPackStringDeleted(key):
|
||||
case let .langPackStringDeleted(langPackStringDeletedData):
|
||||
let key = langPackStringDeletedData.key
|
||||
entries.append(.string(key: key, value: ""))
|
||||
}
|
||||
}
|
||||
@@ -242,7 +246,8 @@ private func synchronizeLocalizationUpdates(accountManager: AccountManager<Teleg
|
||||
func tryApplyingLanguageDifference(transaction: AccountManagerModifier<TelegramAccountManagerTypes>, langCode: String, difference: Api.LangPackDifference) -> Bool {
|
||||
let (primary, secondary) = getLocalization(transaction)
|
||||
switch difference {
|
||||
case let .langPackDifference(updatedCode, fromVersion, updatedVersion, strings):
|
||||
case let .langPackDifference(langPackDifferenceData):
|
||||
let (updatedCode, fromVersion, updatedVersion, strings) = (langPackDifferenceData.langCode, langPackDifferenceData.fromVersion, langPackDifferenceData.version, langPackDifferenceData.strings)
|
||||
var current: (isPrimary: Bool, version: Int32, entries: [LocalizationEntry])?
|
||||
if updatedCode == primary.code {
|
||||
current = (true, primary.version, primary.entries)
|
||||
@@ -259,11 +264,14 @@ func tryApplyingLanguageDifference(transaction: AccountManagerModifier<TelegramA
|
||||
|
||||
for string in strings {
|
||||
switch string {
|
||||
case let .langPackString(key, value):
|
||||
case let .langPackString(langPackStringData):
|
||||
let (key, value) = (langPackStringData.key, langPackStringData.value)
|
||||
updatedEntries.append(.string(key: key, value: value))
|
||||
case let .langPackStringPluralized(_, key, zeroValue, oneValue, twoValue, fewValue, manyValue, otherValue):
|
||||
case let .langPackStringPluralized(langPackStringPluralizedData):
|
||||
let (key, zeroValue, oneValue, twoValue, fewValue, manyValue, otherValue) = (langPackStringPluralizedData.key, langPackStringPluralizedData.zeroValue, langPackStringPluralizedData.oneValue, langPackStringPluralizedData.twoValue, langPackStringPluralizedData.fewValue, langPackStringPluralizedData.manyValue, langPackStringPluralizedData.otherValue)
|
||||
updatedEntries.append(.pluralizedString(key: key, zero: zeroValue, one: oneValue, two: twoValue, few: fewValue, many: manyValue, other: otherValue))
|
||||
case let .langPackStringDeleted(key):
|
||||
case let .langPackStringDeleted(langPackStringDeletedData):
|
||||
let key = langPackStringDeletedData.key
|
||||
updatedEntries.append(.string(key: key, value: ""))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user