mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-19 09:11:48 +00:00
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>
28 lines
1.4 KiB
Swift
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
|
|
}
|
|
}
|