Update localization

This commit is contained in:
Ilya Laktyushin 2026-01-28 22:11:45 +04:00
parent a1aa4d9094
commit 809958df3b
8 changed files with 84 additions and 54 deletions

View file

@ -15673,3 +15673,38 @@ Error: %8$@";
"Appearance.SendWithCmdEnter" = "Send Messages with ⌘+Enter";
"Notification.StarsGift.Crafted" = "You crafted a new unique collectible";
"Gift.Craft.Title" = "Craft Gift";
"Gift.Craft.Description" = "Add up to **4 gifts** to craft new\n**$ %@**.\n\nIf crafting fails, all used gifts\nwill be lost.";
"Gift.Craft.ViewVariants" = "View all new variants";
"Gift.Craft.BackdropTooltip" = "There's **%1$@%** chance the crafted gift will have **%2$@** backdrop.";
"Gift.Craft.SymbolTooltip" = "There's **%1$@%** chance the crafted gift will have **%2$@** symbol.";
"Gift.Craft.SuccessChanceSuffix" = "% Success Chance";
"Gift.Craft.Craft" = "Craft %@";
"Gift.Craft.Crafting.Title" = "Crafting";
"Gift.Craft.Crafting.Description" = "If crafting fails, all used gifts\nwill be lost.";
"Gift.Craft.Crafting.SuccessChance" = "%@% Success Chance";
"Gift.Craft.CraftingFailed.Title" = "Crafting Failed";
"Gift.Craft.CraftingFailed.Text_1" = "This crafting attempt was unsuccessful.\n**%@ gift** was lost.";
"Gift.Craft.CraftingFailed.Text_any" = "This crafting attempt was unsuccessful.\n**%@ gifts** were lost.";
"Gift.Craft.CraftingFailed.CraftAnotherGift" = "Craft Another Gift";
"Gift.Craft.Info.Title" = "Craft Gift";
"Gift.Craft.Info.Description" = "Use your existing gifts to craft new ones.";
"Gift.Craft.Info.Paragraph1.Title" = "Combine Gifts";
"Gift.Craft.Info.Paragraph1.Text" = "Add up to 4 Gifts to attempt crafting a new upgraded model.";
"Gift.Craft.Info.Paragraph2.Title" = "Input Matters";
"Gift.Craft.Info.Paragraph2.Text" = "Each craft has a success chance. Better combinations improve the outcome.";
"Gift.Craft.Info.Paragraph3.Title" = "Exclusive Look";
"Gift.Craft.Info.Paragraph3.Text" = "Reforge gifts into a rarer collectibles with a new look.";
"Gift.Craft.Info.SelectGifts" = "Select Gifts";
"Gift.Craft.Unavailable.Title" = "Try Later";
"Gift.Craft.Unavailable.Text" = "You will be able to craft this gift on %@.";
"Gift.Attribute.Rare" = "rare";
"Gift.Attribute.Legendary" = "legendary";
"Gift.Attribute.Epic" = "epic";
"SocksProxySetup.CheckStatus" = "Check Status";
"SocksProxySetup.Warning.Title" = "Warning";
"SocksProxySetup.Warning.Text" = "This action will expose your IP address to the admin of the proxy server.";
"SocksProxySetup.Warning.Proceed" = "Proceed";

View file

