chore: make label fit i18n strings

This commit is contained in:
CMK 2021-08-06 17:45:07 +08:00
parent d681e25e91
commit 5eb6a5f7cd
7 changed files with 68 additions and 15 deletions

View File

@ -7,33 +7,68 @@
<key>AppShared.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>26</integer>
<integer>32</integer>
</dict>
<key>CoreDataStack.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>24</integer>
<integer>33</integer>
</dict>
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
<key>Mastodon - JP.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>23</integer>
<integer>7</integer>
</dict>
<key>Mastodon - RTL.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>8</integer>
</dict>
<key>Mastodon - Release.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>6</integer>
</dict>
<key>Mastodon - ar.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>5</integer>
</dict>
<key>Mastodon - ca.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>30</integer>
</dict>
<key>Mastodon - en.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>Mastodon - es-419.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
</dict>
<key>Mastodon - es.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
<key>Mastodon - fr.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
</dict>
<key>Mastodon - jp.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>28</integer>
</dict>
<key>Mastodon - zh_Hans.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>29</integer>
</dict>
<key>Mastodon.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
@ -42,7 +77,7 @@
<key>MastodonIntent.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>25</integer>
<integer>31</integer>
</dict>
<key>MastodonIntents.xcscheme_^#shared#^_</key>
<dict>
@ -57,12 +92,12 @@
<key>NotificationService.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
<integer>9</integer>
</dict>
<key>ShareActionExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>27</integer>
<integer>35</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>

View File

@ -248,7 +248,7 @@ pulsá en el enlace para confirmar tu cuenta.";
"Scene.Register.Error.Reason.Unreachable" = "%@ parece no existir";
"Scene.Register.Error.Special.EmailInvalid" = "Esta no es una dirección de correo electrónico válida";
"Scene.Register.Error.Special.PasswordTooShort" = "La contraseña es demasiado corta (debe tener al menos 8 caracteres)";
"Scene.Register.Error.Special.UsernameInvalid" = "El nombre de usuario sólo debe contener caracteres alfanuméricos sin signos diacríticos y subguiones ("_")";
"Scene.Register.Error.Special.UsernameInvalid" = "El nombre de usuario sólo debe contener caracteres alfanuméricos sin signos diacríticos y subguiones (\"_\")";
"Scene.Register.Error.Special.UsernameTooLong" = "El nombre de usuario es demasiado largo (no puede tener más de 30 caracteres)";
"Scene.Register.Input.Avatar.Delete" = "Eliminar";
"Scene.Register.Input.DisplayName.Placeholder" = "nombre para mostrar";
@ -349,4 +349,4 @@ el que quieras.";
"Scene.Thread.BackTitle" = "Mensaje";
"Scene.Thread.Title" = "Mensaje de %@";
"Scene.Welcome.Slogan" = "La red social,
nuevamente en tu poder.";
nuevamente en tu poder.";

View File

@ -160,6 +160,8 @@ final class ProfileHeaderView: UIView {
let relationshipActionButton: ProfileRelationshipActionButton = {
let button = ProfileRelationshipActionButton()
button.titleLabel?.font = .systemFont(ofSize: 17, weight: .semibold)
button.titleLabel?.adjustsFontSizeToFitWidth = true
button.titleLabel?.minimumScaleFactor = 0.5
return button
}()
@ -406,9 +408,10 @@ extension ProfileHeaderView {
relationshipActionButton.topAnchor.constraint(equalTo: dashboardContainerView.topAnchor),
relationshipActionButton.leadingAnchor.constraint(greaterThanOrEqualTo: statusDashboardView.trailingAnchor, constant: 8),
relationshipActionButton.trailingAnchor.constraint(equalTo: dashboardContainerView.readableContentGuide.trailingAnchor),
relationshipActionButton.widthAnchor.constraint(equalToConstant: ProfileHeaderView.friendshipActionButtonSize.width).priority(.defaultHigh),
relationshipActionButton.widthAnchor.constraint(greaterThanOrEqualToConstant: ProfileHeaderView.friendshipActionButtonSize.width).priority(.required - 1),
relationshipActionButton.heightAnchor.constraint(equalToConstant: ProfileHeaderView.friendshipActionButtonSize.height).priority(.defaultHigh),
])
relationshipActionButton.setContentHuggingPriority(.required - 10, for: .horizontal)
bioContainerView.preservesSuperviewLayoutMargins = true
metaContainerStackView.addArrangedSubview(bioContainerView)

View File

@ -53,6 +53,8 @@ extension ProfileRelationshipActionButton {
setBackgroundImage(.placeholder(color: actionOptionSet.backgroundColor.withAlphaComponent(0.5)), for: .highlighted)
setBackgroundImage(.placeholder(color: actionOptionSet.backgroundColor.withAlphaComponent(0.5)), for: .disabled)
titleEdgeInsets = UIEdgeInsets(top: 0, left: 4, bottom: 0, right: 4)
activityIndicatorView.stopAnimating()
if let option = actionOptionSet.highPriorityAction(except: .editOptions), option == .blocked || option == .suspended {

View File

@ -33,6 +33,9 @@ final class ProfileStatusDashboardMeterView: UIView {
label.adjustsFontSizeToFitWidth = true
label.minimumScaleFactor = 0.8
}
label.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
label.adjustsFontSizeToFitWidth = true
label.minimumScaleFactor = 0.5
return label
}()

View File

@ -13,6 +13,8 @@ class SearchRecommendCollectionHeader: UIView {
let label = UILabel()
label.textColor = Asset.Colors.Label.primary.color
label.font = .systemFont(ofSize: 20, weight: .semibold)
label.adjustsFontSizeToFitWidth = true
label.minimumScaleFactor = 0.6
return label
}()
@ -71,6 +73,7 @@ extension SearchRecommendCollectionHeader {
titleLabel.setContentHuggingPriority(.defaultLow - 1, for: .horizontal)
horizontalStackView.addArrangedSubview(titleLabel)
horizontalStackView.addArrangedSubview(seeAllButton)
seeAllButton.setContentCompressionResistancePriority(.defaultHigh + 10, for: .horizontal)
containerStackView.addArrangedSubview(horizontalStackView)
containerStackView.addArrangedSubview(descriptionLabel)

View File

@ -63,15 +63,20 @@ class SettingsViewController: UIViewController, NeedsDependency {
let notifyLabel = UILabel()
private(set) lazy var notifySectionHeader: UIView = {
let view = notifySectionHeaderStackView
notifyLabel.translatesAutoresizingMaskIntoConstraints = false
notifyLabel.adjustsFontForContentSizeCategory = true
notifyLabel.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: UIFont.systemFont(ofSize: 20, weight: .semibold))
notifyLabel.textColor = Asset.Colors.Label.primary.color
notifyLabel.text = L10n.Scene.Settings.Section.Notifications.Trigger.title
notifyLabel.adjustsFontSizeToFitWidth = true
notifyLabel.minimumScaleFactor = 0.5
view.addArrangedSubview(notifyLabel)
view.addArrangedSubview(whoButton)
whoButton.setContentHuggingPriority(.defaultHigh + 1, for: .horizontal)
whoButton.setContentHuggingPriority(.defaultHigh + 1, for: .vertical)
return view
}()
@ -86,6 +91,8 @@ class SettingsViewController: UIViewController, NeedsDependency {
whoButton.contentEdgeInsets = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5)
whoButton.layer.cornerRadius = 10
whoButton.clipsToBounds = true
whoButton.titleLabel?.adjustsFontSizeToFitWidth = true
whoButton.titleLabel?.minimumScaleFactor = 0.5
return whoButton
}()