Localize also multiline strings
This commit is contained in:
parent
804a0f06bf
commit
2fdd3fd6ec
5 changed files with 130 additions and 122 deletions
|
|
@ -29,6 +29,8 @@
|
|||
30BF5ED721ED2434000E4154 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 30BF5ED521ED2434000E4154 /* Localizable.stringsdict */; };
|
||||
30C25DBD21F3599E00BB27BB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30C25DBF21F3599E00BB27BB /* InfoPlist.strings */; };
|
||||
30C25DC021F35A6900BB27BB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30C25DC221F35A6900BB27BB /* InfoPlist.strings */; };
|
||||
30C25DD721F4834D00BB27BB /* UILocalizedLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30C25DD521F4834D00BB27BB /* UILocalizedLabel.swift */; };
|
||||
30C25DD821F4834D00BB27BB /* UICodeHighlightingLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30C25DD621F4834D00BB27BB /* UICodeHighlightingLabel.swift */; };
|
||||
30FD2F78214D9E0E005E0A92 /* ParserTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FD2F77214D9E0E005E0A92 /* ParserTest.swift */; };
|
||||
61326CDA7A73757FB68DCB04 /* Pods_passKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAB3F5541E51ADC8C6B56642 /* Pods_passKit.framework */; };
|
||||
A20691F41F2A3D0E0096483D /* SecurePasteboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = A20691F31F2A3D0E0096483D /* SecurePasteboard.swift */; };
|
||||
|
|
@ -215,6 +217,8 @@
|
|||
30C25DA921F34D2800BB27BB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = "<group>"; };
|
||||
30C25DBE21F3599E00BB27BB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
30C25DC121F35A6900BB27BB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
30C25DD521F4834D00BB27BB /* UILocalizedLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UILocalizedLabel.swift; sourceTree = "<group>"; };
|
||||
30C25DD621F4834D00BB27BB /* UICodeHighlightingLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICodeHighlightingLabel.swift; sourceTree = "<group>"; };
|
||||
30FD2F77214D9E0E005E0A92 /* ParserTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParserTest.swift; sourceTree = "<group>"; };
|
||||
31C3033E8868D05B2C55C8B1 /* Pods-passExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-passExtension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-passExtension/Pods-passExtension.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
3A5620D17DF5E86B61761D0E /* Pods_pass.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_pass.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
|
|
@ -450,6 +454,15 @@
|
|||
path = Models;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
30C25DD421F4831200BB27BB /* UserInterface */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
30C25DD621F4834D00BB27BB /* UICodeHighlightingLabel.swift */,
|
||||
30C25DD521F4834D00BB27BB /* UILocalizedLabel.swift */,
|
||||
);
|
||||
path = UserInterface;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A2168A801EFD431A005EA873 /* Controllers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
|
@ -705,6 +718,7 @@
|
|||
DC917BD61E2E8231000FDF54 /* AppDelegate.swift */,
|
||||
DC19400D1E4B3A340077E0A3 /* Models */,
|
||||
DC19400C1E4B39400077E0A3 /* Controllers */,
|
||||
30C25DD421F4831200BB27BB /* UserInterface */,
|
||||
DC19400F1E4B3A9E0077E0A3 /* Views */,
|
||||
DC19400E1E4B3A610077E0A3 /* Helpers */,
|
||||
DC917BDD1E2E8231000FDF54 /* Assets.xcassets */,
|
||||
|
|
@ -1271,7 +1285,9 @@
|
|||
DCDDEAB31E4896BF00F68193 /* PasswordDetailTitleTableViewCell.swift in Sources */,
|
||||
A2A7813F1E97DBD9001311F5 /* QRScannerController.swift in Sources */,
|
||||
DC4914991E434600007FF592 /* PasswordDetailTableViewController.swift in Sources */,
|
||||
30C25DD821F4834D00BB27BB /* UICodeHighlightingLabel.swift in Sources */,
|
||||
DC962CDF1E4B62C10033B5D8 /* AboutTableViewController.swift in Sources */,
|
||||
30C25DD721F4834D00BB27BB /* UILocalizedLabel.swift in Sources */,
|
||||
DC5734AE1E439AD400D09270 /* PasswordsViewController.swift in Sources */,
|
||||
DCD3C65E1EFB9BB400CBE842 /* SettingsSplitViewController.swift in Sources */,
|
||||
A20691F41F2A3D0E0096483D /* SecurePasteboard.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -527,36 +527,17 @@
|
|||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="ASCII-Armor Keys" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cd7-0l-AZW">
|
||||
<rect key="frame" x="20.000000000000007" y="29.666666666666671" width="121.66666666666667" height="17"/>
|
||||
<rect key="frame" x="20.000000000000007" y="66.666666666666671" width="121.66666666666667" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="14"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" usesAttributedText="YES" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="s90-cp-Qxp">
|
||||
<rect key="frame" x="20" y="49.000000000000007" width="357" height="88.666666666666671"/>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="GpgAsciiArmorServerExplanation." lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="s90-cp-Qxp" customClass="UICodeHighlightingLabel" customModule="pass" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="86" width="197.66666666666666" height="15.333333333333334"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<attributedString key="attributedText">
|
||||
<fragment>
|
||||
<string key="content">GnuPG supports the command-line option "-a" that causes output to be generated in an ASCII-armored format similar to unencoded documents rather than the binary format.
|
||||
|
||||
</string>
|
||||
<attributes>
|
||||
<color key="NSColor" red="0.29804000000000003" green="0.29804000000000003" blue="0.29804000000000003" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
|
||||
<font key="NSFont" size="13" name="HelveticaNeue"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
<fragment>
|
||||
<string key="content"> $ gpg --export -a KEY_ID
|
||||
$ gpg --export-secret-keys -a KEY_ID</string>
|
||||
<attributes>
|
||||
<color key="NSColor" red="0.29804000000000003" green="0.29804000000000003" blue="0.29804000000000003" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
|
||||
<font key="NSFont" size="12" name="Menlo-Regular"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
</attributedString>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="13"/>
|
||||
<color key="textColor" red="0.29804000000000003" green="0.29804000000000003" blue="0.29804000000000003" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
|
|
@ -981,34 +962,17 @@ Phone Support PIN #: 84719</string>
|
|||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="ASCII-Armor Keys" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cMp-Iy-NUj">
|
||||
<rect key="frame" x="20.000000000000007" y="42.666666666666664" width="121.66666666666667" height="17"/>
|
||||
<rect key="frame" x="20.000000000000007" y="66.666666666666671" width="121.66666666666667" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="14"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="rWo-ji-Ayq">
|
||||
<rect key="frame" x="20" y="61.999999999999993" width="344" height="64.333333333333329"/>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="SshAsciiArmorServerExplanation." lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="rWo-ji-Ayq" customClass="UICodeHighlightingLabel" customModule="pass" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="86" width="210" height="16.333333333333332"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<attributedString key="attributedText">
|
||||
<fragment>
|
||||
<string key="content">The ASCII-armored key format is similar to unencoded documents rather than the binary format.
|
||||
|
||||
</string>
|
||||
<attributes>
|
||||
<color key="NSColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<font key="NSFont" size="14" name="HelveticaNeue"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
<fragment content=" $ cat ~/.ssh/id_rsa">
|
||||
<attributes>
|
||||
<color key="NSColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<font key="NSFont" size="13" name="Menlo-Regular"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
</attributedString>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
|
||||
<color key="textColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
|
|
@ -1351,55 +1315,17 @@ Phone Support PIN #: 84719</string>
|
|||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="ASCII-Armor Keys" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="M32-yr-IfE">
|
||||
<rect key="frame" x="20.000000000000007" y="14.666666666666664" width="121.66666666666667" height="17"/>
|
||||
<rect key="frame" x="20.000000000000007" y="66.666666666666671" width="121.66666666666667" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="14"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" usesAttributedText="YES" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="sMx-qd-MTJ">
|
||||
<rect key="frame" x="20" y="34" width="357" height="119"/>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="GpgAsciiArmorCopyExplanation." lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="sMx-qd-MTJ" customClass="UICodeHighlightingLabel" customModule="pass" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="86" width="191.33333333333334" height="15.333333333333334"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<attributedString key="attributedText">
|
||||
<fragment>
|
||||
<string key="content">GnuPG supports the command-line option "-a" that causes output to be generated in an ASCII-armored format similar to unencoded documents rather than the binary format.
|
||||
|
||||
</string>
|
||||
<attributes>
|
||||
<color key="NSColor" red="0.29804000000000003" green="0.29804000000000003" blue="0.29804000000000003" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
|
||||
<font key="NSFont" size="13" name="HelveticaNeue"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
<fragment>
|
||||
<string key="content"> $ gpg --export -a KEY_ID
|
||||
$ gpg --export-secret-keys -a KEY_ID</string>
|
||||
<attributes>
|
||||
<color key="NSColor" red="0.29804000000000003" green="0.29804000000000003" blue="0.29804000000000003" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
|
||||
<font key="NSFont" size="12" name="Menlo-Regular"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
<fragment>
|
||||
<string key="content" base64-UTF8="YES">
|
||||
Cg
|
||||
</string>
|
||||
<attributes>
|
||||
<color key="NSColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<font key="NSFont" size="13" name="Menlo-Regular"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
<fragment>
|
||||
<string key="content">
|
||||
The clipboard will be cleared 45s after pasting.</string>
|
||||
<attributes>
|
||||
<color key="NSColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<font key="NSFont" size="13" name="HelveticaNeue"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
</attributedString>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="13"/>
|
||||
<color key="textColor" red="0.29804000000000003" green="0.29804000000000003" blue="0.29804000000000003" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
|
|
@ -1565,44 +1491,17 @@ The clipboard will be cleared 45s after pasting.</string>
|
|||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="ASCII-Armor Keys" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="i78-t7-fP9">
|
||||
<rect key="frame" x="20.000000000000007" y="25.666666666666671" width="121.66666666666667" height="17"/>
|
||||
<rect key="frame" x="20.000000000000007" y="66.666666666666671" width="121.66666666666667" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="14"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Oit-sd-wa5">
|
||||
<rect key="frame" x="20" y="45" width="344" height="97"/>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="SshAsciiArmorCopyExplanation." lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Oit-sd-wa5" customClass="UICodeHighlightingLabel" customModule="pass" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="86" width="203" height="16.333333333333332"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<attributedString key="attributedText">
|
||||
<fragment>
|
||||
<string key="content">The ASCII-armored key format is similar to unencoded documents rather than the binary format.
|
||||
|
||||
</string>
|
||||
<attributes>
|
||||
<color key="NSColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<font key="NSFont" size="14" name="HelveticaNeue"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
<fragment content=" $ cat ~/.ssh/id_rsa">
|
||||
<attributes>
|
||||
<color key="NSColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<font key="NSFont" size="13" name="Menlo-Regular"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
<fragment>
|
||||
<string key="content">
|
||||
|
||||
The clipboard will be cleared 45s after pasting.</string>
|
||||
<attributes>
|
||||
<color key="NSColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<font key="NSFont" size="14" name="HelveticaNeue"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
</attributedString>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
|
||||
<color key="textColor" white="0.40782000000000002" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
|
|
@ -1870,7 +1769,7 @@ The clipboard will be cleared 45s after pasting.</string>
|
|||
</resources>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="QFy-OX-cAa"/>
|
||||
<segue reference="5iZ-y9-FCH"/>
|
||||
<segue reference="oxP-I1-Mke"/>
|
||||
<segue reference="UfP-k3-XeR"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
|
|
|
|||
48
pass/UserInterface/UICodeHighlightingLabel.swift
Normal file
48
pass/UserInterface/UICodeHighlightingLabel.swift
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
UICodeHighlightingLabel.swift
|
||||
pass
|
||||
|
||||
Created by Danny Moesch on 20.01.19.
|
||||
Copyright © 2019 Bob Sun. All rights reserved.
|
||||
*/
|
||||
|
||||
import UIKit
|
||||
import passKit
|
||||
|
||||
class UICodeHighlightingLabel: UILocalizedLabel {
|
||||
|
||||
private static let CODE_ATTRIBUTES: [NSAttributedString.Key: Any] = [.font: UIFont(name: "Menlo-Regular", size: 12)!]
|
||||
private static let ATTRIBUTED_NEWLINE = NSAttributedString(string: "\n")
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
guard let text = text else {
|
||||
return
|
||||
}
|
||||
attributedText = formatCode(in: text)
|
||||
}
|
||||
|
||||
/// Format code sections in a multiline string block.
|
||||
///
|
||||
/// A line in the string is interpreted as a code section if it starts with two spaces.
|
||||
///
|
||||
/// - Parameter text: Multiline string block
|
||||
/// - Returns: Same multiline string block with code sections formatted
|
||||
private func formatCode(in text: String) -> NSMutableAttributedString {
|
||||
let formattedText = text
|
||||
.split(omittingEmptySubsequences: false) {
|
||||
$0 == "\n" || $0 == "\r\n"
|
||||
}.map { line -> NSAttributedString in
|
||||
if line.starts(with: " ") {
|
||||
return NSAttributedString(string: String(line), attributes: UICodeHighlightingLabel.CODE_ATTRIBUTES)
|
||||
}
|
||||
return NSAttributedString(string: String(line))
|
||||
}.reduce(into: NSMutableAttributedString(string: "")) {
|
||||
$0.append($1)
|
||||
$0.append(UICodeHighlightingLabel.ATTRIBUTED_NEWLINE)
|
||||
}
|
||||
formattedText.deleteCharacters(in: NSRange(location: formattedText.length - 1, length: 1))
|
||||
return formattedText
|
||||
}
|
||||
}
|
||||
|
||||
18
pass/UserInterface/UILocalizedLabel.swift
Normal file
18
pass/UserInterface/UILocalizedLabel.swift
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
UILocalizedLabel.swift
|
||||
pass
|
||||
|
||||
Created by Danny Moesch on 20.01.19.
|
||||
Copyright © 2019 Bob Sun. All rights reserved.
|
||||
*/
|
||||
|
||||
import UIKit
|
||||
import passKit
|
||||
|
||||
class UILocalizedLabel: UILabel {
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
text = text?.localize()
|
||||
}
|
||||
}
|
||||
|
|
@ -243,3 +243,30 @@
|
|||
"WannaUseIt?" = "Wanna use it?";
|
||||
"SeemsLikeYouHaveCopiedSomething." = "It seems like you have copied something.";
|
||||
"FirstStringIs:" = "The first string is:";
|
||||
|
||||
// Multiline strings
|
||||
"SshAsciiArmorCopyExplanation." = "The ASCII-armored key format is similar to unencoded documents rather than the binary format. Use
|
||||
|
||||
$ cat ~/.ssh/id_rsa
|
||||
|
||||
to get the key in this specific format. The clipboard will be cleared 45s after pasting.";
|
||||
|
||||
"SshAsciiArmorServerExplanation." = "The ASCII-armored key format is similar to unencoded documents rather than the binary format. Use
|
||||
|
||||
$ cat ~/.ssh/id_rsa
|
||||
|
||||
to get the key in this specific format. Subsequently, copy it to your secured key server.";
|
||||
|
||||
"GpgAsciiArmorCopyExplanation." = "GnuPG supports the command-line option \"-a\" that causes output to be generated in an ASCII-armored format similar to unencoded documents rather than the binary format. Use
|
||||
|
||||
$ gpg --export -a KEY_ID
|
||||
$ gpg --export-secret-keys -a KEY_ID
|
||||
|
||||
to get the public and the private key in this specific format. The clipboard will be cleared 45s after pasting.";
|
||||
|
||||
"GpgAsciiArmorServerExplanation." = "GnuPG supports the command-line option \"-a\" that causes output to be generated in an ASCII-armored format similar to unencoded documents rather than the binary format. Use
|
||||
|
||||
$ gpg --export -a KEY_ID
|
||||
$ gpg --export-secret-keys -a KEY_ID
|
||||
|
||||
to get the public and the private key in this specific format. Subsequently, copy them to your secured key server.";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue