Files
Swiftgram/submodules/TelegramCore/Sources/TelegramEngine/Localization/LocalizationInfo.swift
Isaac d2cf720e0a Refactor constructor use sites for types 180-189 to struct pattern
Refactored constructors:
- JSON types: jsonObjectValue, jsonArray, jsonBool, jsonNumber, jsonObject, jsonString
- Invoice types: invoice, labeledPrice
- Keyboard button types: keyboardButton, keyboardButtonCallback, keyboardButtonUrl, etc.
- Lang pack types: langPackDifference, langPackString, langPackStringPluralized, langPackStringDeleted, langPackLanguage
- Input web file types: inputWebFileLocation, inputWebFileAudioAlbumThumbLocation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 22:27:04 +08:00

28 lines
1.4 KiB
Swift

import Foundation
import Postbox
import TelegramApi
extension LocalizationInfo {
init(apiLanguage: Api.LangPackLanguage) {
switch apiLanguage {
case let .langPackLanguage(langPackLanguageData):
let (flags, name, nativeName, langCode, baseLangCode, pluralCode, stringsCount, translatedCount, translationsUrl) = (langPackLanguageData.flags, langPackLanguageData.name, langPackLanguageData.nativeName, langPackLanguageData.langCode, langPackLanguageData.baseLangCode, langPackLanguageData.pluralCode, langPackLanguageData.stringsCount, langPackLanguageData.translatedCount, langPackLanguageData.translationsUrl)
self.init(languageCode: langCode, baseLanguageCode: baseLangCode, customPluralizationCode: pluralCode, title: name, localizedTitle: nativeName, isOfficial: (flags & (1 << 0)) != 0, totalStringCount: stringsCount, translatedStringCount: translatedCount, platformUrl: translationsUrl)
}
}
}
public final class SuggestedLocalizationInfo {
public let languageCode: String
public let extractedEntries: [LocalizationEntry]
public let availableLocalizations: [LocalizationInfo]
init(languageCode: String, extractedEntries: [LocalizationEntry], availableLocalizations: [LocalizationInfo]) {
self.languageCode = languageCode
self.extractedEntries = extractedEntries
self.availableLocalizations = availableLocalizations
}
}