@ -89,7 +89,7 @@ private final class AuthConfirmationSheetContent: CombinedComponent {
let alertController = textAlertController(
context: self.context,
title: "Phone Number",
text: "**\(domain)** wants to access your phone number **\(phoneNumber)**. Allow access?",
text: "**\(domain)** wants to access your phone number **\(phoneNumber)**.\n\nAllow access?",
actions: [
TextAlertAction(type: .genericAction, title: "Deny", action: {
commit(false)

View file

@ -613,6 +613,7 @@ public final class ButtonComponent: Component {
if contentView.superview == nil {
contentTransition = .immediate
animateIn = true
contentView.layer.rasterizationScale = UIScreenScale
contentView.isUserInteractionEnabled = false
contentContainerView.addSubview(contentView)
@ -624,7 +625,10 @@ public final class ButtonComponent: Component {
contentTransition.setAlpha(view: contentView, alpha: contentAlpha)
if animateIn && previousContentItem != nil && !transition.animation.isImmediate {
contentView.layer.animateScale(from: 0.4, to: 1.0, duration: 0.35, timingFunction: kCAMediaTimingFunctionSpring)
contentView.layer.shouldRasterize = true
contentView.layer.animateScale(from: 0.4, to: 1.0, duration: 0.35, timingFunction: kCAMediaTimingFunctionSpring, completion: { _ in
contentView.layer.shouldRasterize = false
})
contentView.layer.animateAlpha(from: 0.0, to: contentAlpha, duration: 0.1)
contentView.layer.animatePosition(from: CGPoint(x: 0.0, y: -size.height * 0.15), to: CGPoint(), duration: 0.35, timingFunction: kCAMediaTimingFunctionSpring, additive: true)
}
@ -632,6 +636,7 @@ public final class ButtonComponent: Component {
if let previousContentItem, let previousContentView = previousContentItem.view.view {
if !transition.animation.isImmediate {
previousContentView.layer.shouldRasterize = true
previousContentView.layer.animateScale(from: 1.0, to: 0.0, duration: 0.35, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false)
previousContentView.layer.animateAlpha(from: contentAlpha, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak previousContentView] _ in
previousContentView?.removeFromSuperview()

View file

@ -414,7 +414,7 @@ private final class CraftGiftPageContent: Component {
let titleSize = self.title.update(
transition: transition,
component: AnyComponent(
MultilineTextComponent(text: .plain(NSAttributedString(string: "Craft Gift", font: Font.semibold(17.0), textColor: .white)))
MultilineTextComponent(text: .plain(NSAttributedString(string: environment.strings.Gift_Craft_Title, font: Font.semibold(17.0), textColor: .white)))
),
environment: {},
containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 100.0)
@ -426,17 +426,14 @@ private final class CraftGiftPageContent: Component {
}
transition.setFrame(view: titleView, frame: titleFrame)
transition.setAlpha(view: titleView, alpha: 1.0)
//transition.setBlur(layer: titleView.layer, radius: component.isCrafting ? 10.0 : 0.0)
}
let giftTitle = "\(component.gift.title) #\(formatCollectibleNumber(component.gift.number, dateTimeFormat: environment.dateTimeFormat))"
//TODO:localize
let descriptionFont = Font.regular(13.0)
let descriptionBoldFont = Font.semibold(13.0)
let descriptionColor = UIColor.white
let rawDescriptionString = "Add up to **4 gifts** to craft new\n**$ \(giftTitle)**.\n\nIf crafting fails, all used gifts\nwill be lost."
let rawDescriptionString = environment.strings.Gift_Craft_Description(giftTitle).string
let descriptionString = parseMarkdownIntoAttributedString(rawDescriptionString, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: descriptionFont, textColor: descriptionColor), bold: MarkdownAttributeSet(font: descriptionBoldFont, textColor: descriptionColor), link: MarkdownAttributeSet(font: descriptionFont, textColor: descriptionColor), linkAttribute: { _ in return nil })).mutableCopy() as! NSMutableAttributedString
if let gift = self.starGiftsMap[component.gift.giftId] {
@ -582,7 +579,7 @@ private final class CraftGiftPageContent: Component {
#if DEBUG
self.component?.externalState.testFailOrSuccess = true
#endif
self.showAttributeInfo(tag: backdropButtonTag, text: "There's **\(backdropPermille / 10)%** chance the crafted gift will have **\(backdropName)** backdrop.")
self.showAttributeInfo(tag: backdropButtonTag, text: environment.strings.Gift_Craft_BackdropTooltip("\(backdropPermille / 10)", backdropName).string)
},
tag: backdropButtonTag
)
@ -631,7 +628,7 @@ private final class CraftGiftPageContent: Component {
#if DEBUG
self.component?.externalState.testFailOrSuccess = false
#endif
self.showAttributeInfo(tag: symbolButtonTag, text: "There's **\(symbolPermille / 10)%** chance the crafted gift will have **\(symbolName)** backdrop.")
self.showAttributeInfo(tag: symbolButtonTag, text: environment.strings.Gift_Craft_SymbolTooltip("\(symbolPermille / 10)", symbolName).string)
},
tag: symbolButtonTag
)
@ -642,7 +639,7 @@ private final class CraftGiftPageContent: Component {
craftContentHeight += backdropDialSize.height
craftContentHeight += 15.0
let variantsString = "View all new variants"
let variantsString = environment.strings.Gift_Craft_ViewVariants
let variantsButtonMeasure = self.variantsButtonMeasure.update(
transition: .immediate,
component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: variantsString, font: Font.semibold(13.0), textColor: .clear)))),
@ -800,7 +797,7 @@ private final class CraftGiftPageContent: Component {
let craftingTitleSize = self.craftingTitle.update(
transition: transition,
component: AnyComponent(
MultilineTextComponent(text: .plain(NSAttributedString(string: "Crafting", font: Font.bold(20.0), textColor: .white)))
MultilineTextComponent(text: .plain(NSAttributedString(string: environment.strings.Gift_Craft_Crafting_Title, font: Font.bold(20.0), textColor: .white)))
),
environment: {},
containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 100.0)
@ -844,7 +841,7 @@ private final class CraftGiftPageContent: Component {
let descriptionFont = Font.regular(13.0)
let descriptionBoldFont = Font.semibold(13.0)
let descriptionColor = UIColor.white.withAlphaComponent(0.5)
let rawDescriptionString = "If crafting fails, all used gifts\nwill be lost."
let rawDescriptionString = environment.strings.Gift_Craft_Crafting_Description
let descriptionString = parseMarkdownIntoAttributedString(rawDescriptionString, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: descriptionFont, textColor: descriptionColor), bold: MarkdownAttributeSet(font: descriptionBoldFont, textColor: descriptionColor), link: MarkdownAttributeSet(font: descriptionFont, textColor: descriptionColor), linkAttribute: { _ in return nil })).mutableCopy() as! NSMutableAttributedString
let craftingDescriptionSize = self.craftingDescription.update(
@ -874,7 +871,7 @@ private final class CraftGiftPageContent: Component {
craftingOriginY += craftingDescriptionSize.height
craftingOriginY += 24.0
let craftingProbabilityString = "\(permilleValue / 10)% Success Chance"
let craftingProbabilityString = environment.strings.Gift_Craft_Crafting_SuccessChance("\(permilleValue / 10)").string
let craftingProbabilityMeasure = self.craftingProbabilityMeasure.update(
transition: .immediate,
component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: craftingProbabilityString, font: Font.semibold(13.0), textColor: .clear)))),
@ -945,7 +942,7 @@ private final class CraftGiftPageContent: Component {
let failureTitleSize = self.failureTitle.update(
transition: transition,
component: AnyComponent(
MultilineTextComponent(text: .plain(NSAttributedString(string: "Crafting Failed", font: Font.bold(20.0), textColor: UIColor(rgb: 0xff746d))))
MultilineTextComponent(text: .plain(NSAttributedString(string: environment.strings.Gift_Craft_CraftingFailed_Title, font: Font.bold(20.0), textColor: UIColor(rgb: 0xff746d))))
),
environment: {},
containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 100.0)
@ -967,7 +964,7 @@ private final class CraftGiftPageContent: Component {
let descriptionFont = Font.regular(13.0)
let descriptionBoldFont = Font.semibold(13.0)
let descriptionColor = UIColor(rgb: 0xf7af8c)
let rawDescriptionString = "This crafting attempt was unsuccessful.\n**\(component.selectedGiftIds.count) gifts** were lost."
let rawDescriptionString = environment.strings.Gift_Craft_CraftingFailed_Text(Int32(component.selectedGiftIds.count))
let descriptionString = parseMarkdownIntoAttributedString(rawDescriptionString, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: descriptionFont, textColor: descriptionColor), bold: MarkdownAttributeSet(font: descriptionBoldFont, textColor: descriptionColor), link: MarkdownAttributeSet(font: descriptionFont, textColor: descriptionColor), linkAttribute: { _ in return nil })).mutableCopy() as! NSMutableAttributedString
let failureDescriptionSize = self.failureDescription.update(
@ -1204,7 +1201,7 @@ private final class CraftGiftPageContent: Component {
let infoTitleSize = self.infoTitle.update(
transition: transition,
component: AnyComponent(
MultilineTextComponent(text: .plain(NSAttributedString(string: "Craft Gift", font: Font.bold(20.0), textColor: .white)))
MultilineTextComponent(text: .plain(NSAttributedString(string: environment.strings.Gift_Craft_Info_Title, font: Font.bold(20.0), textColor: .white)))
),
environment: {},
containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 100.0)
@ -1221,7 +1218,7 @@ private final class CraftGiftPageContent: Component {
transition: transition,
component: AnyComponent(MultilineTextComponent(
text: .markdown(
text: "Use your existing gifts to craft new ones.",
text: environment.strings.Gift_Craft_Info_Description,
attributes: MarkdownAttributes(
body: MarkdownAttributeSet(font: Font.regular(14.0), textColor: UIColor(rgb: 0xffffff, alpha: 0.6)),
bold: MarkdownAttributeSet(font: Font.semibold(14.0), textColor: UIColor(rgb: 0xffffff, alpha: 0.6)),
@ -1256,11 +1253,11 @@ private final class CraftGiftPageContent: Component {
var items: [AnyComponentWithIdentity<Empty>] = []
items.append(
AnyComponentWithIdentity(
id: "combine",
id: "paragraph1",
component: AnyComponent(InfoParagraphComponent(
title: "Combine Gifts",
title: environment.strings.Gift_Craft_Info_Paragraph1_Title,
titleColor: titleColor,
text: "Add up to 3 Gifts to attempt crafting a new upgraded model.",
text: environment.strings.Gift_Craft_Info_Paragraph1_Text,
textColor: textColor,
accentColor: accentColor,
iconName: "Premium/Collectible/Badge",
@ -1270,11 +1267,11 @@ private final class CraftGiftPageContent: Component {
)
items.append(
AnyComponentWithIdentity(
id: "input",
id: "paragraph2",
component: AnyComponent(InfoParagraphComponent(
title: "Input Matters",
title: environment.strings.Gift_Craft_Info_Paragraph2_Title,
titleColor: titleColor,
text: "Each craft has a success chance. Better combinations improve the outcome.",
text: environment.strings.Gift_Craft_Info_Paragraph2_Text,
textColor: textColor,
accentColor: accentColor,
iconName: "Premium/Collectible/Transferable",
@ -1284,11 +1281,11 @@ private final class CraftGiftPageContent: Component {
)
items.append(
AnyComponentWithIdentity(
id: "exclusive",
id: "paragraph3",
component: AnyComponent(InfoParagraphComponent(
title: "Exclusive Look",
title: environment.strings.Gift_Craft_Info_Paragraph3_Title,
titleColor: titleColor,
text: "Reforge gifts into a rarer collectibles with a new look",
text: environment.strings.Gift_Craft_Info_Paragraph3_Text,
textColor: textColor,
accentColor: accentColor,
iconName: "Premium/Collectible/Unique",
@ -1517,17 +1514,18 @@ private final class SheetContainerComponent: CombinedComponent {
let buttonContent: AnyComponentWithIdentity<Empty>
if state.displayInfo {
buttonContent = AnyComponentWithIdentity(id: "info", component: AnyComponent(
MultilineTextComponent(text: .plain(NSAttributedString(string: "Select Gifts", font: Font.semibold(17.0), textColor: environment.theme.list.itemCheckColors.foregroundColor)))
MultilineTextComponent(text: .plain(NSAttributedString(string: environment.strings.Gift_Craft_Info_SelectGifts, font: Font.semibold(17.0), textColor: environment.theme.list.itemCheckColors.foregroundColor)))
))
} else if state.displayFailure {
buttonContent = AnyComponentWithIdentity(id: "fail", component: AnyComponent(
MultilineTextComponent(text: .plain(NSAttributedString(string: "Craft Another Gift", font: Font.semibold(17.0), textColor: environment.theme.list.itemCheckColors.foregroundColor)))
MultilineTextComponent(text: .plain(NSAttributedString(string: environment.strings.Gift_Craft_CraftingFailed_CraftAnotherGift, font: Font.semibold(17.0), textColor: environment.theme.list.itemCheckColors.foregroundColor)))
))
} else {
var buttonAnimatedItems: [AnimatedTextComponent.Item] = []
buttonAnimatedItems.append(AnimatedTextComponent.Item(id: "percent", content: .number(Int(permilleValue / 10), minDigits: 1)))
buttonAnimatedItems.append(AnimatedTextComponent.Item(id: "suffix", content: .text("% Success Chance")))
buttonAnimatedItems.append(AnimatedTextComponent.Item(id: "suffix", content: .text(environment.strings.Gift_Craft_SuccessChanceSuffix)))
buttonContent = AnyComponentWithIdentity(id: "craft", component: AnyComponent(
VStack([
@ -1537,7 +1535,7 @@ private final class SheetContainerComponent: CombinedComponent {
HStack([
AnyComponentWithIdentity(
id: AnyHashable("label"),
component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: "Craft \(giftTitle)", font: Font.semibold(17.0), textColor: environment.theme.list.itemCheckColors.foregroundColor))))
component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: environment.strings.Gift_Craft_Craft(giftTitle).string, font: Font.semibold(17.0), textColor: environment.theme.list.itemCheckColors.foregroundColor))))
)
], spacing: 2.0)
)

View file

@ -792,9 +792,7 @@ public final class GiftItemComponent: Component {
func formatPercentage(_ value: Float) -> String {
return String(format: "%0.1f", value).replacingOccurrences(of: ".0", with: "").replacingOccurrences(of: ",0", with: "") + "%"
}
//TODO:localize
let badgeString: String
var badgeColor: UIColor?
switch rarity {
@ -805,13 +803,13 @@ public final class GiftItemComponent: Component {
badgeString = formatPercentage(Float(value) * 0.1)
}
case .epic:
badgeString = "epic"
badgeString = component.strings.Gift_Attribute_Epic
badgeColor = UIColor(rgb: 0xaf52de)
case .legendary:
badgeString = "legendary"
badgeString = component.strings.Gift_Attribute_Legendary
badgeColor = UIColor(rgb: 0xd57e32)
case .rare:
badgeString = "rare"
badgeString = component.strings.Gift_Attribute_Rare
badgeColor = UIColor(rgb: 0x79993d)
}

View file

@ -1365,7 +1365,6 @@ private final class AttributeInfoComponent: Component {
var badgeString = ""
if let rarity {
//TODO:localize
switch rarity {
case let .permille(value):
if value == 0 {
@ -1374,11 +1373,11 @@ private final class AttributeInfoComponent: Component {
badgeString = formatPercentage(Float(value) * 0.1)
}
case .epic:
badgeString = "epic"
badgeString = component.strings.Gift_Attribute_Epic
case .legendary:
badgeString = "legendary"
badgeString = component.strings.Gift_Attribute_Legendary
case .rare:
badgeString = "rare"
badgeString = component.strings.Gift_Attribute_Rare
}
}

View file

@ -1115,11 +1115,10 @@ private final class GiftViewSheetContent: CombinedComponent {
let currentTime = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
if let canCraftDate = arguments.canCraftDate, currentTime < canCraftDate {
let dateString = stringForFullDate(timestamp: canCraftDate, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat)
//TODO:localize
let alertController = textAlertController(
context: self.context,
title: "Try Later",
text: "You will be able to craft this gift on \(dateString).",
title: presentationData.strings.Gift_Craft_Unavailable_Title,
text: presentationData.strings.Gift_Craft_Unavailable_Text(dateString).string,
actions: [
TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})
],

View file

@ -195,15 +195,14 @@ private final class ProxyServerPreviewSheetContent: CombinedComponent {
commit()
return
}
//TODO:localize
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
let alertController = textAlertController(
context: context,
title: "Warning",
text: "This action will expose your IP address to the admin of the proxy server.",
title: presentationData.strings.SocksProxySetup_Warning_Title,
text: presentationData.strings.SocksProxySetup_Warning_Text,
actions: [
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}),
TextAlertAction(type: .defaultAction, title: "Proceed", action: {
TextAlertAction(type: .defaultAction, title: presentationData.strings.SocksProxySetup_Warning_Proceed, action: {
commit()
})
]
@ -253,14 +252,11 @@ private final class ProxyServerPreviewSheetContent: CombinedComponent {
availableSize: CGSize(width: 44.0, height: 44.0),
transition: .immediate
)
let titleText: String = "Proxy"
let buttonText: String = "Connect Proxy"
let title = title.update(
component: MultilineTextComponent(
text: .plain(NSAttributedString(
string: titleText,
string: strings.SocksProxySetup_Title,
font: Font.semibold(17.0),
textColor: theme.actionSheet.primaryTextColor,
paragraphAlignment: .center
@ -323,7 +319,7 @@ private final class ProxyServerPreviewSheetContent: CombinedComponent {
))
}
var statusText = "Check Status"
var statusText = strings.SocksProxySetup_CheckStatus
var statusColor = tableLinkColor
var statusIsActive = true
if let status = state.status {
@ -378,7 +374,7 @@ private final class ProxyServerPreviewSheetContent: CombinedComponent {
),
content: AnyComponentWithIdentity(
id: AnyHashable(0),
component: AnyComponent(MultilineTextComponent(text: .plain(NSMutableAttributedString(string: buttonText, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center))))
component: AnyComponent(MultilineTextComponent(text: .plain(NSMutableAttributedString(string: strings.SocksProxySetup_ConnectAndSave, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center))))
),
displaysProgress: state.inProgress,
action: {